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
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: 374
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

Joined: Jan 10, 2002
Posts: 60774

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] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60774

ben oliver wrote:But they don't work.


Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
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: http://aspose.com/file-tools
subject: page forward
Similar Threads
FORM type security implementation problem?
My struts app went crazy on Internet Explorer
Jumping to the previous page (in history)
javascript: referrer unknown