I want to create a struts 2 project in eclipse. I have downloaded the latest struts distribution. But things always become confusing when i try to create a struts project in ECLIPSE. Whenever I create a dynamic web project and add struts libraries to that project, some error or the other pops up.
How do I properly setup an eclipse Struts 2 project ?
To get a simple Hello world page, I did:
- created a dynamic web project (procollab)
- added struts 2 jars inside WEB-INF/lib
- added the same libraries inside project build path
- set the output folder for the src in WEB-INF/classes
- created a filter in web.xml to send all requests to org.apache.struts2.dispatcher.FilterDispatcher
- created a struts.xml in src
Errors I get:
Http 404. I get this for any URL, for example http://localhost:8080 or http://localhost:8080/procollab
I have added the project procollab in tomcat server list also in eclipse. but when I access any static resource directly, I get the page. I have the helloworld.jsp in webcontent folder, and when I go to http:localhost:8080/procollab/helloworld.jsp, I get the page correctly.
Have I set up my environment correctly ? Please help
my struts.xml file in WEB-INF/classes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<package name="default" namespace="/" extends="struts-default">
<action name="SayHello">
<result>/hello.jsp</result>
</action>
</package>
</struts>