Hi,

   I am trying to identify whether a button has been clicked or not in my
jsp.
The way I do this or is trying to do this is to access the request object
and then check in that for the button name. The code is as shown below

The button which was clicked is coded as shown below
<s:submit value="Continue" action="InitAction_stub" type="image"
title="Continue" />

The piece of code where I am trying to check for the button in the jsp 
<s:if test="#request['action:InitAction_stub.x'] != null">
        HI
        <s:set name="abc.currentDisplaySection" value="%{'All'}" />
        <% request.setAttribute("currentSection","All"); %>
</s:if>
<s:else>
        <% request.setAttribute("currentSection","no"); %>
</s:else>

Now I know that the parameter "action:InitAction_stub.x" is present in the
request Map as I can see that in the Action class which later forwards to
the jsp. But I am unable to access it in the jsp.

Is the way I am trying to access the request parameter wrong?
If so how do I get a request parameter in the jsp - I saw the following
usage in one of the struts2 pages 

<s:property value="#request['action:InitAction_stub.x']"/> this shud ideally
print out the value of the button or any other request parameter. But
nothing gets printed. So where am I going wrong and what do I need to do?

Also along with this is there any way I can do the below without using
scriptlets 
<% request.setAttribute("currentSection","All"); %>

Also say I have an object in my action class will I be able to rewrite the
value of that object by using the set statement i.e. will <s:set
name="abc.currentDisplaySection" value="%{'All'}" /> where abc is an object
which is specified in the action class and has getters and setters. My doubt
is whether the above statement will update the currentDisplaySection
variable under abc object?? so that if I say print out the value later using
a <s:property value="abc.currentDisplaySection"/> it shud print out 'All".
Will this work??


TIA,
Arup
-- 
View this message in context: 
http://www.nabble.com/How-to-access-request---session-objects-in-jsp-using-struts2-tags-tf4354438.html#a12407850
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to