You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ajay Kalidindi <aj...@kalidindis.com> on 2003/11/13 12:23:47 UTC

action-mappings, action not working

Hi


I am using :

Redhat 9
Apache 2.0.48
Tomcat 4.1.29
Struts 1.1

For some reason I am not getting any errors and control is not getting forwarded
to respective success forward from DummyAction.
Any help is appreciated.

Regards

Ajay Kalidindi

config and source  follows:

struts-config.xml entry:

 <action-mappings>
   <action path="/Menu"    type="com.kalidindis.home.DummyAction" >
     <forward name="success" path="/common/menu.jsp"/>
   </action>
 </action-mappings>

DummyAction.java :

package com.kalidindis.home;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.*;
import org.apache.struts.action.*;
import org.apache.struts.util.*;

/**
 * Implementation of <strong>Action</strong> that lists contacts of Ajay
Kalidindi.
 */

public final class DummyAction extends Action {
  public ActionForward perform(ActionServlet servlet,
                               ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
                        throws IOException, ServletException {
    return (mapping.findForward("success"));
  }
}





Re: action-mappings, action not working

Posted by Phil <pe...@letthemusicplay.de>.
Hi,

the methode signature is wrong.
You have to override the methode

public ActionForward perform(ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
                         throws IOException, ServletException {

There is no method

public ActionForward perform(ActionServlet servlet,
                               ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
                         throws IOException, ServletException {

in the Action class.

Since Struts 1.1 the perform method is deprecated,
so you better use the execute method.

public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 ServletRequest request,
                                 ServletResponse response)
        throws Exception {

HTH,

Phil






----- Original Message -----
From: "Ajay Kalidindi" <aj...@kalidindis.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, November 13, 2003 12:23 PM
Subject: action-mappings, action not working


> Hi
>
>
> I am using :
>
> Redhat 9
> Apache 2.0.48
> Tomcat 4.1.29
> Struts 1.1
>
> For some reason I am not getting any errors and control is not getting
forwarded
> to respective success forward from DummyAction.
> Any help is appreciated.
>
> Regards
>
> Ajay Kalidindi
>
> config and source  follows:
>
> struts-config.xml entry:
>
>  <action-mappings>
>    <action path="/Menu"    type="com.kalidindis.home.DummyAction" >
>      <forward name="success" path="/common/menu.jsp"/>
>    </action>
>  </action-mappings>
>
> DummyAction.java :
>
> package com.kalidindis.home;
>
> import java.io.IOException;
> import javax.servlet.RequestDispatcher;
> import javax.servlet.*;
> import org.apache.struts.action.*;
> import org.apache.struts.util.*;
>
> /**
>  * Implementation of <strong>Action</strong> that lists contacts of Ajay
> Kalidindi.
>  */
>
> public final class DummyAction extends Action {
>   public ActionForward perform(ActionServlet servlet,
>                                ActionMapping mapping,
>                                ActionForm form,
>                                HttpServletRequest request,
>                                HttpServletResponse response)
>                         throws IOException, ServletException {
>     return (mapping.findForward("success"));
>   }
> }
>
>
>
>
>


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


Re: action-mappings, action not working

Posted by Raman Garg <ra...@smartdatainc.com>.
Try to debug it using System.out.println ("<<<<<<SAMPLE TEXT >>>>>>");

in your action class
public ActionForward perform(ActionServlet servlet,
                                ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response)
                         throws IOException, ServletException {
System.out.println ("<<<<<<SAMPLE TEXT >>>>>>");
     return (mapping.findForward("success"));
   }

and check the output at tomcat after restarting it... this will ensure that
your class file is called.
if this goes ok then some problem is there in your index.jsp

cheers
Raman Garg







----- Original Message -----
From: "Ajay Kalidindi" <aj...@kalidindis.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, November 13, 2003 4:53 PM
Subject: action-mappings, action not working


> Hi
>
>
> I am using :
>
> Redhat 9
> Apache 2.0.48
> Tomcat 4.1.29
> Struts 1.1
>
> For some reason I am not getting any errors and control is not getting
forwarded
> to respective success forward from DummyAction.
> Any help is appreciated.
>
> Regards
>
> Ajay Kalidindi
>
> config and source  follows:
>
> struts-config.xml entry:
>
>  <action-mappings>
>    <action path="/Menu"    type="com.kalidindis.home.DummyAction" >
>      <forward name="success" path="/common/menu.jsp"/>
>    </action>
>  </action-mappings>
>
> DummyAction.java :
>
> package com.kalidindis.home;
>
> import java.io.IOException;
> import javax.servlet.RequestDispatcher;
> import javax.servlet.*;
> import org.apache.struts.action.*;
> import org.apache.struts.util.*;
>
> /**
>  * Implementation of <strong>Action</strong> that lists contacts of Ajay
> Kalidindi.
>  */
>
> public final class DummyAction extends Action {
>   public ActionForward perform(ActionServlet servlet,
>                                ActionMapping mapping,
>                                ActionForm form,
>                                HttpServletRequest request,
>                                HttpServletResponse response)
>                         throws IOException, ServletException {
>     return (mapping.findForward("success"));
>   }
> }
>
>
>
>
>


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