You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2009/04/14 22:52:15 UTC

reference variable in struts 1 and 2

in struts 1
  if need to get variable from action, and do further processing, could do following
<logic:iterate id="plist" name="partlist" scope="session" type="neuco.CartItemsForm">
   <%
      qty_available=((CartForm)pageContext.findAttribute("plist")).getQty_available();
      ...
   %>
</logic:iterate>
 
but in struts 2
       public class Cart {
                int qty_available;
                int getQty_available();
                ...
       }
 i know in jsp , could do <s:property value="qty_available"> to get variable, 
 but, how to put this into jsp file, and do further processing as Struts 1 did ?
 something like <%  #{qty_available} %>
 
tks in advance
 
john
 
 
    
         


      

Re: reference variable in struts 1 and 2

Posted by Dave Newton <ne...@yahoo.com>.
Security Management wrote:
> http://struts.apache.org/2.1.6/docs/set.html

AFAIK that doesn't make the variable available to scriptlets, which 
would be the equivalent of the OP's example.

That said, @John, I'd question the need and/or wisdom of performing that 
kind of computation on the JSP page: is it really necessary for you to 
do that kind of logic on the view side?

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: reference variable in struts 1 and 2

Posted by Security Management <li...@secmgmt.com>.
http://struts.apache.org/2.1.6/docs/set.html

-----Original Message-----
From: john lee [mailto:sh_thorn_bird@yahoo.com] 
Sent: Tuesday, April 14, 2009 4:52 PM
To: user@struts.apache.org
Subject: reference variable in struts 1 and 2

in struts 1
  if need to get variable from action, and do further processing, could do
following
<logic:iterate id="plist" name="partlist" scope="session"
type="neuco.CartItemsForm">
   <%
     
qty_available=((CartForm)pageContext.findAttribute("plist")).getQty_availabl
e();
      ...
   %>
</logic:iterate>
 
but in struts 2
       public class Cart {
                int qty_available;
                int getQty_available();
                ...
       }
 i know in jsp , could do <s:property value="qty_available"> to get
variable, 
 but, how to put this into jsp file, and do further processing as Struts 1
did ?
 something like <%  #{qty_available} %>
 
tks in advance
 
john
 
 
    
         


      


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org