简体   繁体   中英

using generic and for each loop in jsp

I am developing a web application. I am using Eclipse as IDE. I was using generic and for each loop, both being feature of java 1.5, and it compiled quite fine when used in backend means in simple java classes. But when I'm using these on jsp, jsp is failing to compile with error showing generic and for each as culprit. Can you shed some light on this? Maybe I am at fault with Eclipse settings?

I've had this problem before on WebSphere I believe. The web containers use certain default versions of the Java source level for compiling jsp's. Below is how you modify that

Tomcat: http://www.giannistsakiris.com/index.php/2007/09/19/apache-tomcat-to-compile-java-5-jsps/

WebSphere: http://www-01.ibm.com/support/docview.wss?uid=swg21264609

JBOSS: https://issues.jboss.org/browse/JBWEB-87

I would recommend using the JSTL tag library. The forEach tag should do what you need nicely.

JSTL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM