struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Lea <ja...@kumachan.net.nz>
Subject Re: LookupDispatchAction
Date Tue, 03 Feb 2004 12:38:12 GMT
Well, LookUpDispatchAction doesn't call the unspecified action when it 
is no parameter is supplied.
One way would be to override the method that does the lookup and when no 
action parameter is supplied, call the unspecified() parameter.

Another way is to make your initial call to the action provide the 
parameter.  I have done this in some cases by defining some 
<global-forwards> eg
<forward name="rolelist" path="/admin/RoleAdmin.do?dispatch=list"/>

The other thing that needs to be looked at here is that 'list' will not 
be localised.  So in my default ApplicationResources.properties file I 
have a global.list=list, and have map.put("global.list","list"); entry 
in the keyMethodMap.  Then make sure you don't localise the global.list 
in the other properties files.  I might have a localised list button eg 
map.put("button.list","list"); too, so that the list button appears in 
the correct language.  There is no problem with more than 1 name linking 
to the list method.

Guilherme Barile wrote:

>Hi
>	I have the following DispatchAction working here
>
>public MyDispatchAction extends DispatchAction {
>	public unspecified(...) {
>		read_data_from_database();
>		populate_form();
>		return(mapping.findForward("renderForm");
>	}
>}
>
>renderForm renders the form (I don't access the jsp directly, just the
>action, this way it calls unspecified, which reads data from a database
>and populates the form).
>I tried converting this to a LookupDispatchAction, making
>MyDispatchAction extend LookupDispatchAction and adding
>
>protected Map getKeyMethodMap() {
>        Map map = new HashMap();
>        map.put("button.save", "save");
>        return map;
>}
>
>To the code ... the parameter is called "action" it exists on
>struts-config, the message "button.save" exists on
>ApplicationResources.properties but everytime I run it, I get the error
>Request[/myform] does not contain handler parameter named action
>
>I *guess* it happens because the first time I accessed this form no
>buttons were pressed, so "action" really doesn't exist (yet) ... problem
>is this must happen this way, otherwise I won't be able to read data
>from the database to populate the form.
>
>With an ordinary DispatchAction it works fine, but I can't localize my
>buttons. Any ideas ?
>
>Thanks in advance
>
>gui
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>  
>


-- 
Jason Lea



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message