On Fri, 14 Jan 2005 18:01:25 -0200, Flávio Maldonado
<[EMAIL PROTECTED]> wrote:
> Hello...
> 
> When I use this tags above, the Button works well, but the Link doesn't
> work.
> 
> <html:form action="/user">
> <html:submit property="action"><bean:message
> key="button.new"/></html:submit>
> <html:link page="/user.do?action='button.new'">New</html:link>

Try the following code below

<%
    String message =
org.apache.struts.taglib.TagUtils.getInstance().message(pageContext,
    org.apache.struts.Globals.MESSAGES_KEY,
    org.apache.struts.Globals.LOCALE_KEY,
    "button.new");
    pageContext.setAttribute("message", message);
%>

<html:link action="/user" paramId="action" paramName="message">New</html:link>

With a LookupDispatchAction you should send the value for a key in the
ApplicationResources.properties file and not the key as a request
parameter

> </html:form>
> 
> At the first moment, both are putting the "button.new" into the action
> variable.
> When I press the button, works well. But I need that the link do the same
> function of the button but I receive this error message when I try click on
> the link:
> 
> java.lang.NullPointerException
>        java.lang.Class.searchMethods(Class.java:1877)
>        java.lang.Class.getMethod0(Class.java:1901)
>        java.lang.Class.getMethod(Class.java:984)
>        
> org.apache.struts.actions.DispatchAction.getMethod(DispatchAction.java:332)
>        
> org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:264)
>        
> org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:234)
>        
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
>        
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
>        org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
>        org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> 
> I extend my Action from LookupDispatchAction, and I implement this method...
> 
>    protected Map getKeyMethodMap() {
>        Map map = new HashMap();
>        map.put("button.new", "newUser");
>        return map;
>    }
> 
> With this mapping, I hope that the method above be executed...
> 
> public ActionForward newUser(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response){
>   return mapping.getInputForward();
> }
> 
> but it's not happening...
> 
> Some body can Help-me?
> 
> I'm sorry for my bad english... ;)
> 
> Thanks...
> 
> Flávio Vilasboas Maldonado
> Diretor de Desenvolvimento
> SedNet Soluções em TI
> (35)3471-9381
> 
> ---------------------------------------------------------------------
> 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