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

Hello World with Struts2

Amey Ambulgekar
Ranch Hand

Joined: Nov 22, 2011
Posts: 36
Hello Java friends,

I am beginner to struts2 and yesterday i did a simple Hello World Program but I got an error .

Here is my program and my exceptions .

Struts.xml file ::

<?xml version="1.0" encoding="UTF-8" ?>
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"


<package name="default" extends="struts-default" namespace="/">
<action name="getTut" class="">
<result name="success">/success.jsp</result>
<result name="failure">/error.jsp</result>


here is my web.xml ::

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">




and here is my java class ::


public class TutAction {
public String execute(){
System.out.println("Hello.! from struts");
return "success";

and now what i did run an application and i appended at the end
http://localhost:8080/Struts2App/getTut.action //<--

but i got this error ::

HTTP Status 404 - There is no Action mapped for action name getTut.action/.
type Status report
message There is no Action mapped for action name getTut.action/.
description The requested resource (There is no Action mapped for action name getTut.action/.) is not available.
Apache Tomcat/6.0.35

is my method wrong or what happened and i have added following jar's ::


friends please help me out. I did program 4 times but still i got same error for that i install and uninstall tomcat6 5-6 times.! friends please help me.!

you can run my program and tell me is there any mistake i did or need to add something. i know problem arising only within either "struts.xml" or "web.xml" but where .?

Thanking you.!

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Post your project Structure.

install and uninstall tomcat6 5-6 times.
You are doing something wrong why you are screwing tomcat. :P

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Amey Ambulgekar
Ranch Hand

Joined: Nov 22, 2011
Posts: 36
Hello All,

i got the solution for this struts program i just changed jar files means i changed from ::

1]struts2-core-2.3.4.jar to struts2-core-2.0.11.jar <--
2]commons-fileupload-1.2.2.jar kept as it is
3]commons-io-2.0.1.jar kept as it is
4]commons-lang-2.4.jar kept as it is
5]commons-lang3-3.1.jar kept as it is
6]commons-logging-1.1.1.jar kept as it is
7]commons-logging-api-1.1.jar kept as it is
8]freemarker-2.3.19.jar kept as it is
9]javassist-3.11.0.GA.jar kept as it is
10]ognl-3.0.5.jar to ognl-2.6.11.jar <--
11]xwork-core-2.3.4.jar to xwork-2.0.4.jar <--

so it works i am very happy

but still i have one question --> when i download struts2.1.8 jars and use for application then it gives me error such as resource not found .!
why is it so..?

Thanking you all.!

I agree. Here's the link:
subject: Hello World with Struts2
It's not a secret anymore!