• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Navigate from one JSP to another

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
The ../nextpage.jsp worked just fine.
 
Greenhorn
Posts: 9
Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Thread hijack removed. Please start new topics for your own questions.]
 
reply
    Bookmark Topic Watch Topic
  • New Topic