Hi I got the following exceptions when i am deploying the application using jboss4.2:
Iam using strts validation frame work for both client and serverside validations.But i am getting this errors.that to it is not supporting taglib directives when i am using those.
But i have copied all jar files web-inf and tab files in lib.
Please help me in this issues, i stucked with this since 3 days..
1.Cannot find ActionMappings or ActionFormBeans collection
2.javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
3.javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml
And my files are:
createProject.jsp:
=================
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<html:html>
<head>
<title>Hi</title>
</head>
<body>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr><td> </td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="left">
<img src ="images/logo.gif" width="200" height="74">
</div></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<html:form action="/createProjectAction" >
<table width="45%" border="0">
<tr>
<td>ProjectName:</td>
<td><html:text name="createProjectBean" property="ProjectName" /></td>
</tr>
<tr>
<td>Periodicity<!--<bean:message key="app.period" bundle="ApplicationResources"/>-->:</td>
<td><html:radio name="createProjectBean" property="Periodicity" value="Monthly"/>Monthly</td>
<td><html:radio name="createProjectBean" property="Periodicity" value="Quarterly"/>Quarterly</td>
<td><html:radio name="createProjectBean" property="Periodicity" value="Quarterly"/>Quarterly</td>
</tr>
<tr>
<td>Description<!--<bean:message key="app.desc" bundle="ApplicationResources" />-->:</td>
<td><html:text name="createProjectBean" property="Description" /></td>
</tr>
<tr>
<td><html:button property="submit" value="Submit" /></td>
</tr>
</table>
</html:form>
<!-- Begin Validator Javascript Function -->
<html:javascript formName="projectBean"/>
<!-- End of Validator Javascript Function -->
</body>
</html:html>
2.CreateProjectBean.java:
==========================
package actionClasses;
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 formBeans.CreateProjectBean;
public class CreateProjectAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request,
HttpServletResponse response)throws Exception
{
System.out.println("Entered in Action class");
String name,period,desc;
try{
CreateProjectBean bean=(CreateProjectBean)form;
period = bean.getperiodicity();
name = bean.getprojectName();
desc = bean.getdescription();
if(period.equals("")||name.equals("")||desc.equals(""))
{
return mapping.findForward("failure");
}
else
{
request.setAttribute("ProjectName",name);
request.setAttribute("Periodicity",period);
request.setAttribute("Description",desc);
}
}catch(Exception e)
{
System.out.println(e);
}
return mapping.findForward("success");
}
}
3.CreateProjectBean.java:
=========================
package formBeans;
import org.apache.struts.validator.ValidatorForm;
public class CreateProjectBean extends ValidatorForm
{
/**
*
*/
private static final long serialVersionUID = 1L;
String projectName;
String description;
String periodicity;
public String getprojectName() {
return projectName;
}
public void setprojectName(String projectName)
{
this.projectName = projectName;
}
public String getdescription()
{
return description;
}
public void setdescription(String description)
{
this.description = description;
}
public String getperiodicity()
{
return periodicity;
}
public void setperiodicity(String periodicity)
{
this.periodicity = periodicity;
}
}
4.struts-config.xml:
====================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD
Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<!--
This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.
Tiles and the Struts Validator are configured using the factory defaults
and are ready-to-use.
NOTE: If you have a generator tool to create the corresponding
Java classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with the
corresponding "name" and "type" attributes, as shown here.
-->
<struts-config>
<!-- ================================================ Form Bean Definitions
-->
<form-beans type="org.apache.struts.validator.ValidatorForm">
<form-bean name="createProjectBean"
type="formbeans.CreateProjectBean" />
</form-beans>
<!-- =========================================== Action Mapping Definitions
-->
<action-mappings>
<action path="/createProjectAction"
name="createProjectBean"
type="actionClasses.CreateProjectAction"
input="/jsps/createProject.jsp"
validate="true"
scope="request">
<forward name="success" path="/jsps/success.jsp" />
<forward name="failure" path="/jsps/failure.jsp" />
</action>
</action-mappings>
<!-- Entry for MessageResource.Properties -->
<!-- <message-resources parameter="resouceProperties.ApplicationResources" /> -->
<!-- Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>
</struts-config>
5.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>
<display-name>Struts Blank Application</display-name>
<!-- 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>applicationResources</param-name>
<param-value>ApplicationResources</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>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>jsps/createProject.jsp</welcome-file>
</welcome-file-list>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
</web-app>