Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding new header to Request  RSS feed

 
Travis Gibson
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Fellow Ranchers,
Here's a question that I have run into.
In a servlet, is it possible to insert a new header into the request before forwarding to a second servlet?
I'd like to avoid any kind of URL encoding if possible.
Regards,
Travis Gibson www.travismgibson.com
travis@travismgibson.com
 
Travis Gibson
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Ranchers,

In answered my own question(Don't you love when that happens)!!
Here's how it's done:
request.setAttribute(String fieldName, Object fieldValue);
then in the second servlet you do in order to get the passed value:
request.getAttribute(String fileName);
Sweet!!
Regards,

Regards,
Travis Gibson, SCJP
Java Developer www.travismgibson.com
travis@travismgibson.com
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!