Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: struts2 how to access a param s:include

Tim Azzopardi

2006-12-22

Replies:



Tim Azzopardi wrote:
>
> If I have,
>
> <s:include value="fleetSelect.jsp">
>  <s:param name="param1" value="value2" />
> </s:include>
>
> How do I access param1 in fleetSelect.jsp?
>
> I've tried a load of combinations and can't get anything to work.
>
> (Sorry for the dumbass question , i've read and reread the docs - i think
> I'm going snowblind)
>
> struts-2.0.1
>

Doh! in value="value2" above the value2 is evaluated as an ONGL expression -
its not a literal string.

If you say
<s:include value="fleetSelect.jsp">
 <s:param name="param1" value="%{'value2'}"/>
</s:include>

or more simply

<s:include value="fleetSelect.jsp">
 <s:param name="param1">value2</s:param>
</s:include>


then you can access the param in a jsp with:
  ${param.param1}
or
  <%= "param1:" + request.getParameter("param1") %>


(Exactly the same thing applies to the action tag too.)
--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.