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

problem in Struts2 while running an application

Ishant Agarwal

Joined: Sep 09, 2011
Posts: 22
hi Guys!!!

I know struts 1.3 but new in struts2 so i am creating hello world application on struts2 using eclipse(Indigo) with apache tomcat 7

but get an error like

HTTP Status 404 - /struts2/


type Status report

message /struts2/

description The requested resource (/struts2/) is not available.


Apache Tomcat/7.0.14

this is my struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<package name="default" extends="struts-default" namespace="/">
<action name="HelloWorld" class="com.controller.HelloWorld">
<result name="SUCCESS">/success.jsp</result>

this is my Action Support class
package com.controller;

import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport{
String message ;
String userName ;
public String getUserName() {
return userName;
public void setUserName(String userName) {
this.userName = userName;
public String getMessage() {
return message;
public void setMessage(String message) {
this.message = message;
public String execute(){
setMessage("Hello " + getUserName()) ;
return "SUCCESS";

this is my web.xml

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

this is my index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<s:form action="HelloWorld">
<s:textfield name="userName" label="User Name:"></s:textfield>

this is my hierarchy

| | Java Resources
| | |src
| | | | com.controller
| | | | |
| | |resources
| | | | struts.xml
| | build
| | WebContent
| | |WEB_INF
| | | | lib
| | | | | web.xml
| | |index.jsp
| | |success.jsp

Pl help me out

Software Engineer
Franck Times

Joined: Sep 20, 2011
Posts: 9


if you take a look at Tomcat web application manager, can you see you application and does Tomcat says it's running ?

You'll find here some explanations on how to enable Tomcat Web App manager for tomcat 5.5, I guess it's pretty much the same for Tomcat 7

And please use BB code to display your codes, xml files, ... such as :
Ishant Agarwal

Joined: Sep 09, 2011
Posts: 22
thanks for your support but i am using an eclipse browser and still getting an same kind of error
Franck Times

Joined: Sep 20, 2011
Posts: 9

It's not a browser issue, rather a server issue. Your app is not found either because:
you did not properly deployed it on Tomcat
or your configuration (web.xml and/or struts.xml) is not valid.

Looking at the Tomcat web app manager would allow you to check if your app was deployed or not, ruling out one of the two possibilities.

Tomcat web app manager is a Tomcat feature which enables you to have a look on what's running on your tomcat server. You said you were using tomcat 7. I guess (I am using tomcat 6) there's a web app manager in T7. Usually you can access it thru : http://localhost:8080/manager/html.
I agree. Here's the link:
subject: problem in Struts2 while running an application
It's not a secret anymore!