In your url you have acao=comando.pesquisar, I have always used the
form where acao=Pesquisar or the value of the key in the map.  Also
are you sure that your Constants class is providing the Map to the
LookupDispatchAction?

Matt Morton

On 11/30/05, Matheus Eduardo Machado Moreira <[EMAIL PROTECTED]> wrote:
>     I have the following key-value mappings in the .properties file
> (keys and values in Portuguese, I know all of you know Portuguese
> :-)).
>
> comando.pesquisar=Pesquisar (search)
> comando.editar=Editar (edit)
> comando.salvar=Salvar (save)
> comando.iniciar=iniciar (init, used as default entry point)
>
>     I have a class where I put all the constants used throughout the
> application and this class declares a "default" key-method map:
>
> Map<String, String> defaultKeyMethodMap = new HashMap<String, String>();
> defaultKeyMethodMap.put("comando.pesquisar", "pesquisar");
> defaultKeyMethodMap.put("comando.editar", "editar");
> defaultKeyMethodMap.put("comando.salvar", "salvar");
> defaultKeyMethodMap.put("comando.iniciar", "iniciar");
>
>     My getKeyMethodMap() method is as below:
>
> protected Map getKeyMethodMap() {
>     return Constants.defaultKeyMethodMap;
> }
>
>     My action is simple. One detail, I don't define (yet) all the
> methods present in the key-method map because I'm constructing the
> action class method by method and testing each one.
>
> public class CadastroIngredienteAction extends LookupDispatchAction {
>     public ActionForward iniciar(ActionMapping mapping,
>         ActionForm form, HttpServletRequest request,
>         HttpServletResponse response) {
>
>         return mapping.findForward("refresh");
>     }
>
>     // other action methods here
>
>     // getKeyMethodMap() as before comes here
> }
>
>     In my .jsp file I have my buttons like this:
>
> <html:form action="/pesquisaIngrediente">
>     <html:submit property="acao">
>         <fmt:message key="comando.pesquisar"/>
>     </html:submit>
> </html:form>
>
>     Finally the action mapping in struts-config:
>
> <action
>     path="/pesquisaIngrediente"
>     type="br.com.patrulleros.manjar.action.CadastroIngredienteAction"
>     name="cadastroIngredienteFormBean"
>     scope="session"
>     parameter="acao">
>
>     <forward
>         name="refresh"
>         path="/WEB-INF/paginas/cadastroIngrediente/pesquisaIngrediente.jsp"/>
> </action>
>
>     One more thing, I try to access the page typing the page's address
> directly in my browser:
> http://localhost:8084/pesquisaIngrediente.do?acao=comando.pesquisar. I
> do this way because I don't have a menu or something like this yet.
>
>     Thanks,
>
> Matheus Eduardo Machado Moreira
>
> [EMAIL PROTECTED]
> Belo Horizonte - MG
> (31) 8724-8041
>
> Sun Certified Programmer for the Java 2 Plataform 1.4
> --
> "Valeu a pena? Tudo vale a pena
> Se a alma não é pequena."
>
> 2005/11/30, Wendy Smoak <[EMAIL PROTECTED]>:
> > On 11/30/05, Matheus Eduardo Machado Moreira <[EMAIL PROTECTED]> wrote:
> > >     My action extends LookupDispatchAction and implements the
> > > getKeyMethodMap() method. In my ApplicationResources.properties file I
> > > define all the keys for the buttons that can be shown in my
> > > interfaces. Everything seems to be ok but every time I try to access
> > > my pages I receive the following error:
> > > "javax.servlet.ServletException: Action[/pesquisaIngrediente] missing
> > > resource 'comando.iniciar' in key method map".
> >
> > My guess is that you've got things backwards in getKeyMethodMap, but
> > it's hard to tell without seeing some code.  Can you post the relevant
> > bits of getKeyMethodMap, your .properties file, and one of your
> > buttons?
> >
> > --
> > Wendy
> >
> > ---------------------------------------------------------------------
> > 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]
>
>

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

Reply via email to