I have records listed in a jsp page. Near each record, there are two buttons, edit and delete. How can i link these buttons to appropriate action methods.

Thanks.

Well if it's JSF just bind your "action" attribute with the backing bean's action method such as <h:commandButton ... action="#{pc_beanName.actionMethod}"/> and if it just simple JSP/Servlet, you can call a javascript function on the button and smiply call document.form.action=...... document.form.submit();

- Varun

Deli Dumrul

Greenhorn

Posts: 9

posted 13 years ago

i'm using struts, i added parameter="operation" to action mapping but i couldn't use it with html:button

Hi Deli Dumrul, if your using struts then you should try with this. we have a class named LookupDispatchAction in the package org.apache.struts.actions(not action its actions). here you need give the method name as that of the button and it should be through the ApplicationResource.properties file the method signature is same as that of the execute method.

Hi kumar, if i understood correctly my action class should extend LookupDispatchAction and implement getKeyMethodMap. but i couldn't find ApplicationResource.properties file. i am extending the struts-blank.war so may be i have to create an ApplicationResources.properties file. Thank you very much for your detailed reply.

Its better u use DispacthAction rather than lookupdispatchaction by varying the parameter attribuet of ur action element

Sham Grandhe

Ranch Hand

Posts: 73

posted 13 years ago

Hi Sreenath, Iam not clear with what you can you explain. that in a more detailed manner. if possible plz provide and example. by varying the parameter attribuet of ur action element what do you exactly mean by that.

Originally posted by Fletcher Estes: A simple way to do it is with Javascript:

Hope this helps

Ankit Pradhan

Greenhorn

Posts: 16

posted 13 years ago

Originally posted by :

Hope this helps<hr></blockquote>[/QB]

hi i tried the above code to call the "action-mapping" which i have specified in the struts-config... but it is giving an error at the line(document.forms[0].submit() ... it is saying that "Object doesn't support this property or method" .... can somebody help me in knowing what does that mean... the codes stucks at submitt and doesnt take it to the JSP which is mentioned in <action-mapping> Please help!!!

The only way I've seen to have multiple submits for a single form (at least when I looked on the struts site, maybe this is has been changed). Was to fake it by having the different buttons change the value of a hidden property (using javascript) and then inside the action class you check this property (with an if or switch statement).