wood burning stoves 2.0*
The moose likes Struts and the fly likes Problems with HelloWorld Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problems with HelloWorld Struts 2" Watch "Problems with HelloWorld Struts 2" New topic
Author

Problems with HelloWorld Struts 2

rahul khanna
Ranch Hand

Joined: Sep 14, 2005
Posts: 48
Hi All,

I am trying to develop a HelloWorld Struts 2 application but not have been able to .. I get the following stack..

There is no Action mapped for namespace / and action name Struts2HelloWorldAction. - [unknown location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)



Following are the files I am using ..
---------------------------------------------
web.xml
---------------------------------------------

<?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>Struts Blank</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>redirectToLogin.jsp</welcome-file>
</welcome-file-list>

</web-app>

---------------------------------------------
redirectToLogin.jsp
---------------------------------------------
<%
response.sendRedirect("Struts2HelloWorldAction.action");
%>

---------------------------------------------
helloworld.jsp
---------------------------------------------
HelloWorld



---------------------------------------------
struts.xml
---------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />



<package name="mypackage" namespace="/" extends="struts-default">
<action name="Struts2HelloWorldAction" class="com.myorg.myproject.user.action.Struts2HelloWorldAction">
<result>helloworld.jsp</result>
</action>
</package>

</struts>


I have literally gone mad on this ..

Any pointers would be useful.. obviously I am doing some stupid mistake .

I am using jDK1.5, Tomcat 5.5.23 and Struts 2.0.8.

Apologies for the lengthy post.

Thanks in advance.

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with HelloWorld Struts 2