check out dispatch actions..

you can have multiple execute methods with dispatch action ...

Your Action class extends DispatchAction instead of action (check the docs)

public final ActionForward submit(
                                                ActionMapping mapping,
                                                ActionForm form,
                                                HttpServletRequest request,
                                                HttpServletResponse response)
        
          throws Exception {
...
}

public final ActionForward lookup(
                                                ActionMapping mapping,
                                                ActionForm form,
                                                HttpServletRequest request,
                                                HttpServletResponse response)
        
          throws Exception {
...
}

in struts config the parameter attibute need to know the name of the parameter your about to send, the value of which is your execute method name..

<action path="/processForm" type="com.sparrow.struts.MyAction" scope="request" parameter="action">
...


and then in jsp

<html:link page="/processForm.do?action=lookup">

<html:link page="/processForm.do?action=submit">


HTH Mark



On Friday, July 11, 2003, at 08:00 PM, Shyam A wrote:


James,

Thanks for your mail. I guess I need to elaborate a little bit. My HTML form can be submitted in 2ways.
1. Clicking the "Submit" button.
2. Clicking the drop-down


Clicking the drop-down triggers a different action than clicking the "Submit" button.
Selecting a value in the drop-down would submit the form and populate some of the other fields in the form. This is done before the "Submit" button is clicked. So, I need to distinguish the action of clicking the drop-down from clicking the "Submit" button and I called it "Lookup".


Both actions would be identified with a single property in the ActionForm class - action.

eg:
 <html:submit property="action" value="Submit"/>

I would like to set this "action" property value to "Lookup" on clicking the drop-down using Javascript. I guess a hidden field would not serve the purpose as I already have "action" property defined for the Submit button.

Look forward to your help/suggestions.

Thanks,
Shyam

James Mitchell <[EMAIL PROTECTED]> wrote:

You will need to create a hidden field named "action", with a value of
"Lookup":



My question to you is....why "Lookup"? What does that have to do with your
form?



Here's a sample:



function submitForm(form) { form.action.value="Lookup"; form.submit(); return true; }



 [input]
 Test Test2



On Friday 11 July 2003 14:15, Shyam A wrote:
Hi,

I have an HTML form with Submit and Cancel buttons, and a drop down list,
which when clicked submits the form. I use Javascript to submit the form
when the dropdown list is clicked. I have a property called "action"
defined in my ActionForm class that identifies the Submit and Cancel
buttons in the HTML form. When the drop-down is clicked, I would like to
set the value of this "action" property to "Lookup".


My Javascript function is given below:

################


function submitForm(form) { form.action.value="Lookup"; form.submit(); return true; } #################

and I invoke this function in my HTML form as shown below:

#########################

Test

###########################

But, the value of the property "action" is not set to "Lookup".

Any help would be greatly appreciated.

Thanks,
Shyam


--------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!

-- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 678-910-8017 AIM:jmitchtx



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to