How to create templates in JSTL JSP

Say I have a JSP page with JSTL. I use c: forEach and iterate over 5 different sets of objects, each of which is very similar. Each cycle is almost identical. A lot of duplicate code.

I want to make this loop a template - for example, a JSP template, but I want to pass JSTL objects to parameters.

How can i do this?

Or a more general question - how can I create reusable HTML templates in JSP / JSTL?

+3
source share
2 answers

You can use tagfiles . These are JSP fragments with well-defined arguments. Must be perfect for what you need.

+3
source

, , . bean, jsp beans vith ${xxxxScope [param.beanName]} ${xxxxScope [param.formName] [param.beanName]}

0

Source: https://habr.com/ru/post/1749780/


All Articles