This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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
Author

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="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

Joined: Jan 10, 2002
Posts: 63208
    
  69

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
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

ben oliver wrote:But they don't work.

ItDoesntWorkIsUseless


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.
 
Have you checked out Aspose?
 
subject: page forward
 
It's not a secret anymore!