I have a scenario whereby I forward the HTTP request from Servlet to a JSP for a HTML display. While doing so, I need to attach a "long" value to the "request" object. My solution was to use Long.valueOf(Long.toString(cid)) and attach the "Long" value. Although this solves my purpose, can anybody suggest a better way of doing this?
- Posted by: Devarajan Ramakrishnan
- Posted on: May 14 2003 22:29 EDT
- Attaching Long Object to "request" or "session" object. by Fabrizio Gianneschi on May 16 2003 04:37 EDT
- Attaching Long Object to "request" or "session" object. by Richard Holly on May 22 2003 09:31 EDT
- Attaching Long Object to "request" or "session" object. by Aaron Robinson on May 18 2003 14:22 EDT
why use a String?
This is not 100%. In your scenario forwarded request must be still the same object. Then you can apply setAttribute. Otherwise setParameter is enough.
Or if you did want a String representation...
"" + cid
You'll be pleased to hear that JDK 1.5 is introducing something called autoboxing which will stop you having to perform this wrapping stuff