take out the name="" JM
> -----Original Message----- > From: Jason B Menard [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 15, 2002 4:44 PM > To: Struts Users Mailing List > Subject: No action instance for path [/path] could be created > > > This one is driving me crazy. I've already checked the archive but found > nothing relevant. I get the following error whenever I run the following > action: > > No action instance for path /addToCart could be created > > The other actions are found, just not this one. Here's the relevant parts > of my struts-config.xml: > > <struts-config> > > <!-- ========== Global Forward Definitions > ============================== --> > <global-forwards> > > <forward name="error" path="/error.jsp"/> > <forward name="welcome" path="/do/welcome"/> > > </global-forwards> > > <!-- ========== Action Mapping Definitions > ============================== --> > <action-mappings> > > <action path="/addToCart" > type="y21.isac.struts.action.AddToCartAction"> > <forward name="success" path="/confirmAddToCart.jsp"/> > </action> > > <action path="/welcome" > type="y21.isac.struts.action.WelcomeAction" > name="" > scope="request" > input=""> > <forward name="success" path="/welcome.jsp"/> > </action> > > <!-- Test Actions --> > > <action path="/testStart" > type="y21.isac.struts.action.IsacTestStartAction"> > <forward name="success" path="/do/welcome"/> > <forward name="AddToCartAction" path="/do/addToCart"/> > </action> > > </action-mappings> > </struts-config> > > I have tried /addToCart both with and without an ActionForm just to see if > it made any difference, but it didn't. Wanting to make sure > whether or not > the ActionServlet was finding AddToCartAction, I added the > following snippet > to IsacTestStartAction (which is where I'm calling /addToCart from): > > try > { > Class.forName("y21.isac.struts.action.AddToCartAction", > true, this.getClass().getClassLoader()); > System.err.println("ISAC Test Message: AddToCartAction > Found"); > } > catch (Exception ex) > { > ex.printStackTrace(); > System.err.println("ISAC Test Message: > AddToCartAction NOT > Found"); > } > > The AddToCartAction class is reported as found (removing the > class file gave > me the expected "NOT Found"). However if I change the > Class.forName line to > read: > > Class.forName("y21.isac.struts.action.AddToCartAction", true, > this.getClass().getClassLoader()); > > I get a ClassNotFoundException and the "NOT Found" message. The > class files > are where they should be however. What I can't understand is how > WelcomeAction and IsacTestStartAction can be found, but AddToCart isn't. > I've stripped the code from AddToCartAction down to the point where all it > does is return the ActionForward. > > Here are the calls to the action from my jsp: > > <html:link page="/do/testStart?testLevel=oo&test=AddToCartAction">Add To > Cart Action Test</html:link> > <html:link page="/do/addToCart">Add To Cart Action Direct</html:link> > > Does anyone have any ideas? Here is the code for IsacTestStartAction and > AddToCartAction for reference. Thanks in advance. > > Jason > > ======================== > > package y21.isac.struts.action; > > import java.io.*; > import javax.servlet.*; > import javax.servlet.http.*; > import org.apache.struts.action.*; > > class AddToCartAction extends org.apache.struts.action.Action > { > public ActionForward perform(ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response) > throws IOException, ServletException > { > return mapping.findForward("success"); > } > } > > ======================== > > package y21.isac.struts.action; > > import java.io.*; > import javax.servlet.*; > import javax.servlet.http.*; > import org.apache.struts.action.*; > import y21.isac.IsacUser; > import netscape.ldap.LDAPException; > > public class IsacTestStartAction extends Action > { > > public ActionForward perform(ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response) > throws IOException, ServletException > { > ActionErrors errors = new ActionErrors(); > IsacUser user = new IsacUser(); > String testLevel = request.getParameter("testLevel"); > try > { > if ("tb".equals(testLevel)) > user.load("isac-tb-1"); > else if ("oo".equals(testLevel)) > user.load("isac-oo-1"); > else if ("bo".equals(testLevel)) > user.load("isac-bo-1"); > else if ("ao".equals(testLevel)) > user.load("isac-ao-1"); > else if ("pmbm".equals(testLevel)) > user.load("isac-pm-1"); > else > { > System.err.println("Error in IsacTestStartAction: > testLevel > not recognized"); > return ( mapping.findForward("error") ); > } > } > catch (LDAPException e) > { > e.printStackTrace(); > errors.add(ActionErrors.GLOBAL_ERROR, > new ActionError("error.exception.ldap")); > saveErrors(request, errors); > return(mapping.findForward("error")); > } > > request.getSession().setAttribute("user", user); > > String test = request.getParameter("test"); > if ("AddToCartAction".equals(test)) > { > System.err.println("ISAC Test Message: Testing > AddToCartAction"); > try > { > Class.forName("y21.isac.struts.action.AddToCartAction", > true, request.getClass().getClassLoader()); > System.err.println("ISAC Test Message: AddToCartAction > Found"); > } > catch (Exception ex) > { > ex.printStackTrace(); > System.err.println("ISAC Test Message: > AddToCartAction NOT > Found"); > } > > return mapping.findForward("AddToCartAction"); > } > > System.err.println("ISAC Test Message: Testing WelcomeAction"); > return ( mapping.findForward("success") ); > } > } > > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>