• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Initiate an action without a submit button

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Let say there are two jsp files named A.jsp and B.jsp

At A.jsp:
<html>
<head><title>A</title></head>
<body>
<a href="B.jsp">Link to B </a>
</body>
</html>

At B.jsp:
<htlm>
<head><title>B</title></head>
<body>
<form action="viewListing.action" method="post">
<input name="my_listings" value="My Listings" type="submit">
</form>
</body>
</html>

When "Link to B" is clicked, it will direct to page B.jsp. When My Listing submit button is clicked, viewListing action will be initiated.

I would like to know is there a way to automatically initiate action viewListing without having to click the My Listings submit button?
Once the Link to B is clicked, it will call to B.jsp an automatically call viewListing.

Am not sure how JSP can do this? is that possible?

Thank you!
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't see the purpose of doing what you're doing , but Javascript's onLoad() event may do this.
 
ml yau
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way not to use JavaScript?

Thank you!
 
Sheriff
Posts: 67754
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
"ml ye",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
reply
    Bookmark Topic Watch Topic
  • New Topic