File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts 2 migration issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 migration issue" Watch "Struts 2 migration issue" New topic

Struts 2 migration issue

David Erin

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 :

3)Added struts.xml to WebRoot/WEB-INF/

<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>

The jsp is :

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<title><s:text name="HelloWorld.message"/></title>

<h2><s roperty value="message"/></h2>


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

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.
I agree. Here's the link:
subject: Struts 2 migration issue
It's not a secret anymore!