• Post Reply Bookmark Topic Watch Topic
  • New Topic

Initiate an action without a submit button

 
ml yau
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Is there a way not to use JavaScript?

Thank you!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!