aspose file tools*
The moose likes Struts and the fly likes  Struts2 Action problem Problem 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 " Struts2 Action problem Problem" Watch " Struts2 Action problem Problem" New topic
Author

Struts2 Action problem Problem

Asgar Ali
Greenhorn

Joined: Sep 01, 2008
Posts: 8
Hi,
I am some problem with my hello world struts2. I created a project in eclipse and I am trying to run this simple hello world example. I get this error. I am calling it by using this link in my index.jsp
<ul>
<li><a href="HelloWorld.action">Run Struts 2 Hello World Application</a></li>
</ul>
Error:
There is no Action mapped for namespace / and action name HelloWorld. - [unknown location]
at
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178
*************************************************************
my struts.xml code
<!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="default" extends="struts-default">

<action name="HelloWorld" class="com.alias.struts.Struts2HelloWorld">
<result>/Hello2World.jsp</result>
</action>


</package>
</struts>
web.xml
**************************************
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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>
Struts2Tutorial</display-name>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

Thanks
Asgar Ali
Greenhorn

Joined: Sep 01, 2008
Posts: 8
solved this problem by moving struts.xml into src folder....
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688

For your Struts2 application you have to put your Struts.xml file into your source package and put 5 jar file into lib.

With this zero configuration you can start your application with struts2 application.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts2 Action problem Problem