wood burning stoves 2.0*
The moose likes Servlets and the fly likes Reading request.attributes() in my servlet dosent work, can anyone tell my why ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reading request.attributes() in my servlet dosent work, can anyone tell my why ?" Watch "Reading request.attributes() in my servlet dosent work, can anyone tell my why ?" New topic
Author

Reading request.attributes() in my servlet dosent work, can anyone tell my why ?

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 348


I try this in my servlet :

System.out.println("FJA er i dopost på ReadDocument..." + request.getParameter("DocId"));

But the DocId is null.....

I want some parameters send from my java program to my servlet, not in the url, but as a post.....

Schould i make a request.getParameter("DocId") or ???

Is this the right to do it, or is there a better solution ?



Frank
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

setRequestProperty does not what you think it does. It does not set properties that will be part of the request query. Instead, modify the URL:
Note that I just added the request key and value directly. In practice, you should use URLEncoder.encode("DocId", "UTF-8") and URLEncoder.encode("NOINDEX.A1001001A09E14A73748F00664.A09E14A73748F00664.1000", "UTF-8"). Or a different encoding if you like.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 348
Thanks a lot, i just googled URLEncoder, and thats the way to do it

Thanks a lot for helping me out

Frank
 
 
subject: Reading request.attributes() in my servlet dosent work, can anyone tell my why ?
 
Similar Threads
How to specify the name of the database
Communicate with the server without a browser.
string getting converted to ASCII
servlet communication on different servers.
Client Abort Exception