Tutorial: Creating Struts application in Eclipse
- By Viral Patel on December 4, 2008
- Featured, How-To, Struts, Tutorial
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.











Thanks Viral,
The explanation and information is very apt.
Very useful.
Informative post.
Here’s a similar tutorial, but for the latest version of struts 2 – Create Struts 2 – Hello World Application
If you’re (still) doing Struts, you should check out Oracle Workshop for WebLogic. It is the best Struts tool by far, includes many examples and can do much much more than Eclipse WTP. It is not WebLogic specific. And, it’s free.
Check out my post about it:
http://blog.zvikico.com/2008/08/the-best-jspstrutsjsf-development-tool-is-now-free.html
@Veera : Nice to see your Struts-2 tutorial. You will see more tutorials on similar line here on viralpatel.net
@Zviki : Thanks for your comment. Will definitely check Oracle Workshop for WebLogic.
Nice tutorial, good job :)
@Zviki I suggest having a look at IntelliJ IDEA’s support for Struts 2, in my opinion it is one of the best. It’s not free, though.
hi did anyone try this with WASCE server? iam doing in it and evrything looks fine except that when i clikc on submit it says that the resource/login is not found..
any ideas pls help
I am getting this exception while deploying this …. Can anyone help?
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: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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:803)
root cause
javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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:803)
root cause
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:107)
org.apache.jsp.index_jsp._jspService(index_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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:803)
its very useful for beginners
i am getting this exception ..
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: An exception occurred processing JSP page /index.jsp at line 12
9:
10: Login
11:
12:
13:
14:
15:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
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)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Missing message for key “label.username”
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
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:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
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)
root cause
javax.servlet.jsp.JspException: 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:174)
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:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
many thanks
mayank
Copy the following content in your struts-config.xml file.
label.username = Login Detail
label.password = Password
label.welcome = Welcome
error.username =Username is not entered.
did u mean that paste the above content in MessageResource.properties file? or struts-config.xml file?
Thanks Vivek,
I have updated the error in post.
You need to copy this in MessageResource.properties file.
Thanks again.
Hi
I am getting following error please help…
SEVERE: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:712)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:500)
at org.apache.jsp.index_jsp._jspx_meth_html_form_0(org.apache.jsp.index_jsp:132)
at org.apache.jsp.index_jsp._jspx_meth_html_html_0(org.apache.jsp.index_jsp:108)
at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Hi,
I am getting Error 404–Not Found From RFC 2068 Hypertext Transfer Protocol — HTTP/1.1:
10.4.5 404 Not Found . I have double checked web.xml and struts-config.xml. I would appreicate, if anyone can help me.
You should have take the time to make this tutorial with the latest version of struts 1 : v1.3.10
The version 1.2, on which is based this tutorial, has been released for more than 4 years ! The branch 1.3 which split struts.jar into multiple modules has been release in two years !
Excellent Material for the Beginners.
Follow the steps carefully, it should definitely work.
Thanks
Sample
Hi,
There is anice tutorial on how to use Struts2, a basic example at
http://www.interview-questions-tips-forum.net/index.php/Apache-Struts/Struts2-example-tutorial/My-First-example-using-Apache-Struts2
hai,,this ,,gr8,,,,help to intoduce the struts application
I m not able to find jar files u mentioned above.Can u provide me the exact path..
Greetings!
I found your post very educating. This is the first sample struts application I created using eclipse.
However, I kept getting the error saying the message was not found in the key bundle.
I tried many things but I got the same error. Finally I modified the entry in the struts-config.xml to
from what you mentioned. It did the trick.
I’m using struts 1.3, jdk 6 and eclipse ganymede.. hope that helps.
Hello There,
I am fairly new to Struts, I was wondering if anyone can post or preferably mail me some materila about how to handle database connectivity in Struts. I am working on JNDI but I guess this won\\\’t be helpful if I have a shared apache tomcat server as that won\\\’t let me access the server.xml file.
my id is baran.khan @ gmail.com
I am preety new to struts. I want to know how to remove the error Missing message for key \"label.username\"? I have created a package name resource in src and created a file in it with the name MessageResource.properties. What changes i need to make in my struts-config.xml?
Hi Payal,
I am not sure if I got your problem. What I understand is that you want to remove the error messages generated from keys that are missing in your bundle MessageResource file. If this is the case then you can use null attribute in <message-resources> tag in struts-config.xml file.
null attribute will control the messages, If true, references to non existing messages results in null and If false, references to non existing messages result in warning message like
???KeyName???
Hope this will solve your query.
Hey thanks for this great tut!!
But, I was having the same error “Missing message for key “label.username” and I moved the file MessageResource to the folder WEB-INF->classes->resource. That did the trick.
Can you explain why tis happened? Thanks again mate!
While providing the parameter attribute in <message-resource> tag we provide it as parameter=”resource.MessageResource”. Thus in this case, struts expects the MessageResource.properties file under resource folder. But if you have provided parameter=”MessageResource” then that means your MessageResource properties file is directly under classes folder.
Could anyone help me to solve the following error? I have checked the struts-config and web.xml . But I cannot find the error.please…
,Grace
The server encountered an internal error () that prevented it from fulfilling this request.
javax.servlet.ServletException: Exception creating bean of class net.viralpatel.struts.helloworld.form.LoginForm: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
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)
javax.servlet.jsp.JspException: Exception creating bean of class net.viralpatel.struts.helloworld.form.LoginForm: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:563)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:107)
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)
Hi..
To make this tutorial work:
1. also add servlet-api.jar.
2. make sure struts-config.xml is in web-inf folder or the folder u have specified in web.xml
3. make sure the messageresource file is in web-inf/classes folder.
4. Change the following line in LoginAction.java from
request.setAttribute(\"message\", loginForm.getPassword());
To
request.setAttribute(\"message\", loginForm.getUserName());
Kiran
I have done everything as told here.I am using SDE 3.1 and I am getting this exception on runing the application.Can anyone help?
SEVERE: Servlet.service() for servlet jsp threw 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
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114)
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:147)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
at org.apache.jasper.compiler.Parser.parse(Parser.java:126)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
help me,
I am beginner programmer, I got exception in ur tutorial as this
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: Exception in JSP: /index.jsp:13
10: <body>
11: <h1>Login</h1>
12: <html:form action=\"login\">
13: <bean:message key=\"label.username\" />
14: <html:text property=\"userName\"></html:text>
15: <html:errors property=\"userName\"/>
16: <br/>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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)
root cause
javax.servlet.ServletException: Missing message for key \"label.username\"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.index_jsp._jspService(index_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
root cause
javax.servlet.jsp.JspException: 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:166)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:110)
org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.
——————————————————————————–
Apache Tomcat/5.5.27
please help me
I already copy
label.username = Login Detail
label.password = Password
label.welcome = Welcome
error.username =Username is not entered.
to the resource folder, but the exception still occured….
please help me
hey, thanks very much..
finally I can solve it…
@sarwo edi: nice to see that your problem got solved :) by the way. where was the problem exactly? I guess your properties file was not getting referred properly?
yeah, in struts-config, I only type <message-resources parameter=\"MessageResource\" null=\"true\"/>, it make its true…
btw, any another eclipse tutorial?
I want to be a good java programmer as you do..
txh
<message-resources parameter=\"resource.MessageResource\"></message-resources>
should be
<message-resources parameter=\"MessageResource\"></message-resources>
Muchas gracias!!! a Viral por el tutorial y también a Davinchi porque dió la solución al mismo problema que tenía yo!!!!
Davinchi wrote on 19 March, 2009, 11:31
Hey thanks for this great tut!!
But, I was having the same error “Missing message for key “label.username” and I moved the file MessageResource to the folder WEB-INF->classes->resource. That did the trick.
Can you explain why tis happened? Thanks again mate!
I have followed ur tutorial
i am getting error
VERE: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:115)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:818)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Jun 5, 2009 10:43:41 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:115)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:818)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
can you tell me what can be cause of this.
Hi~
I have modified the line
<message-resources parameter=\\\"resource.MessageResource\\\"></message-resources>
to
<message-resources parameter=\\\"MessageResource\\\"></message-resources>
And I have followed all the instructions, I am now using Struts 1.3.10, but I got \"HTTP Status 404\" error,
\"The requested resource (/StrutsHelloWorld/) is not available.\"
Anyone may help? Thx!
More description abt my problem,
In Eclipse I got the following URI underlined in red!
\\"<%@taglib uri=\\"http://jakarta.apache.org/struts/tags-html\\" prefix=\\"html\\"%>
<%@taglib uri=\\"http://jakarta.apache.org/struts/tags-bean\\" prefix=\\"bean\\" %> \\"
Eclipse says \\"cannot find tag library descriptor\\"
How should I modify the \\"uri\\"? Thx so much!
Can any one help me…..
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception creating bean of class com.jamesholmes.minihr.SearchForm under form name searchForm
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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)
root cause
javax.servlet.ServletException: Exception creating bean of class com.jamesholmes.minihr.SearchForm under form name searchForm
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.search_jsp._jspService(search_jsp.java:230)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
root cause
javax.servlet.jsp.JspException: Exception creating bean of class com.jamesholmes.minihr.SearchForm under form name searchForm
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:536)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:503)
org.apache.jsp.search_jsp._jspx_meth_html_005fform_005f0(search_jsp.java:263)
org.apache.jsp.search_jsp._jspService(search_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.
can anyone help, i got the following exception while executing
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Module ‘null’ not found.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
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)
root cause
java.lang.NullPointerException: Module ‘null’ not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:743)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:723)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:742)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:417)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:105)
org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
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)
Can you help on this error, it’s related to the tag libs which I’m still struggling to understand. the URI cannot be resolved.
Also eclipse shows warning “unknown tags” for entire index.jsp page
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
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.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:315)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:429)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1439)
org.apache.jasper.compiler.Parser.parse(Parser.java:137)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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)
Hi.
To make this tutorial work then follow these steps:
1. also inlcude servlet-api.jar in lib folder.
2. make sure struts-config.xml is in web-inf folder or the folder u have specified in web.xml
3. make sure the MessageResource.properties file is in web-inf/classes/resource folder.
4. Change the following line in LoginAction.java from
request.setAttribute("message", loginForm.getPassword());
To
request.setAttribute("message", loginForm.getUserName());
Change the following line in struts-config.xml
from
<message-resources parameter="resource.MessageResource"></message-resources>
To
<message-resources parameter="resource.MessageResource" null="true"></message-resources>
i have make these changes and example working successfully.
Hello EveryBody ,
i tried to follow this tutorial but in My index.jsp my taglibs (bean and html) are unknown :(.
could you help?
thanx
Hi Salma,
The error you are getting is due to the difference in the struts jar file. Check which version of jar you using and add the appropriate taglib paths in your jsp. For example try following URIs in the path of taglib.
http://struts.apache.org/tags-html
http://struts.apache.org/tags-bean
Hi Viral,
I need help ,Regarding Connection with Struts-1.3.8 with MySql i am stuck to compile my struts test application .in Struts-Config.xml tag not recognized. when i put block of code like exactly this
A red circle is appear in eclipe id.
Can you tell me what config. need
antlr-2.7.2.jar,commons-beanutils-1.7.0.jar,commons-chain-1.1.jar,commons-dbcp-1.2.2.jar
commons-digester-1.8.jar,commons-logging-1.0.4.jar,commons-pool-1.4.jar,commons-resources.jar,commons-validator-1.3.1.jar,jdbc2_0-stdext.jar,mysql-connector-java-5.0.8-bin.jar,oro-2.0.8.jar,servlet-api.jar,struts-core-1.3.8.jar,struts-taglib-1.3.8.jar,struts-tiles-1.3.8.jar,tools.jar in my lib folder.
Gracias por el manual muy bueno
Encontre la solucion al problema:
1. create packge: net.viralpatel.struts.helloworld.form.Util
2. dentro package poner el archivo MessageResource.properties
3. Change the following line in struts-config.xml
from
<message-resources parameter=\"resource.MessageResource\"></message-resources>
To
<message-resources parameter=\"net.viralpatel.struts.helloworld.form.Util.MessageResource\"></message-resources>
Hi All,
I’m getting the following error report. KINDLY HELP!!
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: java.lang.NullPointerException: Module ‘null’ not found.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
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)
root cause
java.lang.NullPointerException: Module ‘null’ not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:118)
org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.
——————————————————————————–
Apache Tomcat/6.0.20
hai viral
i am getting a struts 500 error please help me to decode this error
Hey Viral
Was a nice and short guide, very helpful
Thanks a lot !!!
Hi Virpal,
Am getting a diffrent kind of error :Several ports (8005, 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).
I have stopped all the services and only one port num is using at a time..
Can you please help me in this regard.
Hi I do all the same procedure. I am using struts2.1.6. When I ran the application I successfully see the index.jsp page. But when I enter admin as username and admin123 as password I got error.
HTTP Status 404 – /StrutsHelloWorld/Welcome.jsp
——————————————————————————–
type Status report
message /StrutsHelloWorld/Welcome.jsp
description The requested resource (/StrutsHelloWorld/Welcome.jsp) is not available.
——————————————————————————–
Apache Tomcat/6.0.20
Please help me.
Hi All
HTTP Status 404 – /StrutsHelloWorld/Welcome.jsp has been resolved.
In the struts.config file please change this line
to
We have made welcome.jsp instead of Welcome.jsp.
Thanks
Viral for the nice basic application.
Hi, I did this tutorial with:
- Eclipse Galileo
- struts-2.1.6
- Tomcat 6.0
and I getting a error in index.jsp in tablib declarations
Error:
Can not find tag library descriptor for “http:://jakarta.apache.org/struts/tags-html”
Please help me
Struts 2 is very different from Struts 1. You must use a version of Struts 1.2.x for the tutorial to work (no, 1.3.x won’t work either). Also, make sure you change Welcome.jsp to welcome.jsp in strut-config.xml once you get it working with Struts 1.2.x or else you’ll get a 404 error.
Thank you very much, your way of approach is very good, i didn’t find anywhere like this.
The given screen are very useful. Since 15days i am searching this type of tutorial. Luckly today I find this and executed successfuly.
Very helpful!!!
i have the same problem with Venkat.
How can i solve this? Help us please
Hi Sue, It may be possible that an instance of Tomcat is already running when you are trying to run it from Eclipse. Try to change few port numbers in server.xml file and see if the problem gets resolved.
To know which ports to change see this article: Running multiple tomcat instances
Hİ Viral!
i examined your link,but at my machine only one tomcat is set now, fistly i used a different tomcat version,but i uninstalled it, what must i do about it? help please..thankss..
I have found the solution for below error ,
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:115)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
solution:Add commons-digester.jar to WEB-INF/ lib folder
Hello-
I got the following exception stack trace:
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: java.lang.NullPointerException: Module ‘null’ not found.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
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)
root cause
java.lang.NullPointerException: Module ‘null’ not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:113)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.
——————————————————————————–
Apache Tomcat/6.0.20
I have made the adjustment to the struts-config.xml file in WEB-INF:
Please Help.
Stephen
Hi,
Initially I encountered the same problem as many i.e my taglibs were not getting identified in the index.jsp file. I was using the struts2 jar files. I removed them and used the 1.2.7 version jar files and now the error message is different. It still gives a red-mark for the taglib uri in index.jsp but the error is like
exception
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:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Missing message for key “label.username”
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
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:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
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.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.java:174)
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:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
I am guessing all this has got to do with the taglib. The url u mentioned http://jakarta.apache.org/tags-html doesnot exist. Even when I use it on d browser, it says not found. Kindly help!!!
Hey,
I changed the path of the jar files and made it point to .tld files which solved the earlier problem. But, a new error has come.
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 12
9:
10: Login
11:
12:
13:
14:
15:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Missing message for key “label.username”
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
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:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
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.jsp.index_jsp._jspx_meth_bean_005fmessage_005f0(index_jsp.java:180)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:124)
org.apache.jsp.index_jsp._jspService(index_jsp.java:92)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
The bean:message thing is causing the error. I am lost here. Kindly help!
@Namrata, I can see the stacktrace is complaining about Missing message for key “label.username”. Can you check if your message properties file is included properly and it contains
label.usernamekey?Hello,
Pretty good article. I have followed it thru step by step but am getting the same error as Stephen Hathorne and Dev:
exception
org.apache.jasper.JasperException: java.lang.NullPointerException: Module ‘null’ not found.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
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)
root cause
java.lang.NullPointerException: Module ‘null’ not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:818)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:113)
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)
@Viral,
Will you help us out?
Thanks much,
TS
i have try this tutorial, but still found this exception
i’m using struts 2.1.8 and i’m newbie in struts
thank’s for your help…
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: Missing message for key “label.username”
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
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)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Missing message for key “label.username”
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)
root cause
javax.servlet.jsp.JspException: 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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
——————————————————————————–
Apache Tomcat/6.0.18
nice tutorial
but i am getting same error as amit
index.jsp is not available.
can any one give me a solution.
@deepti, @amit: There was a small error in struts-config.xml file. I have changed the Welcome.jsp to welcome.jsp. Thanks for pointing out the error.
I canot set up the envirnment.After starting the server i got the exception like below mentioned.
Dec 14, 2009 4:25:20 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:StrutsHelloWorld’ did not find a matching property.
Dec 14, 2009 4:25:20 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_07\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.5.0_07/bin/client;C:/Program Files/Java/jre1.5.0_07/bin;C:\Program Files\Java\jre1.5.0_07\bin;D:\oracle\product\10.1.0\db_1\bin;D:\oracle\product\10.1.0\db_1\jre\1.4.2\bin\client;C:\Program Files\Ant\apache-ant\bin;
Dec 14, 2009 4:25:20 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8090
Dec 14, 2009 4:25:20 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1371 ms
Dec 14, 2009 4:25:20 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 14, 2009 4:25:20 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Dec 14, 2009 4:25:21 PM org.apache.struts.util.PropertyMessageResources
INFO: Initializing, config=’org.apache.struts.util.LocalStrings’, returnNull=true
Dec 14, 2009 4:25:21 PM org.apache.struts.util.PropertyMessageResources
INFO: Initializing, config=’org.apache.struts.action.ActionResources’, returnNull=true
Dec 14, 2009 4:25:24 PM org.apache.struts.util.PropertyMessageResources
INFO: Initializing, config=’resource.MessageResource’, returnNull=true
Dec 14, 2009 4:25:24 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8090
Dec 14, 2009 4:25:25 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8010
Dec 14, 2009 4:25:25 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/96 config=null
Dec 14, 2009 4:25:25 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4734 ms
Plz help me to resolve this issue.Thanks
I am getting the error mentioned below.No class file is getting generated for the JSP.Please ressolve
org.apache.jasper.JasperException: Unable to compile class for JSP
No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
Excellent tutorial for total beginners like me. Thanks!
“Now this EXCEPTION is coming”
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
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.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:359)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:190)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:458)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:523)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
org.apache.jasper.compiler.Parser.parse(Parser.java:171)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:258)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:139)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
I changed the properties of struts-config as
even its not working:(
thanks !!Very good informative tutorial
hi
i found all ur articles very easy and simple to understand
its tooo good
thank u:-)
Hi,this tutorial is very helpul 4 me
Thanks
Hey
I am getting error o jsp pages for taglibs
I am tottally new to struts and am trying to learn . Is that url http://jakarta.apache.org/struts/tags-html valid? 404 not found is coming.
Can somebody please explain. I am stuck at this.
@Anna: Change taglib definitions to:
This work fine for me.
hi i have problem in index.jsp at line plz any help me..
at line here..
Solved this issue ‘Missing message for key “label.username”
in Struts-config.xml
use this one ”
instead of ”
@Bun: How did u solve the issue “Missing message for key “label.username”… If anyone else knows plz do let me know…
Thanks in advance…
i am computer engineering student.
I know about struts,but i can’t work in struts.
In my final sem. project i will use struts framework,
so, please ,give me link or tutorial & any thing related to struts in my mailid.
Thank you.
getting following 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:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
I am getting HTTP Status 500 –
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:747)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:106)
org.apache.jsp.index_jsp._jspService(index_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
somebody help me .
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.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:315)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:382)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:445)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1392)
org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.
PLEASE HELP. How to solve this problem?
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: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.index_jsp._jspService(index_jsp.java:203)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:747)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
org.apache.jsp.index_jsp._jspx_meth_c_form_0(index_jsp.java:220)
org.apache.jsp.index_jsp._jspService(index_jsp.java:159)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
please help me i am recieving this when i am using structs i cross checked structs.config file many times
In the LoginAction.java the statement should be as followed:
package net.vitalpatel.struts.helloworld.form;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.vitalpatel.struts.helloworld.action.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;
continued by the rest of the code.
I am getting the following error:
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 11
8:
9:
10: Login
11:
12:
13:
14:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
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)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class net.vitalpatel.struts.helloworld.form.LoginForm: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
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)
root cause
javax.servlet.jsp.JspException: Exception creating bean of class net.vitalpatel.struts.helloworld.form.LoginForm: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:487)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457)
org.apache.jsp.index_jsp._jspx_meth_html_005fform_005f0(index_jsp.java:113)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.
Hi! could u tell me hw can i validate values in the fields wid the database and if not matched appropriate error message must b displayed in conjunction wid the struts validation franework?
hai viral …
m new to struts m getting an error in the java code pls help me ..
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;
}
}
which lib file should i include … i tried a lot but not getting .. waiting for ur reply…
This is a wonderful sample. Thanks for the contribution.
Arun
Ok,
thanks for the tutorial, this was my first start in struts. I had to do some tweaks to get this tutorial running. I am using Ubuntu 10.04 and Eclipse 3.5.
1) Make sure that Ubuntu uses Suns Java Virtual Machine, more precisely sun-java6-jdk.
2) Maybe you have to set the environment variable JAVA_HOME. To achieve this, I modified the .bashrc-File on my machine.
3) I used Tomcat as my web-container, but not the Ubuntu-package! Grab Tomcat from the apache website. The Ubuntu-package is splitted and Eclipse will get problems to find ‘conf’-directory.
4) There are some conflicts in this tutorial, go for description in code/images, if you are in doubt. For example you should place class ‘LoginForm’ in package ..helloworld.form not ..helloworld.action as it is stated one line above written code.
5) My application runs as I placed the ResourceMessage.properties-file directly in the src-Folder, so I did not create a special resource-Folder.
6) I went through all files to make sure, all paths are set up correctly. Especially, you have to adjust struts-config.xml if you modified some package-names or the directory of ResourceMessage.properties.
After those steps – all went fine for me. Good luck.
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: 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:315)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:383)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:446)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1393)
org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
This line is not recognized in my index.jsp
it gives a error..
i m using struts 1.3..
please help..
The article is really great for a beginner on struts.I am getting the below error . Please help
org.apache.jasper.JasperException: Missing message for key “label.username”
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
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:803)
hey the struts example given by you is very useful for basic understanding!!!Thanks!!
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.
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)