Hello mahavir ,

http://jakarta.apache.org/struts/userGuide/configuration.html#resources_config



mahavir wrote:

Hi Friends
i am begineer to struts,i searched on the net to start studing struts.i got
following one document,according to which i had written program but i am
geetting the  error.The error is at the end
And the document that i got from the net is

Create a Directory Structure
The first step in creating any web application is creating the base
directory that stores all of your information. WeŽll call this base
directory hello-world. Inside the hello-world base directory, create a
WEB-INF directory in which to store application-level classes and
information. For more information on the structure of a web application, see
the Servlet specification.



Copy Necessary Files
The struts.jar file contains all necessary classes to run a Struts
application, including the ActionServlet class and the taglib classes. In a
normal binary distribution, the struts.jar file is located in the lib
subdirectory of the installation. Copy it to the hello-world/WEB-INF/lib
directory.
The struts-bean.tld file contains all necessary taglib information to
utilize the Struts message tag. In a binary distribution, the
struts-bean.tld file can also be found in the lib subdirectory. Copy this
file to your hello-world/WEB-INF directory.



Create the .properties File
A properties file is a file that contains a newline ("\n") separated list of
name-value pairs. In our hello world application, we need just one entry
called hello.message. Property resources are located using the classloader,
so make sure the properties file is in the CLASSPATH or that the servlet
container automatically places the files in the CLASSPATH of the
hello-word/WEB-INF/classes directory.
Create a file called HelloWorldResources.properties, and save it in
WEB-INF/classes/helloworld. This makes it accessible to the class identifier
helloworld.HelloWorldResources.
The following illustrates how one entry in the properties file should
appear:






hello.message=Hello Struts Developer





Create the web.xml File The web.xml file (deployment descriptor) describes your web application. After creating this file, place it in the WEB-INF folder of the application. A typical Struts web.xml file defines a servlet identifier for ActionServlet using the <servlet> tags. Beneath the servlet tag, use init-param to define the parameters that initialize the servlet. For this simple application, weŽll define the servlet and one init-param to define where our application resources are loaded. WeŽll also define a taglib reference for use within a JSP:




<web-app> <servlet> <servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

        <!--Below is the init-param-->
        <!--This defines where your application resources are located.-->
        <!--It uses the classloader to find the file.-->
        <!--The ".properties" extension isnŽt used to locate resources.-->

        <init-param>
             <param-name>application</param-name>
             <param-value>helloworld.HelloWorldResources</param-value>
        </init-param>
 <load-on-startup>1</load-on-startup>
   </servlet>

   <!--The following section defines a URI to use to retrieve the struts
taglib -->
   <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
   </taglib>

   <!--This section defines what file to open first if none is
specified -->
   <welcome-file-list>
        <welcome-file>hello.jsp</welcome-file>
   </welcome-file-list>
</web-app>




Create the Display Page The last step before actually running the application is to create the JSP display page. The display page is a normal JSP page that uses the Struts taglib and one Struts tag. The display page should reside in the root directory of your web application, in this case hello-world. WeŽll name it hello.jsp, and it should look like this:




<%@ page language="java" %> <!--Import the taglib --> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <!--Now use the tag to display the message --> <bean:message key="hello.message" />




error


Error: 500
Location: /hello-world/hello.jsp
Internal Servlet Error:

javax.servlet.ServletException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
at
_0002fhello_0002ejsphello_jsp_21._jspService(_0002fhello_0002ejsphello_jsp_2
1.java:100)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
va:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
at java.lang.Thread.run(Thread.java:479)

Root cause:
javax.servlet.jsp.JspException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
at
org.apache.struts.util.RequestUtils.retrieveMessageResources(RequestUtils.ja
va:1103)
at org.apache.struts.util.RequestUtils.message(RequestUtils.java:1043)
at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:294)
at
_0002fhello_0002ejsphello_jsp_21._jspService(_0002fhello_0002ejsphello_jsp_2
1.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
va:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
at java.lang.Thread.run(Thread.java:479)

Regards
mahavir


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to