| Author |
Struts 2 migration issue
|
David Erin
Greenhorn
Joined: Dec 04, 2007
Posts: 10
|
|
Hi folks, I am trying to get a sample application in struts 2 to work with my existing application which is struts 1.2. Here are the steps: 1) downloaded the necessary jars and added in /Webroot/WEB-INF 2) modified my web.xml to include : <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> 3)Added struts.xml to WebRoot/WEB-INF/ <struts> <include file="struts-default.xml"/> <package name="bdr-emp2" namespace="/bdr-emp2"> <action name="test" class="com.bdr.emp.gruk.portals.actions.TestAction"> <result>http://localhost:8080/bdr-emp2/WEB-INF/jsp/test.jsp </result> </action> </package> </struts> The jsp is : <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title><s:text name="HelloWorld.message"/></title> </head> <body> <h2><s roperty value="message"/></h2> </body> </html> The jsp is located in WebRoot\WEB-INF\jsp\test.jsp The following error is thrown : There is no Action mapped for namespace / and action name test Can someone please advise what i am doing wrong? Many thanks
|
 |
David Erin
Greenhorn
Joined: Dec 04, 2007
Posts: 10
|
|
Can someone please provide any pointers as what i might be missing. Thanks in advance
|
 |
Eric Nielsen
Ranch Hand
Joined: Dec 14, 2004
Posts: 194
|
|
I think you're hitting the wrong URL to test... 1) What URL are you entering that generates this error? (I would guess its something like localhost ort/<context>/test[<.suffix>]) 2) However your "XWork Package" in the struts.xml file has configured a namespace, thus the the URL would have to be something more like localhost ort/<context>/bdr-emp2/test[/<.suffix>] This will cause it to look in the bdr-emp2 namespace instead of the default namespace.
|
 |
 |
|
|
subject: Struts 2 migration issue
|
|
|