• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

*****ServletRequest attributes doubt*******

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I was reading the Mannings book for SCWCD, Sec 4.8.3 Acessing request-scoped attributes with RequestDispatcher


"One important aspect of the new servlet specification involves he ability of an included or forwarded servlet to access request information through attributes. The name of the attribute dependes on whether
RequestDispatcher.include() or RequestDispatcher.forward() was invoked."



After this a list of Attributes available to included/forwarded servlets for obtainng information about request is given; like Attribute for included servlet are
javax.servlet.include.request_uri, javax.servlet.include.context_path,
javax.servlet.include.servlet_path, javax.servlet.include.path_info and
javax.servlet.include.querry_string
.

Similarly the Attributes for forwarded servlet
are same with include being replaced by forward.

Further the author says.....

"The values corrrespond to the parameters of the original
request, without regard to further forwarding
. For example, if a forwarded servlet invokes req.getServletPath() the result will be the same as if the java.servlet.include.servlet_path attribute had been acquired with
req.getAttribute(?javax.servlet.include.servlet_path?)"



My question is shouldn't this be
"......the result will be the same as if the
java.servlet.forward.servlet_path attribute had been acquired with
req.getAttribute(?javax.servlet.forward.servlet_path?)" ???

Plz clear the doubt, if possible.

Regards,
Amit
 
Amit Das
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If anyone is reading the Mannings book, can they check it out???

Regards,
Amit
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi amit,

if u have HFSJ, u may come accross similar stuff in the mock exam 5 Question 12 (if i m not making a mistake).


you may like to go thru the servlet spec pdf file, page 24 i suppose
it was only a few days back that i read the stuff u r talking about.

if you get some additon in ur knowledge, let me know.

niranjan
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"The values corrrespond to the parameters of the original
request, without regard to further forwarding.

For example, if a forwarded servlet invokes req.getServletPath() the result will be the same as if the java.servlet.include.servlet_path attribute had been acquired with
req.getAttribute(?javax.servlet.include.servlet_path?)"
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"The values corrrespond to the parameters of the original
request, without regard to further forwarding.

For example, if a forwarded servlet invokes req.getServletPath() the result will be the same as if the java.servlet.include.servlet_path attribute had been acquired with
req.getAttribute(?javax.servlet.include.servlet_path?)"

the forwarded in the above sentence is a general term. dont take it to be a forward( ). so the two analogous sentences that you have are -


if a forwarded servlet invokes req.getServletPath() the result will be the same as if the java.servlet.forward.servlet_path attribute had been acquired with
req.getAttribute(?javax.servlet.forward.servlet_path?)"

and


if a forwarded servlet invokes req.getServletPath() the result will be the same as if the java.servlet.include.servlet_path attribute had been acquired with
req.getAttribute(?javax.servlet.include.servlet_path?)"

correct me if i m wrong
 
Amit Das
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Niranjan,

Thanks for replying.....
Well I'm at one with you for whatever u've said, but can u tell me one more thing what do they mean by putting the '?' before and after the req.getAttribute(?javax.servlet.include.servlet_path?) ......

Regards,
Amit
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a typo. It should be double-quotations.
This book is full of typos, watch out
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please take a look @

http://www.javaworld.com/javaworld/jw-03-2003/jw-0328-servlet-p2.html

and tell me
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic