Salut,
Je commence avec la JSTL mais je galère un peu même avec (les nombreux) exemples sur le net.
J'aimerais transformer cette scriptlet :
en JSTL, mais sachant que XmlField est un objet (non bean) d'un projet à part, comment faire ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 <% String path = pageContext.getServletContext().getRealPath("/WEB-INF/classes/META-INF/spring-scheduler.xml"); File scheduler = new File(path); XmlField root = XmlHelper.evaluate(scheduler); List<XmlField> beans = root.getFields("bean"); for (XmlField bean : beans) { int index = beans.indexOf(bean), modulo = index%3; if (modulo == 0) { if (index != 0) out.print("</div>"); out.print("<div class=\"max-width text-center\">"); } out.print( "<div class=\"qtr-width preview-block block-container\" >" +"<h2>"+ bean.getStringAttr("id") +"</h2><hr/>" +"<button class=\"btn btn-sm btn-primary max-width launch-service\" bean=\""+ bean.getStringAttr("class") +"\" ></button>" +"</div>" ); } int reste = 3 - (beans.size()%3); if (reste > 0) for (int i=0; i<reste; i++) out.print("<div class=\"qtr-width preview-block block-container no-padding\"></div>"); out.print("</div>"); %>
Merci de votre aide.
Partager