• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

page forward

 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I create a HTML button that once it's clicked it forward current page to a new JSP ?

I tried

<input type="button" value="Forwarded Page" href="http://www.yahoo.com">
<input type="button" value="Forwarded Page" onClick="http://www.yahoo.com">

<input type="button" value="Forwarded Page" href="/myapp/myAction">
<input type="button" value="Forwarded Page" onClick="/myapp/myAction">

But they don't work.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. Forwards happen on the server. All you can do from a client is a redirect.

Moved to the HTML forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ben oliver wrote:But they don't work.

ItDoesntWorkIsUseless


 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a Servlet. Have your JSP page submit the request to your servlet, which then forwards to the target JSP page.
This has the added benefit of keeping your application logic on the server site and out of your JSP (view) page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic