Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

contextScope attribute setting

 
Harshana Dias
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

We know we can set request scope attribute in a servlet and pass them in to a servlet like,

request.setAttribute("x", xyz);
RequestDispatcher v=request.getRequestDispatcher("abc.jsp");
v.forward(request, response);

Likewise how to set application scope attribute and call a jsp (dispatching) like above?

Thank You.
 
Chinmaya Chowdary
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Harshana. To set application scope attribute, use
 
Harshana Dias
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. i was asked how to dispatch it for a jsp but i was stupid becuse we no need to dispatch those attributes for a jsp or any other in the web app since its application scope so its already available know for any part of the application.

any way thankx Chinmaya.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!