Solved

Passing a URL through a URL in JSP

Posted on 2006-11-24
3
171 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
Comment Utility
use URLEncoder.encodeURL()
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 200 total points
Comment Utility
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
Comment Utility
Nice....

solution to enachemc

Points to rrz@871311  for the example.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now