That is interesting. I tried using the escapeTick="true" attribute
with the s:url, but got an exception:

org.apache.jasper.JasperException: /pages/list.jsp(26,6) Attribute
escapeTick invalid for tag url according to TLD

A further look at the struts 2 tag reference:
http://struts.apache.org/2.1.6/docs/url.html
Doesn't indicate that the url tag has such an attribute -- I am using
struts 2 version 2.1.6, was that attribute used in other versions?

Since you mentioned it, I tried an example, without the escapeTick
attribute and the URL now forms like this:
http://localhost/MyApp/edit.action?id=69&firstName=colin&lastName=o%27hara

Although the tick (or apostrophe) is not escaped, when I retrieve the
lastName parameter to have the field pre-populated, the name is
rendered correctly.

But, you made a good point, are there other ways to escape special
characters with attributes, or further manual coding are needed?

On Sat, Jun 6, 2009 at 10:26 PM, Martin Gainty<mgai...@hotmail.com> wrote:
>
> yes that works for john doe
> but those of us with irish names like patrick o'donnell would need the tick 
> mark escaped
>  <s:url action="edit" var="editURL" escapeAmp = "false" escapeTick="true">
> ?
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
> sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
> oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich 
> dem Austausch von Informationen und entfaltet keine rechtliche 
> Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen 
> wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
> destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
> l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci 
> est interdite. Ce message sert à l'information seulement et n'aura pas 
> n'importe quel effet légalement obligatoire. Étant donné que les email 
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter 
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>> Date: Sat, 6 Jun 2009 13:13:08 -0500
>> Subject: Re: trouble retrieving a request parameter with struts2 tags
>> From: dimi....@gmail.com
>> To: user@struts.apache.org
>>
>> 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&firstName=john&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:
>> > "&"
>> >
>> > --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
>>
>
> _________________________________________________________________
> Windows Live™: Keep your life in sync.
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_BR_life_in_synch_062009

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to