File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Newbee, struts proj is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Newbee, struts proj is not working" Watch "Newbee, struts proj is not working" New topic

Newbee, struts proj is not working

aditya rd

Joined: Dec 08, 2010
Posts: 1
I am reading the Jakarta Struts live pdf, and learnt the basics of struts. I am trying to do the steps stated in the book. However, I am facing some issues. Can anyone please help me fix the problem..

Here are the details of the application:

My action:

package pkg.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class UserRegistrationAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success");



my jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>User Registration Was Successful!</title>

<h1>Prayas, User Registration Was Successful!</h1>


When I run the project after deploying the war on tomcat, i get 404 error
I tried with:

all 3 cases fail. Please help me. I have attached struts-config, web.xml and dir structure of my proj

[Thumbnail for web.GIF]

[Thumbnail for dir-structure-of-project.GIF]

[Thumbnail for struts-config.GIF]

Tom Reilly

Joined: Jun 01, 2010
Posts: 618
Note that I haven't worked with struts in a while so some of the following may not be accurate. Some suggestions:
1. You will probably get more responses if you post text rather than images. For me, the images are too blurry when seen in my browser so I have to download them and it is harder to review images then simple text.
2. In your URLs, you are using the servlet display-name (TestStruts). I think you need to use the servlet-name (action).
3. In your url-pattern, you use *.do but no part of your URL specifies ".do"
4. I think your errors have nothing to do with struts but with your understanding of servlets. Try creating a HelloWorld servlet first. Once you get that running and understand the details, progress to creating a servlet that uses struts.
I agree. Here's the link:
subject: Newbee, struts proj is not working
It's not a secret anymore!