You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "bphillips@ku.edu" <bp...@ku.edu> on 2014/03/16 14:51:29 UTC
Need Help Getting s:component tag with parameter to work
I'm working on JIRA WW-4299 and am trying to setup an example application to
validate the problem the person reported with the Struts component tag and
parameters.
In my example app (see attached zip file) I have this markup in index.jsp:
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Index</title>
</head>
<body>
<s:component template="mycomponent.jsp" >
<s:param name="message" value="Welcome To" />
</s:component>
</body>
</html>
In mycomponent.jsp I have this markup:
<%@taglib prefix="s" uri="/struts-tags" %>
Hello and <s:property value="%{parameters.message}" /> My JSP Component
When index.action is run which just results in index.jsp being returned the
page does not include the value of parameters.message - I just see Hello and
My JSP Component
I'm following the Struts 2 component tag guide here:
http://struts.apache.org/release/2.3.x/docs/component.html
Any help would be appreciated so I can get a working example that uses the
component tag and parameters so I can validate the person's issue.
strutscomponentexample.zip
<http://struts.1045723.n5.nabble.com/file/n5715502/strutscomponentexample.zip>
--
View this message in context: http://struts.1045723.n5.nabble.com/Need-Help-Getting-s-component-tag-with-parameter-to-work-tp5715502.html
Sent from the Struts - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Need Help Getting s:component tag with parameter to work
Posted by Lukasz Lenart <lu...@apache.org>.
2014-03-17 15:18 GMT+01:00 bphillips@ku.edu <bp...@ku.edu>:
> Thank you for the help. I totally missed enclosing the value in single
> quotes inside double quotes. I'm going to add some text to the JavaDoc for
> GenericUIBean that makes this clearer (the Component UI tag reference wiki
> page pulls in the JavaDoc).
If you can please migrate docs from snippets in GenericUIBean to wiki
page - we should avoid using snippet macro as this is purely supported
in the latest version of Confluence (and can be dropped at some point)
Regards
--
Ćukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Need Help Getting s:component tag with parameter to work
Posted by "bphillips@ku.edu" <bp...@ku.edu>.
Thank you for the help. I totally missed enclosing the value in single
quotes inside double quotes. I'm going to add some text to the JavaDoc for
GenericUIBean that makes this clearer (the Component UI tag reference wiki
page pulls in the JavaDoc).
Bruce
--
View this message in context: http://struts.1045723.n5.nabble.com/Need-Help-Getting-s-component-tag-with-parameter-to-work-tp5715502p5715506.html
Sent from the Struts - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Need Help Getting s:component tag with parameter to work
Posted by Lukasz Lenart <lu...@apache.org>.
Here you have the answer :-)
Remember: the value params will always be resolved against the
ValueStack so if you mean to pass a string literal to your component,
make sure to wrap it in quotes i.e. value="'value1'" otherwise, the
the value stack will search for an Object on the stack with a method
of getValue1(). (now that i've written this, i'm not entirely sure
this is the case. i should verify this manana)
So it must be:
<s:component template="mycomponent.jsp" >
<s:param name="message" value="'Welcome To'" />
</s:component>
(additional single quotes)
2014-03-16 14:51 GMT+01:00 bphillips@ku.edu <bp...@ku.edu>:
> I'm working on JIRA WW-4299 and am trying to setup an example application to
> validate the problem the person reported with the Struts component tag and
> parameters.
>
> In my example app (see attached zip file) I have this markup in index.jsp:
>
> <%@taglib prefix="s" uri="/struts-tags" %>
>
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>Index</title>
>
> </head>
> <body>
> <s:component template="mycomponent.jsp" >
> <s:param name="message" value="Welcome To" />
> </s:component>
>
>
> </body>
> </html>
>
> In mycomponent.jsp I have this markup:
>
> <%@taglib prefix="s" uri="/struts-tags" %>
>
> Hello and <s:property value="%{parameters.message}" /> My JSP Component
>
>
> When index.action is run which just results in index.jsp being returned the
> page does not include the value of parameters.message - I just see Hello and
> My JSP Component
>
> I'm following the Struts 2 component tag guide here:
> http://struts.apache.org/release/2.3.x/docs/component.html
>
> Any help would be appreciated so I can get a working example that uses the
> component tag and parameters so I can validate the person's issue.
>
> strutscomponentexample.zip
> <http://struts.1045723.n5.nabble.com/file/n5715502/strutscomponentexample.zip>
>
>
>
> --
> View this message in context: http://struts.1045723.n5.nabble.com/Need-Help-Getting-s-component-tag-with-parameter-to-work-tp5715502.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org