Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Navigate from one JSP to another

 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP which has a button.
<button type= >Click Me</button>
This is not part of any form but rather a stand-alone button. How do I move to B.jsp when I click this button in A.jsp?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pure HTML. Check out the anchor tag. (It might be a good idea to have a basic knowledge of HTML before delving off into JSP).
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<input type="button" name="blah" onclick="document.location.href='asdf.jsp'">
or <a href="asdf.jsp"><input type="button name="blah"></a>
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I did-
<a href="/nextpage.jsp"> <button type=submit>Order Now</button></a>
Button visible and on miving the mouse over it, shows that this will navigate to nextpage.jsp.
But on clicking it, getting a 404 error.
/nextpage.jsp is not available.
Can you help me?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things:
1) Combining the a and the button tag is not a good idea. Use one or the other.
2) The href must be a valid url for the page. We can't possibly help you with your 404 with the information you have provided so far.
 
Mishra Anshu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of

try:--
<a href="nextpage.jsp"><input type= button>Order Now</button> </a>
href="nextpage.jsp" or href="../nextpage.jsp", depends on the relative locations of the two files stored.
Hope I understood you right :roll:
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
The ../nextpage.jsp worked just fine.
 
Vinil Mehta
Greenhorn
Posts: 9
Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Thread hijack removed. Please start new topics for your own questions.]
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic