for:each loop in IBM Webphere application server 6.1
I have developed a web application and created war file using Netbeans 6.9. I had used Java 5 features extensively, in both jsp's and java files. After deployment while viewing a jsp page that contained for:each loop, I am getting error message saying that,
'for each' statements are only available if source level is 5.0
I had read that WAS6.1 has support for Java5 features. Also checked the jdk version in java/bin, and it is IBM jdk 1.5.
I had also tried the instructions given in t开发者_如何学JAVAhis page. My doubt is there any settings to be done, while creating war
file to make the deployment compatible with Java 5. Or is there any server/application level settings to be done in IBM WAS console?
As you've found, the problem is the WAS 6.1 JSP engine which is based on JSP 2.0 (targeted at Java 1.3). I assume you've found the right parameter:
jdkSourceLevel
This JSP engine parameter is introduced in WebSphere Application Server version 6.1 to support JDK 5. This parameter should be used instead of the compileWithAssert parameter, although compile WithAssert still works in version 6.1. The default value for this parameter is 13. This parameter requires regeneration of Java source. The following are jdkSourceLevel paramater values:
- 13 (default) - This value will disable all new language features of JDK 1.4 and JDK 5.0.
- 14 - This value will enable the use of the assertion facility and will disable all new language features of JDK 5.0.
- 15 - This value will enable the use of the assertion facility and all new language features of JDK 5.0.
I assume you've set this in the right place with the correct case and restarted the server. I would also check that your web.xml declares the Servlet 2.4 schema in case this affects the JSP engine. Failing that, check the support site for fixes.
You should be able to precompile your JSPs using the JspBatchCompiler or the Ant task if all else fails.
I would question why you're using scriptlets at all, but that is a different conversation.
精彩评论