File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

attribute from jsp to servlet

 
Fernando Dominguez
Ranch Hand
Posts: 104
Debian Eclipse IDE Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I want to pass an attribute from a jsp to servlet

I have tried


request.setAttribute("att", vector); in the jsp

the in the servlet

vector (Verctor)request.getAttribute("att");

but it doesn�t work

Does it only works from servlet to jsp and not in the other way?

Thanks
 
Sudarshan Chakrabarty
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works both way i.e. servlet -> jsp and jsp -> servlet.
You can access the attributes in both the places.
Can you publish your jsp and servlet code?
 
arulk pillai
Author
Ranch Hand
Posts: 3373
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you doing it within the same request? If your request goes out of scope, you attribute won't be available.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sudarshan Chakrabarty:
It works both way i.e. servlet -> jsp and jsp -> servlet.
You can access the attributes in both the places.
No, you can't.

Once the response is sent to the client, the request that generated the first JSP goes out of scope. Any attributes set on that request go away with it.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic