> On Mar 16, 2:32 pm, "Alan Cui" <alan...@gmail.com> wrote:
> Instead using LookupDispatchAction, you could use DispatchAction for
[quoted text clipped - 3 lines]
> calling javascript. And configure the dispatch parameter as the hidden
> input's name in you struts-config.xml.
This would fail if Javascript is disabled. LookupDispatchAction is a
better alternative to DispatchAction, in case one wants to scrap out
Javascript from UI. Imagine what happens if you have 100 and 1000 of
CRUD page?
Something seems to be wrong here
> > Here is my resource file:
> >
> > button.Save=Save
> > button.UpdateSave=Save
Should both button? Save and button.UpdateSave have the same value
Save? Obviously it would call Only save method right?
Another thing that comes to my mind is that why you have
handlers.put( props.getProperty( "button.save" ),
SavePersonHandler.class );
handlers.put( props.getProperty( "button.update" ),
UpdatePersonHandler.class );
.class? why?
Should you not be decalaring ActionForward methods? Like
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
You can refer to http://husted.com/struts/tips/003.html to get more
clear picture of the problem.
--
Ck
http://www.gfour.net
nkunkov@escholar.com - 16 Mar 2007 18:04 GMT
> > On Mar 16, 2:32 pm, "Alan Cui" <alan...@gmail.com> wrote:
> > Instead usingLookupDispatchAction, you could use DispatchAction for
[quoted text clipped - 44 lines]
> --
> Ckhttp://www.gfour.net
Hi, Thanks everybody for all your thoughts.
But yes, my problem is that I have avoid Java Script at all costs.
The second problem is that I have only one form and it HAS TO have
either two buttons or three buttons depending on the request
parameter, and in each case one of the buttons always MUST be save.
I also am not sure about Handler.class. In my code i just implement
regular getKeyMethodMap
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.Save", "saveStaffMember");
map.put("button.UpdateSave", "update");
return map;
}
The problem of course is in the properties file:
button.Save=Save
button.UpdateSave=Save
The buttons have to be named the same.
I'm even thinking to split this action into two actions, but then on
the form the name of the action should be dinamic, maybe passed as
request parameter...
If you have any other elegant ideas, i'd like to hear them..
Thanks again.
NK