Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing a URL through a URL in JSP

Posted on 2006-11-24
3
Medium Priority
?
190 Views
Last Modified: 2010-04-01
I'm trying to pass a URL to another URL in JSP.

someething like:

 <a href="http://www.mysite.com/?followOnUrl=<c:out value="${myForm.followOnURL} />"> Click for Link </a>


How do i make sure that the c:out data is escaped properly since it contains url.  I don't want my first page to misinterpret the followOnUrl variable.

Example?
0
Comment
Question by:tmonteit
3 Comments
 
LVL 12

Accepted Solution

by:
enachemc earned 800 total points
ID: 18011007
use URLEncoder.encodeURL()
0
 
LVL 28

Assisted Solution

by:rrz
rrz earned 800 total points
ID: 18011659
I agree with  enachemc.  The solution looks something like this.
<%@ page import="java.net.URLEncoder"%>
<a href="http://www.mysite.com/?followOnUrl=<%=URLEncoder.encode(myForm.getFollowOnURL(),"UTF-8")%> />"> Click for Link </a>    
0
 

Author Comment

by:tmonteit
ID: 18017072
Nice....

solution to enachemc

Points to rrz@871311  for the example.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question