We have a central javascript exit function to which we pass an argument and based on the argument it submits forms with the action of the form decided based on the argument received. All the href clicks also submit a form and the exit function sets a value in the form before submitting it to help the servlet identify which href was clicked.The action for such forms is also set based on the argument passed to the exit fucntion. Here is some sample code.
<%@ taglib uri="someuri" prefix="t" %>
<script>
function formSubmit(myAction) {
document.f1.action = myAction;
document.f1.submit() ;
}
</script>
<html>
<t:form name="f1" method="post">
<t:a href="formSubmit('/validate/insert.forward?mode=browse1')">Example on Inserting Values in the database</t:a><br>
<t:a href="formSubmit('/validate/retrieve.forward?mode=browse')">Example on reterieving values</t:a><br>
<t:a href="formSubmit('/validate/course.forward?mode=browse')">Example on Combo Box</t:a>
</t:form>
----------
From: Shane Warne[SMTP:[EMAIL PROTECTED]]
Reply To: [EMAIL PROTECTED]
Sent: Monday, April 02, 2001 11:10 AM
To: [EMAIL PROTECTED]
Subject: Hyper-Link..
Hi,
I have just started to use Struts was wondering how
should i call an action servlet from a hyperlink..
It works this way,
I generate a report which has dynamic hyperlinks with
some parameters added as the query string. Now when
the link is hit i want a jsp page to load retreiving
data from the database based on the parameters. I
would like to know this in terms of FORM- ACTION
SERVLET - EJB- ACTION SERVLET- JSP.
'd appreciate if someone can guide me through this.
Can i try
href="/logonAction?username=test&password=changeme"
Thanks,
Shane..
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text