• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

passing parameters from servlet to jsp

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can we pass parameters from servlet to jsp without using attributes
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why? Scoped variables (what you called attributes) are the correct means to carry data from a servlet to a forwarded JSP.
 
ramanuja varun
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i just wanted to know if there is a way to pass parameters from servlet to jsp without using the attributes.Please let me know if the answer is yes and do explain with an example
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you say "parameters" are you talking specifically about request parameters (as submitted by a form) or using the term generically to mean "data"?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ramanuja varun:
... without using the attributes.

It's also a good idea to use correct terminology. The correct term is "scoped variables", not "attributes".
 
ramanuja varun
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes sir, i am talking about request parameters.Is there a way?
[ September 16, 2008: Message edited by: ramanuja varun ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Request parameters will automatically be carried along on the request and you don't have to do a single thing.

That assumes, of course, that you are forwarding the request from the servlet to the JSP. If you are performing a redirect, a new request is generated and the parameters will be lost.

Customarily, if these data values need to be kept around, scoped variables in session scope are used.

But other ways could be to store them in cookies, write them to a database, write them to files, and so on.

What's your beef with scoped variables?
[ September 16, 2008: Message edited by: Bear Bibeault ]
 
ramanuja varun
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir Imagine i have a form where in i enter the username and password.Now i have passed them on to the servlet.Further I would like to know is there a way to pass the same request parameters from the servlet to another jsp without using set and getAttributes.I hope the scenario is clear now.
Thanks
[ September 16, 2008: Message edited by: ramanuja varun ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just like I said. It depends how you are traversing from the servlet to the JSP.
 
ramanuja varun
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir can you please explain with a n example how to use the cookies or session to perform the task
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic