Hello,
This reminds me of an interesting problem I've been getting with reading/writing
email addresses into cookies, because of the %2C characters. Maybe someone can
help me.
I am storing user's email addresses into a cookie, prepopulating a form with
that data, and storing it in the database. When I pull it back out of the
cookie, it gets % escaped, and on multiple cycles I get multiple escaped values
stuck in.
People will submit this form many times over - it's a click-thru, and the clicks
are logged in a table.
Here's the code:
in the .vm:
<input type="text" name="txtemailaddress" size="30"
value="$!data.cookies.get("visitor.emailaddress")" class="text">
in the action:
if(!StringUtils.isEmpty(data.getParameters().get("txtemailaddress"))) {
log.setEmailaddress(data.getParameters().get("txtemailaddress").trim());
data.getCookies().set("visitor.emailaddress",
data.getParameters().get("txtemailaddress"), Constants.getMONTH_SECONDS());
}
In the table (log is a torque om), I see email address progressions like this:
jjones%252540bellatlantic.net
jjones%25252540bellatlantic.net
jjones%2525252540bellatlantic.net
jjones%252525252540bellatlantic.net
jjones%25252525252540bellatlantic.net
As you can see, my storage/form prepopulation cycle is append 25 to the front
each time, and it looks funny in the email form field as well.
Does anyone know the correct way to turn that %2C stuff back into the proper
character (in the .vm, I suppose, at prepopulation time)? Better yet is there a
way to ask valueParser unescape / not to escape?
Thanks,
Jeff
> -----Original Message-----
> From: Will Glass-Husain [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 21, 2002 1:28 PM
> To: Turbine Users List
> Subject: RE: possible bug in ParameterParser
>
>
> Thanks for the quick reply. Do your URLs substitute "%2C" for the comma
> with subdirectories?
>
> Before someone calls me on it, note that I mistyped the URLs (sorry!) They
> are:
> 1: http://server/turbine/template/simexpress,Equations.vm?id=1
> 2: http://server/turbine/template/simexpress%2CEquations.vm?id=1
>
> When I put the RunData (as "Data") in the context and displath
> "$Data.Parameters", I get:
> 1: Parameters: {template=simexpress,Test.vm} {id=1}
> 2: Parameters: {template=simexpress,Test.vm}
>
> Yes, I'm using Turbine 2.2b1. Incidentally, my TurbineResources.properties
> reads:
> tool.request.link=org.apache.turbine.util.template.TemplateLink
>
> I'll look into it further, dig into the source code a bit.
>
> Thanks, WILL
>
> -----Original Message-----
> From: Phee, Martin J (Jump Tech) [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 21, 2002 11:00 AM
> To: 'Turbine Users List'
> Subject: RE: possible bug in ParameterParser
>
>
> I just tried it, and it works for me.
>
> Almost all of my templates are in subdirectories.
>
> Turbine 2.2b1
>
>
> -----Original Message-----
> From: Will Glass-Husain [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 21, 2002 12:53 PM
> To: [EMAIL PROTECTED]
> Subject: possible bug in ParameterParser
>
>
> Hi,
>
> Anyone hit this bug? When I have a vm file in a subdirectory,
> ParameterParser does not pick up on the query parameters if the separator is
> a "%2C" instead of ",".
>
> More specifically, given the two URLs below, data.getParameters() has a
> value/pair id {id=1} for URL 1 but not URL 2. I think it should be the
> same.
>
> 1: http://server/turbine/simexpress,Equations.vm?id=1
> 2: http://server/turbine/simexpress%2CEquations.vm?id=1
>
> The reason this matters is that $link (TemplateLink) creates URLs of the
> second form.
>
> $link.setPage("simexpress,Equations.vm").addQueryData("id","$MyDBRecord.Id")
>
> I temporarily solved this problem by including the parameter in a path info
> instead of a query string
>
> $link.setPage("simexpress,Equations.vm").addPathInfo("id","$MyDBRecord.Id")
>
> which produces the URL
> http://server/turbine/simexpress%2CEquations.vm/id/1
>
> and the name/value pair gets picked up by ParameterParser properly. Is this
> what I'm supposed to do, or is this just a bug?
>
>
> Best, WILL
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>