Re: [s2] accesing params from s:include tag
Haven't really tried, but I assume the parameter would be a String, so have you tried using 'eq' instead of '=='. Nils-H On Fri, Feb 27, 2009 at 3:06 PM, hernan gonzalez hgonza...@gmail.com wrote: I'm struggling with s:include + s:param in struts 2.0.14 The docs for the include tag http://struts.apache.org/2.0.14/docs/include.html states: How To access parameters Parameters are passed as request parameters, so use the ${param.ParamName} notation to access them. Do not use the property tag to access parameters in included files. That's not very clear for me, (and for others, judging from old messages in the list). The parameters passed to an included jsp via struts2 tags can't be accesed using struts2 tags?? (it appears that the parameters are not added to the parameters collection in the actionContext) This should be really simple, please, can't someone give an example ? Say I have a page.jsp that includes a fragment jsp file via the following: s:include value=frag.jsps:param name=opt1/s:param/s:include In the frag.jsp I want to do something as s:if test=#parameters.opt == 1 ... /s2:if What would be the correct syntax? Hernán J. González - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [s2] accesing params from s:include tag
I do not think you will be able to access the param value passed to s:include within struts tag [clearly an obvious shortcoming]. Your best bet is using jsp expression language as the parameter is put in request scope. I was not able to do it, despite trying a million different forms as well as suggestions by some folks in strust mailing list. --- On Fri, 2/27/09, Nils-Helge Garli Hegvik nil...@gmail.com wrote: From: Nils-Helge Garli Hegvik nil...@gmail.com Subject: Re: [s2] accesing params from s:include tag To: Struts Users Mailing List user@struts.apache.org Received: Friday, February 27, 2009, 2:14 PM Haven't really tried, but I assume the parameter would be a String, so have you tried using 'eq' instead of '=='. Nils-H On Fri, Feb 27, 2009 at 3:06 PM, hernan gonzalez hgonza...@gmail.com wrote: I'm struggling with s:include + s:param in struts 2.0.14 The docs for the include tag http://struts.apache.org/2.0.14/docs/include.html states: How To access parameters Parameters are passed as request parameters, so use the ${param.ParamName} notation to access them. Do not use the property tag to access parameters in included files. That's not very clear for me, (and for others, judging from old messages in the list). The parameters passed to an included jsp via struts2 tags can't be accesed using struts2 tags?? (it appears that the parameters are not added to the parameters collection in the actionContext) This should be really simple, please, can't someone give an example ? Say I have a page.jsp that includes a fragment jsp file via the following: s:include value=frag.jsps:param name=opt1/s:param/s:include In the frag.jsp I want to do something as s:if test=#parameters.opt == 1 ... /s2:if What would be the correct syntax? Hernán J. González - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org __ Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [s2] accesing params from s:include tag
I was not able to do it, despite trying a million different forms as well as suggestions by some folks in strust mailing list. I do not think you will be able to access the param value passed to s:include within struts tag [clearly an obvious shortcoming]. Your best bet is using jsp expression language as the parameter is put in request scope. Indeed a shortcoming, and a frustrating one. Wouldn this be partially fixed if, when the s:include/s:param are evaluated, the params are also put into the parameters object in the ActionContext? Are there good reasons to not doing so ? BTW, although I much prefer Struts2 over Struts1, the fact that many developers -not gurus, but with some months of s2 experience- frequently need to try million different forms ( # % $ params parameters etc etc) till (in the best scenario) it happens to work, should tell something... Hernán J. González - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [s2] accesing params from s:include tag
You're right. I should have read the documentation more closely. It clearly states that no stack is created and you have to access the parameters through the regular servlet objects. If you believe this is a shortcoming, you could register a JIRA issue for it, unless there is one already. Nils-H On Fri, Feb 27, 2009 at 5:23 PM, hernan gonzalez hgonza...@gmail.com wrote: I was not able to do it, despite trying a million different forms as well as suggestions by some folks in strust mailing list. I do not think you will be able to access the param value passed to s:include within struts tag [clearly an obvious shortcoming]. Your best bet is using jsp expression language as the parameter is put in request scope. Indeed a shortcoming, and a frustrating one. Wouldn this be partially fixed if, when the s:include/s:param are evaluated, the params are also put into the parameters object in the ActionContext? Are there good reasons to not doing so ? BTW, although I much prefer Struts2 over Struts1, the fact that many developers -not gurus, but with some months of s2 experience- frequently need to try million different forms ( # % $ params parameters etc etc) till (in the best scenario) it happens to work, should tell something... Hernán J. González - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org