Here's how I'm referencing the component/template: <s:component template="addposition.jsp"> <s:param name="name" value="'partnerPosition'"/> </s:component>
In my addposition.jsp, I added: <s:set name="field" value="%{parameters.name}" /> <s:property value="fieldErrors[field][0]" /> This doesn't render the error for "partnerPosition". However, if I change it to: <s:set name="field" value="%{parameters.name}" /> <s:property value="fieldErrors['partnerPosition'][0]" /> ...it works. In my textfield tags, parameters.name is resolved correctly, so I know I'm passing the proper value. I just can't figure out how to pass it in as a literal value to the fieldErrors map. Matt Musachy Barroso wrote: > > Ah..that "parameter", my bad. Just to make it easier to figure it out > break it down to: > > <s:set id="field" value="%{parameters.name}" /> > <s:property value="fieldErrors[field][0]" /> > > now this is kind of a dumb question, but are you sure there is an > error for that field? > > <s:property value="fieldErrors" /> > > musachy > > On 8/6/07, mraible <[EMAIL PROTECTED]> wrote: >> >> I tried your suggestion, no dice. I think the problem is that I have an >> expression w/in an expression. The following works for a textfield: >> >> <s:textfield name="%{parameters.name}.company"/> >> >> I don't know if "parameters" is request parameters - it's whatever >> <s:component><s:param/> creates. >> >> Matt >> >> >> Musachy Barroso wrote: >> > >> > Try (assuming parameters here are the request parameters) >> > >> > <s:property value="fieldErrors[#parameters.name[0]][0]"/> >> > >> > (#parameter.name is an array, it gets me all the time :) ) >> > >> > musachy >> > >> > On 8/6/07, mraible <[EMAIL PROTECTED]> wrote: >> >> >> >> That worked - thanks! >> >> >> >> Now I can't get the following to work - is it possible? >> >> >> >> <s:property value="fieldErrors['%{parameters.name}'][0]"/> >> >> >> >> I need to use this syntax to render errors next to fields since the >> >> default >> >> <s:fielderrors> (simple) tag wraps the error with an <li> even when >> >> there's >> >> only one error. This makes it difficult to put errors next to fields >> (w/o >> >> customizing a theme). >> >> >> >> Matt >> >> >> >> >> >> Musachy Barroso wrote: >> >> > >> >> > try : >> >> > >> >> > <s:param name="name" value="'foo'"/> >> >> > >> >> > musachy >> >> > >> >> > On 8/6/07, mraible <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> I'm trying to use the <s:component> tag to create a re-usable set >> of >> >> >> fields >> >> >> in a form. In my JSP: >> >> >> >> >> >> <s:component template="addposition.jsp"> >> >> >> <s:param name="name" value="foo"/> >> >> >> </s:component> >> >> >> >> >> >> In template/simple/addposition.jsp, I have: >> >> >> >> >> >> <%@ taglib uri="/struts-tags" prefix="s" %> >> >> >> >> >> >> Name: <s:property value="%{parameters.name}"/> >> >> >> >> >> >> For some reason, this doesn't work. >> >> >> >> >> >> Is there something I'm doing wrong? Can templates be JSPs or do >> they >> >> have >> >> >> to >> >> >> be FreeMarker/Velocity? >> >> >> >> >> >> Correct me if I'm wrong, but doesn't Struts' <s:component> tag >> >> accomplish >> >> >> the same thing that can be accomplished with JSTL's <c:import> and >> >> >> <c:param> >> >> >> tags? If so, it seems that JSP 2.0 tag files are a much more >> elegant >> >> >> solution than <s:component> or <c:import>. >> >> >> >> >> >> Thanks, >> >> >> >> >> >> Matt >> >> >> -- >> >> >> View this message in context: >> >> >> >> >> >> http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12023494 >> >> >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> >> >> > >> >> > >> >> > -- >> >> > "Hey you! Would you help me to carry the stone?" Pink Floyd >> >> > >> >> > >> --------------------------------------------------------------------- >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> > For additional commands, e-mail: [EMAIL PROTECTED] >> >> > >> >> > >> >> > >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12024122 >> >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> > -- >> > "Hey you! Would you help me to carry the stone?" Pink Floyd >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12024353 >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12025369 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]