You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by newtostruts struts <ne...@yahoo.com> on 2007/05/22 23:59:45 UTC

in JSP

How do I get the value of this tag in a JSP variable on the same page.
  <s:property value="role" /> . 
  This prints fine on the page but I'm not able to get this value assigned to a JSP variable.
   
  Thanks

 
---------------------------------
 Get your own web address.
 Have a HUGE year through Yahoo! Small Business.

Re: in JSP

Posted by newtostruts struts <ne...@yahoo.com>.
Yes. That did work..
  Thanks Hassan :o)

Hassan Schroeder <ha...@gmail.com> wrote:
  On 5/23/07, newtostruts struts wrote:

> >         String role =  ;
>   %>
>
> Even if I use
> 
>
> I'm not able to use ${foo} in my jsp code.

If you /must/ use a scriptlet in your page, something like:


    String role = (String)request.getAttribute("foo");
%>

:: should work...

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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



       
---------------------------------
Boardwalk for $500? In 2007? Ha! 
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.

Re: in JSP

Posted by Hassan Schroeder <ha...@gmail.com>.
On 5/23/07, newtostruts struts <ne...@yahoo.com> wrote:

>   <%
>         String role = <s:property value="role" /> ;
>   %>
>
>   Even if I use
>   <c:set var="foo"><s:property value="role" /></c:set>
>
>   I'm not able to use ${foo} in my jsp code.

If you /must/ use a scriptlet in your page, something like:

<c:set var="foo" scope="request"><s:property value="role" /></c:set>
<%
    String role = (String)request.getAttribute("foo");
%>

:: should work...

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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


Re: in JSP

Posted by newtostruts struts <ne...@yahoo.com>.
Dave, 
   
  Inside JSP code, 
   
  <%
         ${role}
  %>

  I'm not able to use it inside the <% %>. I want to manipulate this value, so I need to assign this to a variable.
   
  The problem is how do I assign the value of 
  <s:property value="role" /> to a variable inside <% %>
   
  something like this...
   
  <%
           String role = <s:property value="role" />
  %>
  
Dave Newton <ne...@yahoo.com> wrote:
  --- newtostruts struts wrote:
> Even if I use 
> > />
> 
> I'm not able to use ${foo} in my jsp code.

If the action exposes "role" via a getter then
"${role}" will be accessible in the JSP page (assuming
you're running under a JSP 2.0 container).

d.




____________________________________________________________________________________Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/

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





 
---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

Re: in JSP

Posted by Dave Newton <ne...@yahoo.com>.
--- newtostruts struts <ne...@yahoo.com> wrote:
> Even if I use 
> <c:set var="foo"><s:property value="role"
> /></c:set>
> 
>   I'm not able to use ${foo} in my jsp code.

If the action exposes "role" via a getter then
"${role}" will be accessible in the JSP page (assuming
you're running under a JSP 2.0 container).

d.



       
____________________________________________________________________________________Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/

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


Re: in JSP

Posted by newtostruts struts <ne...@yahoo.com>.
Hassan, 
   
  How do I do something like this.
   
  <%
        String role = <s:property value="role" /> ;
  %>

  Even if I use 
  <c:set var="foo"><s:property value="role" /></c:set>

  I'm not able to use ${foo} in my jsp code.
  
Hassan Schroeder <ha...@gmail.com> wrote:
  On 5/22/07, newtostruts struts wrote:
> How do I get the value of this tag in a JSP variable on the same page.
> .

How about using JSTL:



${foo}

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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



       Shape Yahoo! in your own image.  Join our Network Research Panel today!http://us.rd.yahoo.com/evt=48517/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 hot CTA = Join our Network Research Panel

Re: in JSP

Posted by Hassan Schroeder <ha...@gmail.com>.
On 5/22/07, newtostruts struts <ne...@yahoo.com> wrote:
> How do I get the value of this tag in a JSP variable on the same page.
>   <s:property value="role" /> .

How about using JSTL:

  <c:set var="foo"><s:property value="role" /></c:set>

  ${foo}

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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