Solved

Passing a URL through a URL in JSP

Posted on 2006-11-24
3
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Invest in your employees with these five simple steps to improve employee engagement and retention.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

739 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