Beruflich Dokumente
Kultur Dokumente
Java FAQ
Recent Topics
Register / Login
Author
This is my first application with struts 2 and have no experience with struts 1. I have Tomcat and downloaded struts 2. And I have a small app. Under Tomcat 'webapps' I created a new folder for the application (struts01). struts01 folder has 'WEB-INF' with sub-folder 'classes'. The jsp's are directly under struts01. web.xml is in WEB-INF and struts.xml is in WEB-INF/classes. I configured the actions and results in struts.xml and registered FilterDispatcher in web.xml. Next I start Tomcat and the browser and invoke an action "http://localhost/Struts01/some_action". But Tomcat says it cannot find the resource. (But I can directly access the jsp's from browser.) Looks like the requests are not going to the struts filterdispatcher. What should I do? Thanks!
SC JP
The struts2 filter processes the urls with the suffix you specify for it in the web.xml file. I'm not sure if you can set it up to run for urls with no suffix.
1/4
www.coderanch.com/t/420341/Struts/Install-configure-Struts
5/19/13
Posts: 349
The standard suffix for struts2 is .action. If your web.xml is set up to use .action then the url would be: http://localhost/Struts01/some_action.action Post to your web.xml if you want.
Nishan Patel Ranch Hand Joined: Sep 07, 2008 Posts: 676
I like...
Hi.. Please Make sure you have include six jar for basic Struts 2.0 Application. 1 ) struts2-core-2.1.2 2 ) xwork-2.1.1 3 ) freemarker-2.3.12 4 ) ognl-2.6.11 5 ) commons-collections-3.2 6 ) commons-logging-1.1 And also make sure your wex.xml file looks like <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts2CRUD</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>404</error-code> <location>/pagenotfound.jsp</location> </error-page> <error-page> <exception-type>java.lang.Exception</exception-type>
www.coderanch.com/t/420341/Struts/Install-configure-Struts
2/4
5/19/13
Tom, I did use .action extension for the request like http://localhost/Struts01/some_action.action though I did not specify that in my question. Nishan, the 6 jar files are in the struts folder I downloaded and extracted. Where should I include them? And my web.xml is similar to the one you put. By including the filterdispatcher we tell the container where the starting point for the requests is. But how will the container know where to look for struts files? (the path where I extracted struts files? Should I include it in the class path.) Thanks!
OK. It works. I included those files in lib folder of this particular application under tomcat. Thanks again guys!
hi Preeti, I have same problem as earlier you have. I want to know what did you do for solving this problem. I had a war file for deploying into tomcat server but when I want to run that project the Server says "resource file not found".
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
www.coderanch.com/t/420341/Struts/Install-configure-Struts
3/4
5/19/13
Similar Threads WAR file urgent Error in Eclipse Struts 2 Project struts 2 in eclipse Confusion Regarding where to put jsp in Web-application.
All times above are in your local time zone & format.T he current ranch time (not your local time) is May 19, 2013 04:37:34 .
www.coderanch.com/t/420341/Struts/Install-configure-Struts
4/4