• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, i just googled URLEncoder, and thats the way to do it

Thanks a lot for helping me out

Frank
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic