Solved

Passing a URL through a URL in JSP

Posted on 2006-11-24
3
178 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 200 total points
ID: 18011007
use URLEncoder.encodeURL()
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 200 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apache server configuration 7 87
best way to search/remove a file from an EAR file 3 112
IE doesn't Invoke servlet in iframe 1 115
oracle fusion vs MQ 2 122
If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…

839 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