aspose file tools
The moose likes JSP and the fly likes Regarding  QueryString in  JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Regarding  QueryString in  JSP" Watch "Regarding  QueryString in  JSP" New topic
Author

Regarding QueryString in JSP

Santhana Lakshmi.S
Ranch Hand

Joined: Aug 16, 2005
Posts: 82
Hi,
In my application, im sending emails and in that im giving link to one of my webpage.
Along with the link im passing one name as a query string.
Using JavaMailAPI im setting the mail content like this

MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(body);
mbp1.setContent("center<a href=http://localhost:8084/NewIfotoFx/sharelogin.jsp?username="+username+"&album="+album+"><img src=http://localhost:8084/NewIfotoFx/hii.gif width=145 height=27 border=0 /></a></center>","text/html");

The problem arises if the username or albumname contains any spaces
then only one half of the values is getting passed with the query.
For ex:
albumname = My Photos
then the string passed along with the query is only My
This is happening only when sending along with the email msg.

Can anyone tell me solution for this?
thanx a lot
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56168
    
  13

As with any other usage, query string parameters need to be properly encoded.

Check out java.net.URLEncoder.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Santhana Lakshmi.S
Ranch Hand

Joined: Aug 16, 2005
Posts: 82
Thanx a lot for ur valuable suggestion Bear Bibeault

Thanx a lot once again
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Regarding QueryString in JSP
 
Similar Threads
how to send multiple data in a table in a mail application?
Retrieving pixel data
PersistentObjectException: detached entity passed to persist:
JavaMail - Problem while sending file attachment
Hyperlinks