You can, in theory, use scriptlets as often as you like.  You may also use the newer "evaluation language" if you have it implemented.  Struts doesn't "make" you do anything in this regard, but you'll find that by limiting scriptlets and thinking about how you implement the code, you'll be keeping your business logic away from the page.

 

Danilo Gurovich
Manager, Web Development

LowerMyBills.com

[EMAIL PROTECTED]
2401 Colorado Ave., 2nd Floor
Santa Monica, CA 90404
(310) 998-6412

 

-----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