You can use scriptlets.  Whether or not you should depends on how you break out work.  
Where I work, we have a separate crew that does the html/JSP layout and design and so 
we try to keep scriptlets to a bare minimum. ymmv
However, what you want to do sounds like logic:iterate will work, something like this:
 
<logic:iterate collection="yourCollection" id="elementOfYourCollection" 
length="requestScopeVarHoldingANumber">
 
   -----Original Message-----
From: Srihari [mailto:[EMAIL PROTECTED]
Sent: Monday, July 05, 2004 10:58 PM
To: [EMAIL PROTECTED]
Subject: Is scriptlets allowed in struts



hi,
i am new to struts. my colleagues who are in struts say that i shouldnt use scriptlets 
in my jsp page where i use struts. but in some situations where the struts tags dont 
come to our rescue, say in logic situations. then we are compelled to use scriptlets 
to solve the problem. 
for ex,
i am creating a collection to hold some value in my action class. Also i am setting to 
a request/session scope a variable which holds a number. 
in the jsp page i have to iterate using the number used in the request/session scope. 
but it has to display the collection elements holding the value.
for this <logic:iterate isnt helping, or maybe i dont know.
but using scriptlets in jsp it became very easy.
 
My question is can we use scriptlets in struts jsp in such situations or is it 
mandatory that we shouldnt use scriptlets what ever be the reason
regards
Srihari


 

Reply via email to