jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Adding new header to Request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Adding new header to Request" Watch "Adding new header to Request" New topic

Adding new header to Request

Travis Gibson
Ranch Hand

Joined: Oct 17, 2000
Posts: 100
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.
Travis Gibson www.travismgibson.com

Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR>www.travismgibson.com<BR>travis@travismgibson.com
Travis Gibson
Ranch Hand

Joined: Oct 17, 2000
Posts: 100
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);

Travis Gibson, SCJP
Java Developer www.travismgibson.com
I agree. Here's the link: http://aspose.com/file-tools
subject: Adding new header to Request
Similar Threads
How to call multiple servlets from a single form?
Servlet: Insert new request header?
Must reload PDF servlet in IE 5.5??
Two Week anniversary as a Java Developer!!!
IBM WebSphere on Solaris