WAS 8中的EL等效于?

文档说支持参数,但示例使用hl和# ,我不知道在哪里使用c:和$而不是来自docs的$: 我所知道的所有关于EL中的$ vs#都与rvalue和lvalue有关,我需要进一步解释何时使用#style。 我正在寻找typ $ …的EL表达式如何获取参数以及如何使用参数调用非getter非setter,例如从请求上下文中的bean中获取常量静态字符串。 与$相比,#做什么? 如果我想使用$,如何在EL中使用参数? 我想要迁移到EL的scriptlet类似于我想在EL中执行的和 。

固定间隔后获取纬度位置

对于速度测量应用程序,我需要在每四秒后获得经度和经度更新。 我在两次调用getLatitude和getLongitude函数之间使用了sleep函数。 但是在屏幕上打印显示值保持不变,即lon1和lon2,因为双精度数(十进制后的14位)具有完全相同的值,因此速度也显示为0。 如何在固定的时间间隔(此处为4秒)后获得纬度和经度? 非常感谢提前。 locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { double r = 6371; double lat1 = location.getLatitude(); double lon1 = location.getLongitude(); // To get initial longitude SystemClock.sleep(4000); /////This seems ineffective. double lat2 = location.getLatitude(); double lon2 = location.getLongitude(); // and here double dlat = […]

Maven / Spring:AopNamespaceUtils NoSuchMethod错误

使用Maven在windows下构建我的项目工作正常,但是当我在Linux下构建它时,我得到一个关于其中一个spring库的NoSuchMethodError 。 我猜这是与跨平台的类加载器差异和我的依赖项中的某个地方有关,我可能有两次相同的类但是windows加载一个而linux加载另一个? 有没有人遇到过这个问题,或者对如何进一步调试此错误有任何建议? nested exception is java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser$AopAutoProxyConf Stack Trace Pastie POM.xml Pastie

无法从Android中的drawable文件夹使用ShareIntent发送图像文件?

我想使用意图分享图像,我使用了Dixit patel的答案代码。 public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent share = new Intent(Intent.ACTION_SEND); share.setType(“image/png”); File.separator + “icon_ask_fatwa_one.png”); Uri imageUri = Uri.parse(“android.resource://”+getPackageName()+”/”+”drawable/icon_ask_fatwa_one”); Log.i(“imageUri”,””+imageUri); share.putExtra(Intent.EXTRA_STREAM,imageUri); startActivity(Intent.createChooser(share, “Share Image”)); }} 我试图在模拟器中运行此代码时遇到以下错误: 01-25 11:50:57.697:E / AndroidRuntime(265):FATAL EXCEPTION:main 01-25 11:50:57.697:E / AndroidRuntime(265):java.lang.RuntimeException:无法启动活动ComponentInfo {com。 android.mms / com.android.mms.ui.ComposeMessageActivity}:java.lang.NullPointerException 01-25 11:50:57.697:E / AndroidRuntime(265):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736 )01-25 […]

从文件系统导入eclipse项目,然后在服务器上运行

我想在这个链接上做春季安全教程。 在标题为“运行没有Spring Security的教程应用程序”的部分中 ,我采取了以下步骤(针对当前版本与编写教程时使用的版本之间的差异进行了调整): 1.) I downloaded the latest release of the Spring Security Distribution, 2.) found and unzipped a war file in the dist directory called spring-security-samples-tutorial-3.1.2.RELEASE.war 3.) Renamed the resulting folder spring-security-tutorial 4.) Created a general project in eclipse called spring-security-tutorial 5.) Imported all of the contents of the unzipped spring-security-samples-tutorial-3.1.2.RELEASE.war 6.) Right […]

如何序列化ArrayList 2x并且不要过度编写已经存在的ArrayList JAVA

我不得不为我的程序创建一个管理面板来序列化更多对象,它的作用是什么,它将对象(String,String)保存到arraylist中,并且arraylist通过序列化保存到文件中。 当试图将另一个对象添加到arraylist时,程序首先将文件内容反序列化为arraylist,因为如果不这样做,我将如何访问文件中已存在的对象。 但是在添加对象3时会发生类似这样的事情 (安慰) 索引0 [[Word:word1 – 提示:提示1],Word:word2 – 提示:hint2] 怎么解决这个? 我想我应该删除旧的arraylist每次创建一个新的对象,但我不知道该怎么做,有什么我可以做的编辑文件中的旧arraylist而不是删除它。 提前致谢 enter code here class Admin{ ArrayList al = new ArrayList(); public void ifwordsarepresent(){ try { FileInputStream fis = new FileInputStream(“D:/serial.txt”); ObjectInputStream ois = new ObjectInputStream(fis); if(fis.available()>0){ try { try { al.add((ArrayList) ois.readObject()); addingwords(); ois.close(); } catch public void addingwords(){ try { try […]

如何将图像从可绘制资源保存到SD卡?

所以,我有一个如下图所示的视图。 另外,我将添加一个“保存”按钮。 您还可以看到我的XML文件。 我使用此代码通过按下一个和上一个按钮从可绘制文件夹加载图像: public void onClick(View v) { switch (v.getId()){ case R.id.bNext: a++; setImage(a); break; case R.id.bPrevious: if(a>0) { a–; setImage(a); break; } } } private void setImage(int a){ if (a == 0) { slika.setImageResource(R.drawable.l2); a = 1; } else if (a == 1) { slika.setImageResource(R.drawable.l3); a = 2; } else if (a == […]

Android设置片段工具栏标题

片段交易我有一些小错误。 当我打开多个片段并按后退按钮并且工具栏上显示的标题错误时,会出现问题。 例如,从我的Home -> Expenses fragment ,我按下Expenses片段的后退按钮,工具栏上显示的标题是正确的。 但是,让我们说Home -> Expenses -> Incomes fragment ,然后我从Incomes片段按回按钮,它将返回Home片段,但工具栏上显示的标题将是’Expenses’而不是’Home’。 这是我为MainActivity设置的,它扩展了AppCompatActivity: // inside onCreate() put all these code //Setting Navigation View Item Selected Listener to handle the item click of the navigation menu navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { // This method will trigger on item Click of navigation menu @Override public boolean onNavigationItemSelected(MenuItem […]

Java MongoClient无法连接到主服务器

我有一个副本集设置,1个主要(mongo1.test.com),1个辅助(mongo2.test.com)和1个仲裁(mongo3.test.com)。 当我使用MongoClient连接到它们并打印出ReplicaSetStatus时,它显示mongo1.test.com与type = Unknown无关,mongo2.test.com为type = ReplicaSetSecondary,mongo3.test.com为type = Unknown。 因为它不知道哪一个是主要的,我可以找到查询,但我无法插入或更新。 现在我不知道它是Mongo的设置还是驱动程序的配置问题。 任何建议? Mongo版本2.6.1 Java Mongo驱动程序版本2.12.1 Mongo安装在3个单独的Amazon EC2 Linux服务器上。 这是代码: MongoClientOptions.Builder optionsBuilder = MongoClientOptions.builder() .acceptableLatencyDifference(10000) .writeConcern(WriteConcern.REPLICA_ACKNOWLEDGED) .readPreference(ReadPreference.secondaryPreferred()) .connectionsPerHost(10) .connectTimeout(15000) .maxWaitTime(30000) .socketTimeout(60000) .threadsAllowedToBlockForConnectionMultiplier(1500); MongoClientOptions options = optionsBuilder.build(); MongoClient mc = new MongoClient(Arrays.asList( new ServerAddress(“mongo1.test.com”,27017), new ServerAddress(“mongo2.test.com”,27018), new ServerAddress(“mongo3.test.com”,27019)), Arrays.asList(MongoCredential.createMongoCRCredential(xxx, “admin”, xxx.toCharArray()))), options); System.out.println(mc.getRelicaSetStatus()); ReplicaSetStatus打印输出: ReplicaSetStatus { name=eeRS1, cluster=ClusterDescription{ […]

如何在JNI中将int转换为String(?)?

我有一个int []数组,我想在JNI中将它的每个元素转换为String (?),最后将它们连接成一个String (?)(包括逗号)。 例如: // java code int testIntArray = new int[]{1, 2, 3}; String arrayString = “”; jni.constructArrayString(testIntArray, arrayString); // the print content should like this: 1,2,3 System.out.println(“ArrayString: ” + arrayString); // jni code JNIEXPORT void JNICALL constructArrayString (JNIEnv *env, jobject obj, jintArray jArr, jstring jstr) { // to do sth. // code […]