In order to have a request properly setup, you need to be going through the controller. To go through the controller, you need to be viewing an action instead of a JSP page. Try invoking an action that uses the template and see if the problem persists.

You can't expect Struts to set things up for a page it doesn't know you're requesting, and it can't know you're requesting the page unless you go through the controller :-)

Good Luck,

Eddie

----- Original Message ----- From: "uma.k" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Sunday, December 12, 2004 11:00 PM
Subject: RE: Cannot find ActionMappings or ActionFormBeans collection



Hi David,
That error is displayed while I am loading my Template.jsp itself.
http://localhost:8080/test/Template.jsp Not able to see the GUI itself.

Uma

-----Original Message-----
From: David G. Friedman [mailto:[EMAIL PROTECTED]
Sent: Monday, December 13, 2004 10:28 AM
To: Struts Users Mailing List
Subject: RE: Cannot find ActionMappings or ActionFormBeans collection


Is that error at start-up or when you are invoking an action by going to a Struts *.do action through a URL?

Regards,
David

-----Original Message-----
From: uma.k [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 11:54 PM
To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
Subject: RE: Cannot find ActionMappings or ActionFormBeans collection


Hi Sunny,
Thanks for the reply. The classpath is set right and my struts-config.xml
file looks the same way as you posted, I just removed the un necessary tags.
Any ideas now?


Uma

-----Original Message-----
From: Sunny [mailto:[EMAIL PROTECTED]
Sent: Monday, December 13, 2004 10:04 AM
To: Struts Users Mailing List
Subject: Re: Cannot find ActionMappings or ActionFormBeans collection


hi, Ensure that your are having your struts-config like the one below. And also please check your class path

regards,
Sunny


<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";> <struts-config> <form-beans> <form-bean name="articleForm" type="articles.ArticleForm"/> </form-beans>

 <action-mappings>
   <action
       path="/Article"
       type="articles.ArticleAction"
       name="articleForm"
       scope="request"
       validate="true"
       input="/Template.jsp">
     <forward name="success" path="/preview.jsp"/>
     <forward name="failure" path="/Template.jsp"/>
   </action>
 </action-mappings>

</struts-config>


uma.k wrote:

Hello,
I am new to Struts, my first application is giving me this error. I am
using
Tomcat 4.0
and struts 1.2.4. Where did I go wrong? Please help me.
javax.servlet.ServletException: Cannot find ActionMappings or
ActionFormBeans collection


Here are my files

-----Template.jsp

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<body>
<html:form action="/Article">


<table border="0" width="100%"> <tr> <td width="18%"><font size="2" face="Verdana">Keywords</font></td> <td width="32%"><input type="text" name="keywords" size="60"> </td> </tr> </table> <html:submit>Submit</html:submit>

</html:form>


---- web.xml <?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>

<web-app>

 <!-- Standard Action Servlet Configuration (with debugging) -->
 <servlet>
   <servlet-name>action</servlet-name>
   <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
   <init-param>
     <param-name>config</param-name>
     <param-value>/WEB-INF/struts-config.xml</param-value>
   </init-param>
   <init-param>
     <param-name>debug</param-name>
     <param-value>2</param-value>
   </init-param>
   <init-param>
     <param-name>detail</param-name>
     <param-value>2</param-value>
   </init-param>
   <load-on-startup>2</load-on-startup>
 </servlet>

 <!-- Standard Action Servlet Mapping -->
 <servlet-mapping>
   <servlet-name>action</servlet-name>
   <url-pattern>*.do</url-pattern>
 </servlet-mapping>

 <!-- Struts Tag Library Descriptors -->
 <taglib>
   <taglib-uri>/WEB-INF/struts-bean</taglib-uri>
   <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
 </taglib>

 <taglib>
   <taglib-uri>/WEB-INF/struts-html</taglib-uri>
   <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
 </taglib>

 <taglib>
   <taglib-uri>/WEB-INF/struts-logic</taglib-uri>
   <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
 </taglib>

 <taglib>
   <taglib-uri>/WEB-INF/struts-nested</taglib-uri>
   <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
 </taglib>

 <taglib>
   <taglib-uri>/WEB-INF/struts-tiles</taglib-uri>
   <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
 </taglib>

</web-app>



----struts-config.xml

<form-beans>
   <form-bean name="articleForm" type="articles.ArticleForm"/>
</form-beans>

<action-mappings>
   <action
   path="/Article"
   type="articles.ArticleAction"
   name="articleForm"
   scope="request"
   validate="true"
   input="/Template.jsp">
<forward name="success" path="/preview.jsp"/>
<forward name="failure" path="/Template.jsp"/>
</action>


</action-mappings>



--ArticleForm.java

package articles;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionErrors;

public class ArticleForm extends ActionForm
{
private String keywords = null;

public String getKeywords(){
return keywords;
}

public void setKeywords(String keywords){
this.keywords = keywords;
}

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request)
{
ActionErrors errors = new ActionErrors();
if( getKeywords() == null || getKeywords().length() < 1 )
{
      errors.add("keywords",new
ActionMessage("error.keywords.required"));
      }

     return errors;

}
}



--ArticleAction.java

package articles;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
//import articles.ArticleForm;

public class ArticleAction extends Action
{
private String keywords = null;

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException
{
String target = new String("success");

if(form != null)
{
// Use the ArticleForm to get the request parameters
ArticleForm articleForm = (ArticleForm)form;
keywords = articleForm.getTitle();
}

// if no title is supplied, set the target to failure
if ( keywords == null )
{
    target = new String("failure");
}
else
{
request.setAttribute("keywords", keywords);
}

return (mapping.findForward(target));
}

}


Thank you, Uma


--------------------------------------------------------------------- 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]


--------------------------------------------------------------------- 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]




--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0450-1, 12/09/2004 Tested on: 12/13/2004 12:23:36 AM avast! - copyright (c) 2000-2004 ALWIL Software. http://www.avast.com




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



Reply via email to