开发者

Parsing string variable with jstl

Here's my problem.

I need to set up a process, preferably with jstl/jsp, that depending on what a client enters in a URL parameter, a certain URL will be returned, with the same parameters passed on, and opened via javascript pop up function.

Problem I am having, is that the choose statement is not finding one of the parameters unless its one of the b开发者_StackOverflow中文版eginning parameters. (Now your thinking, 'huh?')

The list of parameters the client is passing, looks like this...

?name=personsname&email=personsemail&tmplatecde=7&legalid=20266998&photoURL=%2Favmedia%2Fweb%2Findex%2F25505893822%2EJPG&agentNumber=047666&FWSType=FR&des=,+CLU%AE,+ChFC%AE&postto=thenetwork.nmfn.com&agentnumber=047666&formname=FWSContactForm2&attr=FRSite

Out of that parameter, I only really need the 'formname.' However if I put the query string in like that, which is what the client is expecting to do, it won't find the formname. Move the formname parameter to before the 'name' parameter, it works.

At my company we built a custom JSP tag that can simply take that query string and attach it to a specified URL, but to determine that URL I need to check what the formname is equal too.

Does anyone have any ideas of an appropriate way to parse the string to get that formname value?

So far, the code that I have that matters to this issue is

<c:choose><c:when test='${param.formname == "FWSContactForm2"}' >

Any help would be greatly appreciated.


It should work fine. That query string however contains a special character which is been URL-encoded using ISO-8859-1, the %AE (the registered mark ®). Maybe the servletcontainer is decoding it using the wrong charset and the one failure followed the other. Remove that %AE part and retest. If it works, I'd investigate the URL encoding configuration of the servletcontainer in question. On the other hand, if you have full control over the page which is supposed to send this query string, you could also set the response charset to the same as what the servletcontainer is using. That would break less things.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜