总结 1 表达式不起作用要检查标签 2 看看是不是跳转到另外一个页面了
最近在修改一个模块,功能倒是简单,主要碰到了一些奇怪的问题,费时间啊~~~现记下来,以免以后再走这样的弯路
1 标签没有引入。
调试一个页面时候,用EL表达式 进行判断条件,但是条件无论如何都不起作用,我就奇怪地从头跟,并 用 <c:out value="${t}" />也打印不出变量,最后搞了半天是c的标签没有引入, 本来页面是引入默认标签的,不知道前人是为什么不引入默认标签
2 修改了页面,但是页面第一次变,点了【下一页】的按钮,它又变到没修改的状态了, 最后发现点【下一页】是跳转到另一个相同的页面,这样来实现不刷新整个页面,只刷新那个tab页面。
3 新建页面是修改了的,点【保存】后,页面又变回原样了,最后发现点【保存】,也是跳转到另外一个相同的页面,悲剧了~~~~
site:http://developer.android.com/guide/topics/fundamentals/activities.html
其中描述Activity中有一段文字
However, even if you do nothing and do not implementonSaveInstanceState(), some of the activity state is restored by theActivity class's default implementation of onSaveInstanceState(). Specifically, the default implementation calls onSaveInstanceState() for every View in the layout, which allows each view to provide information about itself that should be saved. Almost every widget in the Android framework implements this method as appropriate, such that any visible changes to the UI are automatically saved and restored when your activity is recreated. For example, the EditText widget saves any text entered by the user and the CheckBox widget saves whether it's checked or not. The only work required by you is to provide a unique ID (with the android:id attribute) for each widget you want to save its state. If a widget does not have an ID, then it cannot save its state.
最后一句
为什么我不给View添加一个ID,还是会默认的替我们保存数据呢。我测试的是用TextView。有人能帮解答下吗?
如果你在做CTS测试时出现此问题:
会令你感到莫名其妙。这个问题一般是由于使用android提供的缺省私钥对apk包进行签名,导致CTS测试失败。
很多开发者不使用自己的key签名而是使用android提供的缺省私钥对apk包进行签名。只要打开apk包下的META-INF\CERT.RSA查看其中是否有android@android.com或者通过命令jarsigner -verify -certs -verbose xxx.apk查看就知道是否是使用了缺省私钥对包进行了签名。注:jarsigner是JDK命令。
相关的CTS junit的源码如下
security/src/anroid/security/cts/PackageSignatureTest.java
for (PackageInfo packageInfo : allPackageInfos) {
String packageName = packageInfo.packageName;
if (packageName != null && ! isWhitelistedPackage(packageName)) {
for (Signature signature : packageInfo.signatures) {
// android的缺省签名是wellKnownSignatures所有一旦你的包使用它签名一定会被列为badPackages
if (wellKnownSignatures.contains(signature)) {
badPackages.add(packageInfo.packageName);
}
}
}
}
assertTrue("These packages should not be signed with a well known key: " + badPackages, badPackages.isEmpty());