• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

problem with request.getParameter()

 
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
**I am passing value to a servlet through URL through BufferedWriter.write().
sending code for calling servlet:
URL url = new URL("http://192.164.54.87:8080/ChatServlet/sendServlet");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
BufferedWriter out =new BufferedWriter(new OutputStreamWriter( conn.getOutputStream() ) );
out.write("param1="+param1+"¶m2="+param2);
out.flush();
out.close();

**And receiving values in dopost,but some of my characters are getting changed and are getting replaced by ?.
**Plz tell me if this is problem of servlets or request.getParameter().
**Also, in which form request.getParameter() read the parameter as Bytes or as characters.
Thanx
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Set the proper character encoding before reading.
For e.g. request.setCharacterEncoding("UTF-8");

What is the encoding type?
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand correctly I think you'll have to use a url encoder like java.net.URLEncoder to encode the url with the parameters so for example the spaces in your parameters are transformed to +...

Hope this helps
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sending characters of DVBW-TTYogeshEn font.
Which encoding will work for this.
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic