With a little bit more searching I found the escapeAmp attribute of
the <s:url> tag. That did the trick:

<s:url action="edit" var="editURL" escapeAmp = "false">

Thanks!

On Sat, Jun 6, 2009 at 10:41 AM, Dimitrios
Christodoulakis<dimi....@gmail.com> wrote:
> Thank you for the information. That ofnl expression actually worked.
> The textfield is populated with the value taken from the URL
> parameter.
>
> But something strange happens when I try to put more parameters on the 
> request:
>
> <s:url action="edit" var="editURL">
>        <s:param name="id" value="%{id}" />
>        <s:param name="firstName" value="%{firstName}" />
>        <s:param name="lastName" value="%{lastName}" />
> </s:url>
>
> So the link forms like this:
>
> http://localhost/MyApp/edit.action?id=38&amp;firstName=john&amp;lastName=doe
>
> Next, on the update page, I try to retrieve not only the id, but the
> first name and last name too from the URL (in order to pre-fill the
> textfields):
>
> <s:form action="save">
>          <s:textfield name="person.firstName"
> value="%{#parameters.firstName}" label="First Name"/>
>          <s:textfield name="person.lastName"
> value="%{#parameters.lastName}" label="Last Name"/>
>          <s:hidden name="person.id" value="%{#parameters.id}"
> label="Primary Key" />
>          <s:submit/>
> </s:form>
>
> Although ognl correctly picks up the first parameter (id), takes its
> value and populates the hidden field, I get 2 ognl warnings: one for
> the first name and one for the last name:
>
> WARN OgnlValueStack:49 - Error setting value
> ognl.ExpressionSyntaxException: Malformed OGNL expression:
> amp;firstName [ognl.TokenMgrError: Lexical error at line 1, column 4.
> Encountered: ";" (59), after : ""]
>
> WARN OgnlValueStack:49 - Error setting value
> ognl.ExpressionSyntaxException: Malformed OGNL expression:
> amp;lastName [ognl.TokenMgrError: Lexical error at line 1, column 4.
> Encountered: ";" (59), after : ""]
>
> A look at how the URL forms confirms this: Instead of adding the
> parameters in URL using just a "&", parameters are separated by this:
> "&amp;"
>
> --Is that some sort of bug when evaluating multiple struts2 param tags
> with ognl, or do I have something wrong in the jsp code?
> The actual action ode works ok, I believe the issue is within that jsp only.
>
> Again, I appreciate any further advice on this.
> Regards to everyone.
>
>
>
> On Fri, Jun 5, 2009 at 9:32 PM, Dave Newton<newton.d...@yahoo.com> wrote:
>> Dimitrios Christodoulakis wrote:
>>>
>>> <s:hidden name="person.id" value="#attr.id" label="Primary Key" />
>>
>> I told you #attr.id on javaranch; I meant #parameters. This information is
>> readily available via the S2 docs. [1, 2]
>>
>> IIRC the "value" attribute expects a literal; I'd wrap it in the OGNL
>> escape, %{#parameters.id}, to make sure it's evaluated. Correct rendering
>> is, of course, trivially verifiable by viewing the rendered source.
>>
>> The fact remains that if person.id isn't being filled correctly by your Java
>> code something is still wrong with it.
>>
>>> I have also tried unsuccessfully to retrieve the parameter value
>>> from the action code, but always get null.
>>
>> If I'm understanding what you're saying there then something is doubly wrong
>> with either your config or your assumptions: there are several ways to
>> retrieve URL parameters, and AFAIK they all work.
>>
>> Note that the result named "SUCCESS" will never be used if you're using the
>> ActionSupport convenience result constants.
>>
>> Dave
>>
>> [1] OGNL
>> http://struts.apache.org/2.x/docs/ognl.html
>>
>> [2] OGNL Basics
>> http://struts.apache.org/2.x/docs/ognl-basics.html
>>
>> ---------------------------------------------------------------------
>> 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

Reply via email to