• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp scriptlet value in struts 2?

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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";
%>

<a href="action.do?name=<%=name%>"></a>


Struts 2:

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 ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
prabhu pandurangan
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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,

'request.setAttribute("name", name);'

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.


Looking forward for your reply.

Thanks and Regards,
Prabhu.

 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic