Hi Ranchers, Im new to struts 2, I have to use jsp 'scriptlet' value in struts 2 as we use it in struts 1.
Example: Struts 1: we will use scriptlet vlaue in struts 1 as: <% String name = "prabhu"; %>
Like we use in struts 1 i need to use it in struts 2: Im using tabbed pane, and in <s iv> tag there is a attribute named 'href' and i tried to use: <% String fromDate = "2006-06-05"; %>
<s:tabbedPanel id="test" > <s iv href="summary.do?fromDate=<%=fromDate%>" id="one" label="Tab 1" theme="ajax" labelposition="top" ></s iv> <s iv id="four" label="Tab 4" theme="ajax"> This is the forth panel. </s iv> <s iv id="five" label="Tab 5" theme="ajax"> This is the forth panel. </s iv> </s:tabbedPanel>
Note: Im using struts 1 action to be called from struts-config.xml file.
Please help me out to use scriptlet values in struts 2 application.
Looking forward for Ranchers reply as early as possible.
Thanks and Regards, Prabhu.
[ June 10, 2008: Message edited by: Bear Bibeault ]
Originally posted by prabhu rangan: I have to use jsp 'scriptlet' value in struts 2
Why do you have to use a scriptlet? It's considered bad form to use scriptlets in JSPs anyway. Why not look for an alternative way of doing it? Struts 2 OGNL is flexible enough that I can't see that you'd ever need to use a scriptlet.
Hi Meriyl, Great to share your thoughts. But please shall you provide me any sample code using OGNL, with what my requirement is. Just an sample code so that i can step up easily and can go on my track in time. Also is it possible to use OGNL with existing struts 1 action class. For example: In my action class im setting an attribute in session,
and this attribute that is set in request should be accessed from a jsp page using OGNL as you suggested, please provide me some sample that you have worked out, or your guidance.