File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes page forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "page forward" Watch "page forward" New topic

page forward

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
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="">
<input type="button" value="Forwarded Page" onClick="">

<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

Joined: Jan 10, 2002
Posts: 63870

You can't. Forwards happen on the server. All you can do from a client is a redirect.

Moved to the HTML forum.

[Asking smart questions] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

ben oliver wrote:But they don't work.


Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
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.
I agree. Here's the link:
subject: page forward
It's not a secret anymore!