Hello, All.

    I'm a new in the struts framework and i tried to make a little project using this 
framework, but when i try to use a actionbean, it says:

"org.apache.jasper.JasperException: Cannot find ActionMappings or ActionFormBeans 
collection ..."

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

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

<web-app>

<!-- Servlet used by application -->
<servlet>
  <servlet-name>Book</servlet-name>
  <servlet-class>teste.struts.Book</servlet-class>
</servlet>

<servlet>
  <servlet-name>BookAction</servlet-name>
  <servlet-class>teste.struts.BookAction</servlet-class>
</servlet>

<!-- Action Servlet Configuration -->
<servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
  <param-name>application</param-name>
  <param-value>org.apache.struts.webapp.example.ApplicationResources</param-value>
  </init-param>
  <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>
  <init-param>
  <param-name>validate</param-name>
  <param-value>true</param-value>
  </init-param>
  <load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>Book</servlet-name>
  <url-pattern>/Book</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>BookAction</servlet-name>
  <url-pattern>/BookAction</url-pattern>
</servlet-mapping>

<welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

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

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

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

</web-app>


The struts-config.xml
=======================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>

<struts-config>
 <form-beans>
   <form-bean name="bookForm" 
              type="teste.struts.Book"/>
 </form-beans>
 
 <global-forwards>
   <forward name="bookCreated" path="/BookView.jsp"/>
 </global-forwards>
 
 <action-mappings>
   <action path="/createBook">
     type="teste.struts.BookAction"
     name="bookForm"
     scope="request"
     input="/CreateBook.jsp">
   </action>
 </action-mappings>
 
</struts-config>


The BookView.jsp
=================
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html:html locale="true">
 <head>
   <html:base/>
   <title>Teste</title>
 </head>
 
 <body>
   <h2>BookView</h2>
   
   <html:form action="/createBook" method="GET">
     Title:<html:text property="title" /> <br/>
     <html:submit property="submit"/>
   </html:form>
 </body>
 
</html:html>


I don't know what is wrong, since this is a test from the faq of struts, which i 
modified to
learn. 

Thanks for help,

Jaime

Reply via email to