• Post Reply Bookmark Topic Watch Topic
  • New Topic

seting request.attribute when a link is pressed  RSS feed

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

I would like to have my jsp forward to another one using a link, and at the same time to set request.attribute for being caught for the second jsp.

This is what I have tried



Any ideas of how can I get this?

Thanks in advanced
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a fundamental misunderstanding regarding the way JSP works.

JSP runs on the server in order to format an HTML page to be sent to the browser. Once the page has been sent to the browser, all chance to run Java code is gone.

Perhaps this article will help clarify.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to pass info from the HTML page that gets loaded into the browser to the next page, you'll need to use a request parameter on the URL.
 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

I got the answer from the "Use of request.getContextPath in a JSP" question, and also I have decided to use a session parameter

Many Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no such thing as a "session parameter". If you mean a session scoped variable, that has the same issue. The Java in your page will execute on the server prior to the page being sent to the browser, and not when the link is clicked upon.

If that's what you want, why tie it to the anchor tag at all?
[ September 07, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!