• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding QueryString in JSP

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As with any other usage, query string parameters need to be properly encoded.

Check out java.net.URLEncoder.
 
Santhana Lakshmi.S
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx a lot for ur valuable suggestion Bear Bibeault

Thanx a lot once again
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic