Tutorial: Creating Struts application in Eclipse

Note: If you looking for tutorial “Create Struts2 Application in EclipseClick here.
In this tutorial we will create a hello world Struts application in Eclipse editor. First let us see what are the tools required to create our hello world Struts application.

  1. JDK 1.5 above (download)
  2. Tomcat 5.x above or any other container (Glassfish, JBoss, Websphere, Weblogic etc) (download)
  3. Eclipse 3.2.x above (download)
  4. Apache Struts JAR files:(download). Following are the list of JAR files required for this application.
    • struts.jar
    • common-logging.jar
    • common-beanutils.jar
    • common-collections.jar
    • common-digester.jar

We will implement a web application using Struts framework which will have a login screen. Once the user is authenticated, (s)he will be redirected to a welcome page.

Let us start with our first struts based web application.

Open Eclipse and goto File -> New -> Project and select Dynamic Web Project in the New Project wizard screen.

After selecting Dynamic Web Project, press Next.

Write the name of the project. For example StrutsHelloWorld. Once this is done, select the target runtime environment (e.g. Apache Tomcat v6.0). This is to run the project inside Eclipse environment. After this press Finish.

Once the project is created, you can see its structure in Project Explorer.

Now copy all the required JAR files in WebContent -> WEB-INF -> lib folder. Create this folder if it does not exists.

Next step is to create a servlet entry in web.xml which points to org.apache.struts.action.ActionServlet class of struts framework. Open web.xml file which is there under WEB-INF folder and copy paste following code.

<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>
		<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
	<servlet-name>action</servlet-name>
	<url-pattern>*.do</url-pattern>
</servlet-mapping>

Here we have mapped url *.do with the ActionServlet, hence all the requests from *.do url will be routed to ActionServlet; which will handle the flow of Struts after that.

We will create package strutcures for your project source. Here we will create two packages, one for Action classes (net.viralpatel.struts.helloworld.action) and other for Form  beans(net.viralpatel.struts.helloworld.action).

Also create a class LoginForm in net.viralpatel.struts.helloworld.action with following content.

package net.viralpatel.struts.helloworld.form;

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

public class LoginForm extends ActionForm {

	private String userName;
	private String password;

	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {

		ActionErrors actionErrors = new ActionErrors();

		if(userName == null || userName.trim().equals("")) {
			actionErrors.add("userName", new ActionMessage("error.username"));
		}
		try {
		if(password == null || password.trim().equals("")) {
			actionErrors.add("password", new ActionMessage("error.password"));
		}
		}catch(Exception e) {
			e.printStackTrace();
		}
		return actionErrors ;
	}

	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
}

LoginForm is a bean class which extends ActionForm class of struts framework. This class will have the string properties like userName and password and their getter and setter methods. This class will act as a bean and will help in carrying values too and fro from JSP to Action class.
Let us create an Action class that will handle the request and will process the authentication. Create a class named LoginAction in net.viralpatel.struts.helloworld.action package. Copy paste following code in LoginAction class.

package net.viralpatel.struts.helloworld.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.viralpatel.struts.helloworld.form.LoginForm;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class LoginAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		String target = null;
		LoginForm loginForm = (LoginForm)form; 

		if(loginForm.getUserName().equals("admin")
				&& loginForm.getPassword().equals("admin123")) {
			target = "success";
			request.setAttribute("message", loginForm.getPassword());
		}
		else {
			target = "failure";
		}

		return mapping.findForward(target);
	}
}

In action class, we have a method called execute() which will be called by struts framework when this action will gets called. The parameter passed to this method are ActionMapping, ActionForm, HttpServletRequest and HttpServletResponse. In execute() method we check if username equals admin and password is equal to admin123, user will be redirected to Welcome page. If username and password are not proper, then user will be redirected to login page again.

We will use the internationalization (i18n) support of struts to display text on our pages. Hence we will create a MessagesResources properties file which will contain all our text data. Create a folder resource under src (Right click on src and select New -> Source Folder). Now create a text file called MessageResource.properties under resources folder.

Copy the following content in your Upadate:struts-config.xml MessageResource.properties file.

label.username = Login Detail
label.password = Password
label.welcome = Welcome

error.username =Username is not entered.

Create two JSP files, index.jsp and welcome.jsp with the following content in your WebContent folder.

index.jsp

<%@taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Login page | Hello World Struts application in Eclipse</title>
	</head>
	<body>
	<h1>Login</h1>
	<html:form action="login">
		 <bean:message key="label.username" />
		 <html:text property="userName"></html:text>
		 <html:errors property="userName" />
		 <br/>
		 <bean:message key="label.password"/>
		<html:password property="password"></html:password>
		 <html:errors property="password"/>
		<html:submit/>
		<html:reset/>
	</html:form>
	</body>
</html>

welcome.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Welcome page | Hello World Struts application in Eclipse</title>
	</head>
	<body>
	<%
		String message = (String)request.getAttribute("message");
	%>
		<h1>Welcome <%= message %></h1>

	</body>
</html>

Now create a file called struts-config.xml in WEB-INF folder. Also note that in web.xml file we have passed an argument with name config to ActionServlet class with value /WEB-INF/struts-config.xml.

Following will be the content of struts-config.xml file:

<?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">

<struts-config>
	<form-beans>
		<form-bean name="LoginForm"
			type="net.viralpatel.struts.helloworld.form.LoginForm" />
	</form-beans>

	<global-exceptions>
	</global-exceptions>
	<global-forwards></global-forwards>

	<action-mappings>
		<action path="/login" name="LoginForm" validate="true" input="/index.jsp"
			type="net.viralpatel.struts.helloworld.action.LoginAction">
			<forward name="success" path="/welcome.jsp" />
			<forward name="failure" path="/index.jsp" />
		</action>
	</action-mappings>

	<message-resources parameter="resource.MessageResource"></message-resources>

</struts-config>


And, that’s it :) .. We are done with our application and now its turn to run it. I hope you have already configured Tomcat in eclipse. If not then:

Open Server view from Windows -> Show View -> Server. Right click in this view and select New -> Server and add your server details.
To run the project, right click on Project name from Project Explorer and select Run as -> Run on Server (Shortcut: Alt+Shift+X, R)

Login Page

Welcome Page

Related: Create Struts 2 Application in Eclipse



213 Comments

  • Sabar wrote on 20 July, 2011, 22:30

    Hi Viral,

    Thanks for the tutorial. I am getting the below error:

    org.apache.jasper.JasperException: The absolute uri: http://jakarta.apache.org/struts/tags-html cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)

    Please help me..

    • Viral Patel wrote on 20 July, 2011, 23:52

      @Sabar: Please check the Struts jar file version you using in your project. It seems the taglib is not correct and giving error. Check the jar version.

  • naqi wrote on 25 July, 2011, 17:44

    Hi

    Can give the exact download link for the Apache Struts JAR files:
    struts.jar
    common-logging.jar
    common-beanutils.jar
    common-collections.jar
    common-digester.jar

    As the problem i face, whenever i click on the download hyperlink, so it redirects to a page where i am unable to understand that where i may find these mentioned JAR files. Can you please help me sort this problem. I am sorry as i am total new to using eclipse with struts..

  • jaison joseph wrote on 29 August, 2011, 21:18

    thank you

  • hari wrote on 7 September, 2011, 0:28

    Hi naqi,please find the jars in docjar.com

  • sweety wrote on 15 September, 2011, 6:45

    can you provide me an example where i can display the data in a drop down list from the database using struts framework,that is nothing but making drop down list configurable or dyanmic

  • sveinne wrote on 16 September, 2011, 22:37

    Hi Im trying to get the tutorial to work
    I follow it at all sems well until running the project through tomcat within Eclipse
    The the following error occurs:

    Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

    The message appears wheither or not the Tomcat server is up or down outside of eclipse
    regards
    S

  • Eric wrote on 3 October, 2011, 13:56

    thx a lot for this application, it run correctly in my machine.congratulations

  • Arun N wrote on 7 October, 2011, 18:54

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Missing message for key “label.username”
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    root cause

    javax.servlet.jsp.JspException: Missing message for key “label.username”
    org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:235)
    org.apache.jsp.index_jsp._jspx_meth_bean_message_0(index_jsp.java:165)
    org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:112)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:81)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

    • Viral Patel wrote on 8 October, 2011, 8:46

      @Arun – The messageresource.properties file seems to be not loaded. Check if the “resource” folder is added as source folder. Right click on project -> Properties -> Java Build Path -> Under source folder and path, Add Folder..

  • Arun N wrote on 7 October, 2011, 18:55

    I used the jdk 1.5 and tomcat 5, Please guide me over this issue.

    thanks in advance

  • John wrote on 11 October, 2011, 20:23

    Hey,
    First off, thank you for making this tutorial.

    Second I am having an error once I run the project. I know I copied all the code exactly into eclipse and have all the folders set up the same way but I don’t understand why I’m getting an error.

    The error is below, has anyone gotten this error or know how to fix it?

    javax.servlet.jsp.JspException: Missing message for key “label.username”
    at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:297)
    at org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.java:167)
    at org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:111)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:80)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Unknown Source)

    • Vidi wrote on 26 October, 2011, 11:48

      Actually you can also check if you have clearly wiiten the param name for loading your ressource file MessageResource in your struts config or could be your resource file name does not match the one in your struts config..:-)

  • MAnoj wrote on 26 October, 2011, 1:18

    Hi,
    Good example.. I am able to run it successfully. Except I have to go in deep with more concentration in understanding the communication between various classes and config files.
    :)

    Thanks

  • Arun wrote on 1 November, 2011, 21:48

    I also received the same error “javax.servlet.jsp.JspException: Missing message for key “label.username””.
    Adding the resource folder in to the java build path didnt resolve the error.

    This is how I resolved the error.
    I moved the ‘MessageResource.properties’ into src\resource folder and everything is working fine.

    Thanks for making this tutorial

    • Deepika wrote on 2 December, 2011, 13:22

      @Arun: How did you move resource folder under src folder..i’m not able to do it..plz help

    • Raj wrote on 28 December, 2011, 0:24

      Please make sure that the “resource” folder is created under “src” directory. Or you can create some other directory structure like package(net.struts.helloworld.resource) under “src” and put the resource file in there. That will resolve the issue.

      Also, change <message-resources parameter=".MessageResources” /> in struts-config.xml

  • PenetiPalowan wrote on 4 November, 2011, 18:34

    This tutorial is awesome. . . For the first time i have successfully run a struts application.
    Many thanks ! ! ! !
    VIRAL U ROCKzzzzzzz

  • Kaushik Pradeep wrote on 16 November, 2011, 10:56

    I was finding it very hard to get a good tutorial on Struts.But this one is awesome.Initially I also got the label.username problem but as told by arun it eventually went when i moved resource folder inside src.Thank you Viral and Arun… :)

  • Pradeep wrote on 21 November, 2011, 16:29

    Good tutorial!!!!

  • star12 wrote on 28 November, 2011, 10:51

    Hi,

    When I run it, im getting this exception. Can someone plz guide how to proceed. I have checked my struts.jar.. I see the classes Actionmappings and actionformbeans. Not sure why im still getting this.

    exception

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

    root cause

    javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
    root cause

    javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:747)

    • jg001 wrote on 6 December, 2011, 13:31

      Were u able to solve the exception u got. ‘Cannot find ActionMappings or ActionFormBeans collection’. I’ve also come across the same exception

  • Deepika wrote on 2 December, 2011, 13:19

    Hi Viral,

    I’m getting the same problem : (javax.servlet.ServletException: Missing message for key “label.username”).
    I tried moving resource folder under src folder…but unable to move it.
    Please help how can i move it under src folder.

    • Viral Patel wrote on 2 December, 2011, 15:40

      Hi Deepika,
      To add resources folder as src folder, In Eclipse right click on project > Properties > Java Build Path > Source > Add Folder… and select your resources folder.

  • pankaj wrote on 9 December, 2011, 12:04

    Hi virul i m getting some errors
    org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 12

    javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)

  • suresh wrote on 13 December, 2011, 23:29

    i want struts jar file free download site please tell me any one……………………………………
    help me please………….

  • guts wrote on 14 December, 2011, 12:41

    hi viral
    i have done exactly as you have mentioned in this tutorial
    but the problem i m facing is pasing exception of struts-config.xml file
    here is the full trace of errors:
    SEVERE: Parsing error processing resource path /WEB-INF/struts-config.xml
    java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)

    this occurs when i start the apache tomcat
    and then when I execute index.jsp, following errors occur

    org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)

    Please help me in this issue
    Thanks an advance

  • hitz wrote on 16 December, 2011, 0:21

    hi, thanks for the code..but i m having some trouble getting it to work–>
    this is the error i got–> publishing to wasce2.1 failed

    Publishing failed
    java.lang.NoClassDefFoundError: Could not fully load class: org.apache.struts.taglib.html.JavascriptValidatorTag
    due to:org/apache/commons/validator/ValidatorResources
    in classLoader:
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    thsnks and regards
    hitz

  • Sunil wrote on 16 December, 2011, 10:39

    Hello
    Viral Patel
    Thanks for giving tutorilas,But
    1. check once again that in snap shot resource folde is not show under the src folder
    2. final screan shot also display wrong msg it show it will display Weclome admin but it will show welcome admin123 as we are setting password in request scope not user name

    Thanks once again

  • Lokesh wrote on 21 December, 2011, 11:54

    Excellent work Viral..Bt y only reply to girl

    • Viral Patel wrote on 21 December, 2011, 11:57

      @Lokesh – Thanks Mate
      I ain’t gender biased :D

  • Arun Shiva wrote on 21 December, 2011, 12:35

    Hi Viral,
    Thanks very much for tutorial and i hope it gets even better with a video tutorial on this. Good work Viral..!!
    I am getting “Connection reset” problem in struts-config.xml for the use of

    please help me

  • Pavithra wrote on 22 December, 2011, 18:16

    Hi i m getting some errors
    org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 11
    javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)

  • Surya wrote on 23 December, 2011, 15:18

    Thank you Based on you reference I successfully run the struts1 application. Thanks a lot.

  • Amit Kumar Ankush wrote on 26 December, 2011, 17:40

    Hello All,
    Greetings

    While i was try to execute this I got following Exception, Please help me out, How can resolve this?

    javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class com.amit.form: {1}
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:96)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717

  • Raj wrote on 28 December, 2011, 0:26

    Thanks a lot. This is a very good tutorial.

  • Bilawal wrote on 28 December, 2011, 17:23

    @Viral Getting this error

    HTTP Status 500 –

    ——————————————————————————–

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection

  • Tushar wrote on 6 January, 2012, 15:18

    Thanks lot after investing lot of time finally i execute struts program…Thanks lot again…

  • Tushar wrote on 6 January, 2012, 15:32

    Hi Viral,
    I changed username and password in loginForm still on welcome page its showing welcome admin123 and also taking only admin and admin123 as username and password if i did changes in loginForm….plz guide for same

  • Joseph wrote on 9 January, 2012, 17:07

    To resolve the missing message for key exception, copy the MessageResource properties file into the WEB-INF folder and in the struts-congig.xml file specify it as follows-
    .

  • sravan wrote on 11 January, 2012, 15:43

    I got this error, plz show the proper solution,

    11 Jan, 2012 3:38:38 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: No getter method for property UserName of bean org.apache.struts.taglib.html.BEAN
    at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:1031)

    • Viral Patel wrote on 11 January, 2012, 15:47

      @Sravan – Please check if you have used UserName instead of userName in JSP file.

  • Kaushik wrote on 11 January, 2012, 15:49

    How can i resolve this?
    org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    root cause

    javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)

    • Viral Patel wrote on 11 January, 2012, 16:03

      @Kaushik – Please check if you have added action-mappings for LoginForm in your struts-config.xml?

      • Kaushik wrote on 11 January, 2012, 16:08

        Yes Viral, its added…

        ………………………..

  • sneha wrote on 12 January, 2012, 15:36

    Hi Viral,
    Even i m facing the same problem javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection…I hv followed everything still I m unable to resolve… I am using RAD tool

    Thanks in advance

  • krishna wrote on 18 January, 2012, 12:17

    guys, please help me…

    I m not able to run any struts application, even the “struts2-blank” application which comes with Struts2.zip is also not running.
    I have installed and uninstalled tomcat for 5 time.

    Any help will be appreciated.

  • shilkesha wrote on 24 January, 2012, 22:45

    Hi Viral,

    I m getting below error:
    org.apache.jasper.JasperException: /index.jsp (line: 2, column: 74) File “/WEB-INF/struts-html.tld” not found
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133)
    org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:166)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1425)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

    in web.xml following declaration are:

    http://jakarta.apache.org/struts/tags-html
    /WEB-INF/struts-html.tld

    http://jakarta.apache.org/struts/tags-bean
    /WEB-INF/struts-bean.tld

    taglib declaration in jsp are:

    Please help to solve the error.

  • srinu wrote on 25 January, 2012, 23:21

    pls any body help me…………..i have some problem what is it that i am creating login page..in that login 3 types of users there..when click the login button it is identify the which type of user entered in this site..how it is recoginised..pls send me the code and explain it../……..

  • Sekar wrote on 3 February, 2012, 3:09

    Nice Tutorial. Was able to successfully run the application.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Copyright © 2012 ViralPatel.net. All rights reserved.