Dear struts users,

In every webapplication there are links. As I read in "Struts in Action",
it's better to make links with actions.

I'm now working on some part of the application where we have to do a lot of
CRUD actions, so I want to use the LookupDispatchAction. Inserting/creating
records in the database works great now, but I also would like to use the
LookupDispatchAction for initiating the forms I'm using, but then without
having to use submit buttons.

Therefore I read some postings on this mailinglist that discussed the
opportunity to use the html:link tag to do this. Unfortunately I can't get
it working, so if somebody would have a look at the code I would be very
happy!

#### LookupDispatchAction (CustomerLookupDispatchAction) ###
public Map getKeyMethodMap()
{
 Map map = new HashMap();
 map.put("customer.form.button.initcreateform", "initCreateForm");
 map.put("customer.form.button.initupdateform", "initUpdateForm");
 map.put("form.button.create", "create");
 map.put("form.button.read", "read");
 map.put("form.button.update", "update");
 map.put("form.button.delete", "delete");

 return map;
}

public ActionForward initCreateForm(
 ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 throws Exception
{
 resetToken(request);
 removeFormBean(mapping,request);

 return mapping.findForward("form");
}

### JSP code (part of it) ###
<bean:define id="CustomerCreateForm"
value="customer.form.button.initcreateform"/>
<html:link action="/maintenance/lookupDispatchCustomerSubmit.do"
paramId="method" paramName="CustomerCreateForm" styleClass="tree"
transaction="true"><bean:message key="customer.form.button.initcreateform"
/></html:link>

### application.resources ###
customer.form.button.initcreateform=Add customer
customer.form.button.initupdateform=Update customer

### struts-config.xml ###
<action input=".maintenance.CustomerForm" name="CustomerForm"
   parameter="method" path="/maintenance/lookupDispatchCustomerSubmit"
   scope="request"
   type="com.mit.op.actions.maintenance.CustomerLookupDispatchAction"
validate="true">
   <forward name="form" path="/maintenance/CustomerForm.do"
redirect="false"/>
</action>


Any suggestions are welcome!


Thanks in advance!


Beste regards,

Ronald Rotteveel


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

Reply via email to