Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2004, 01:13 PM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to pass % in a URL??

Hi all,

We use Struts action as the framework. When clicking on a hyperlink (with URL parameters containing % sign), recieved the exception (java.lang.IllegalArgumentException) as attached below.

Any idea or code examples how to pass URL parameters with % sign?

Thanks,

Wendy
 
Old October 15th, 2004, 03:40 PM
Authorized User
 
Join Date: Oct 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you are running into an URL decoding issue.
There was a similar topic discussed at http://www.theserverside.com/discuss...thread_id=6837

the message at http://www.theserverside.com/discuss..._id=6837#21953 directly references a % character in the URL

The relevant code is...
e.g.

(assuming file name is being passed as a request parameter, i.e. http://myserver/foo.jsp?filename=abc%20123.txt)

In your JSP:

<%@ page import="java.net.*" %>
<%
...
String encodedFilename = request.getParameter("filename"); // isolate the filename in a variable
String decodedFilename = URLDecoder.decode(encodedFilename);
...
%>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Open modal window and pass back url to parent nambati Javascript 3 March 23rd, 2010 08:03 AM
URL rewriting with URL forwarding mtabyana BOOK: Professional Search Engine Optimization with PHP: A Dev's Guide to SEO ISBN: 978-0-470-10092-9 0 October 22nd, 2007 08:22 AM
How do I pass URL to querystring? Shawn Mohan .NET Web Services 0 June 28th, 2006 12:33 AM
extract URL from Favorites (.URL Files) PhilHawks VB.NET 2002/2003 Basics 2 November 2nd, 2004 04:35 AM
how to pass multiple values throw url class object kfarooq Servlets 1 June 20th, 2003 04:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.