How to convert scriptlets into jstl tags
This question already has an answer here:
All that code you have in the scriptles you have to do it in the java code and pass it to the jsp. I don't know if you are using any framework to do this but this is easy in frameworks like Spring MVC.
In your case you should create in java a bean with the properties you need such as isDirectory, length, name of the file, etc. Then you create a list of these beans and pass it to the jsp. Finally, you just iterate these list of beans in the jsp with a forEach loop of JSTL (http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/forEach.html). You can google about it and you'll find lots of examples about how to do this.
Doing this you don't need to use scriptlets.
链接地址: http://www.djcxy.com/p/76608.html上一篇: 在JSP中使用Scriptlets