Hi I just found out that unspecified() is called, but the parameter you specified on struts-config must exist, so if you access something like http://mysite/MyAction.do?action= it will call unspecified(), because that action does not exist.
Interesting uh ? On Tue, 2004-02-03 at 23:38, Jason Lea wrote: > 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: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]