Tutorial: Creating Struts application in Eclipse
- By Viral Patel on December 4, 2008
Note: If you looking for tutorial “Create Struts2 Application in Eclipse” Click 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.
- JDK 1.5 above (download)
- Tomcat 5.x above or any other container (Glassfish, JBoss, Websphere, Weblogic etc) (download)
- Eclipse 3.2.x above (download)
- 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)

Welcome Page

Related: Create Struts 2 Application in Eclipse
Get our Articles via Email. Enter your email address.








Hey!!
Thanks for the simple struts application …It was very useful …
It is working fine:)
hi dude! the article is really great for a beginner………..
i m having the following error
Missing message for key “label.username”
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:233)
org.apache.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.java:175)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:118)
org.apache.jsp.index_jsp._jspService(index_jsp.java:86)
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)
can u please help me to sort out this problem…………………..
hii,
Thank you very much it’s very useful to beginners…..
thanks for your article
but i thing shine Enterprise pattern in easyer than struts and more flexible and faster too.
refer:
http://sourceforge.net/projects/shine-enterpris/files/
Hey i m getting following error while deploying my application.
SEVERE: Servlet /TEST threw load() exception
javax.servlet.ServletException: Error instantiating servlet class org.apache.jasper.servlet.JspServlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1127)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4364)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Jul 10, 2010 11:55:43 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet jsp as unavailable
The jar files are there in lib dir and also the path is correct.
Hi Viral,
Thanks..Nice tutorial for Beginners!!!
After running the application.In the login page, I submit the page after entering the details.
No action is taking place after submit.
Please help me to solve.
Thanks!
Lingu
For the error Missing message for key “label.username” just give in struts config.xml instead of MessageResource.properties
that prob with “Missing message for key “label.username” ” .. there could be problem with Eclipse which doesn’t see folder resources … try to get file MessageResources.properties into some folder (package) INSIDE “src” folder. don’t forget to change the destination in the struts-config.xml. it worked for me.
Many thanks for ur comments… i got stuck for two day but now i got worked..
Thanks a lot….
Thank u very much ………it solved my problem…I Fought 3 days on this issue….Thanks again
Aug 26, 2010 2:20:55 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;C:\Program Files\Genuitec\Common\plugins
..
javax.servlet.jsp.JspException: Missing message for key “label.username”
at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:297)
hello thanks a lot for the tutorial
for me evety thin was nicely done but when i have run the application i got an error htttp 404
that told me the ressource HelloWordStruts is not available.
thanks in advance
problem was solved
but i han an error HTTP 500 (internal error )
can any one give me a clue
For those getting the Module ‘null’ not found exception. This is all you have to do.
Make sure the following jars are in the WEB-INF/lib directory.
commons-beanutils.jar
commons-chain.jar – this is the key jar file most people didn’t probably add
commons-digester.jar
commons-fileupload.jar
commons-io.jar
commons-logging.jar
jstl.jar
struts-core.jar
struts-taglib.jar
hello again
i starting to get some skills in struts and i want to say some words:
you forgoet to define error.password to Message.resource.properties.
and also i want to say that those messages doesn’t appear only if we remove validate=true from <action path /"login" in the Struts-config.xml file
thanks in advance
thank a lot. its working.
bt am gettin error msg “ActionMessage cannote be casted to ActionError” while leave any 1 of the field blank.
cany any1 help to find out this?
So who solve the the problem with
this work if i put file in build classes
1) The above code will work only if you change index.jsp taglib’s to
2) Crete a folder “tlds” under WEB-INF and put the files
struts-bean.tld and struts-html.tld. You can google to get the files!
hiiiiiiii viral its shows so many errors because og MassegeResource.properties
I GOT ERROR AS “CAN NOT FIND TAG LIBRARY DESCRIPTOR FOR http://jakarta.apache.org/struts/tags-html“…help me.,and i can’t run the application
the following 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)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:317)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:435)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:504)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1568)
org.apache.jasper.compiler.Parser.parse(Parser.java:132)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
First of all thank u so much viral as u provided such great tutorial ,It is really useful when someone start struts from beginning
It is working fine but in the index page
???en_GB.username??? then text box
???en_GB.password??? then password box is coming.
it is not retriving label.username and label.password value in the index page.
my code is given below
—————
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 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;
}
}
—————
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.getUserName());
}
else
{
target = “failure”;
}
return mapping.findForward(target);
}
}
—————
properties file
label.username = Login Detail
label.password = Password
label.welcome = Welcome
error.username =Username is not entered.
—————
index.jsp
Login page | Hello World Struts application in Eclipse
Login
—————–
welcome.jsp
Welcome page | Hello World Struts application in Eclipse
Welcome
———-
i have included properiies file into web-inf/classes folder
Can you please help out how to get properties value into index.jsp page
Thanks in advance
missing index nad welcome jsp files here its given below
index.jsp
Login page | Hello World Struts application in Eclipse
Login
———————–
welcome.jsp
Welcome page | Hello World Struts application in Eclipse
Welcome
IF YOU HAVE ERROR 500 >> JUST PUT ALL STRUTS JARS IN LIB
IF YOU HAVE ERROR 500 Missing message for key “label.username” >> CHANGE this
to
thanks viral thanks for your valuable information
i am unable to paste th content s into web.xml and struts.xml
i am doing save as option by copying it into another file
tell me
——————————————————————————–
i executed login page application i got an error like this
type Status report
message /StrutsHelloWorld/
description The requested resource (/StrutsHelloWorld/) is not available.
Thanks everybody for your help!
I’ve tried the above mentioned tutorial but I’m unable to execute it.
I’m using Struts 1.3, Eclipse 3.5.2, Tomcat 6.0, MySQL database. I got two issues those are mentioned below.
1) In index.jsp code page,
— Error message is “Can not find the tag library descriptor for “http://jakarta.apache.org/struts/tags-html”
2) When I try to execute the code, I got the error message “Several ports (8080, 8009) required by Tomcat v6.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).”
Please help me.
I’m totally beginner for this.
I don’t know how to resolve these issues.
Thanks in advance.
It is good for the beginners…..
Than you for Virapatel
Very effective and useful
Hi…
I am getting http://status 404.I think some resource is not there.can you tell the reason?
hi..
initially i got errors in eclipse saying “Can not find the tag library descriptor for “http://jakarta.apache.org/struts/tags-bean”"
there after i read the post and solved by entering correct tags which are
http://struts.apache.org/tags-html
http://struts.apache.org/tags-bean
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 14
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
root cause
java.lang.NullPointerException: Module ‘null’ not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
hi.
it is very nice ….
thanks for the all the above posts….
Hi I am getting the folowing error i have followed the toturial
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:500)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.index_jsp._jspService(index_jsp.java:102)
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:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Thanks Viral… This is Really Helpful
I am getting this error
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 11
8:
9: Login
14:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Missing message for key “label.username”
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.jsp.JspException: Missing message for key “label.username”
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:233)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.
——————————————————————————–
I tried all the above suggestions but they did not work.
Please help.
@Ria – Have you created the folder resource as a
resourcefolder in your source? This is very important as if you not make the resource folder as resource, at compile time eclipse will not put it into classpath. Also check by generating WAR file if theMessageResouce.propertiesfiles in under WEB-INF/classes.thanks for your suggestion
@ria just change this code in index.jsp
Login page | Hello World Struts application in Eclipse
Login
UserName
Password
Nice step by step tutorial. You configure this to Tomcat how about Jboss. I don’t have much experience with Jboss.
it shows error create Action class
how to connect MySql here for database application?
Thanks Viral. It works perfectly if you follow the instructions exactly as they are. There’s just one mistake. In the screen shot for placing the “MesseageResource.properties”, it looks like the folder “resource” is outside the “src” folder, whereas is should be inside.
Nice tutorial. But i m getting the following error in the jsp pages:
Can not find the tag library descriptor for “/struts-tags”
Update for:
Download tld file for your directory /WEB-INF/
Thank you for providing this application on net, it is very helpful for beginner.
Hi,
For all those who are hung up with HTTP 505/500 error here are few suggestions. I have tried running this sample in basic eclipse javaEE edition.(i.e one that does not support struts framework directly).
1) Check if your resource folder is properly placed (should be inside ‘src’ folder). I feel that following the author’s steps are better rather getting distracted. Wrong placement of this folder will be the probable reason behind 500 error.
2) I dont see any logic in this, but still, try avoiding blank spaces in between properties in the MessageResource file. (label.username=Login Detail). But surprisingly once the program works, reediting of this file to include spaces does not affect the output. If someone can clarify it.
3) If you are on eclipse then for every change try cleaning up your server and restarting the server before running the project. Especilally the version of eclipse that does not have struts capabilities, since you are responsible entirely for setting up proper configuration.
4) If its a 404 error then web.xml placement/contents are wrong.
Hope it helps.
hi,
thanx a lot, It was really helpful.I am pretty new to struts
but when i submit an incorrect username/password ,the index page is not dispalyed again..
please help
Hi how to perform easy loan distribution in hibernate and struts
Good example buddy.. but i want some more help i got the following error. Can u pls help me out.
exception
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.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
root cause
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:50)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Hi Viral,
Please help i am getting classcastexception……. please help me to solve this.
.
WARNING: Unhandled exception
java.lang.ClassCastException: net.viralpatel.struts.helloworld.action.LoginAction cannot be cast to org.apache.struts.action.Action
at org.apache.struts.chain.commands.servlet.CreateAction.createAction(CreateAction.java:98)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at java.lang.Thread.run(Unknown Source)
May 31, 2011 9:06:58 PM org.apache.struts.chain.commands.ExceptionCatcher postprocess
WARNING: Exception from exceptionCommand ‘servlet-exception’
java.lang.ClassCastException: net.viralpatel.struts.helloworld.action.LoginAction cannot be cast to org.apache.struts.action.Action
at org.apache.struts.chain.commands.servlet.CreateAction.createAction(CreateAction.java:98)
Hi Shreya, Can you check if your LoginAction is extending struts Action class? It seems that its not extending the Action and thus giving ClassCastException!
Hi Viral,
Thanks for giving such helpfull implementation process of Struts for us.I am facing below error
,
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Missing message for key “label.username”
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
I had tried to place properties file in every directory ,also tried to enter the tag in both web.xml and struts-config.xml,but still I am unable to resolve the issue.Please can you post the the solution ASAP.Thanks in advance.
thnx for the help…the message key missing really worked after i changed the resource folder and put the properties file into a package.
superb,,, really nice,,,,,
Hi,
there is no code for login.jsp. but in index.jsp action=”login” has used.
What should be in the login.jsp,..?
so many people looking for integration with struts and hibernate in ecllipse,if it is possible please update