wood burning stoves*
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Newbee, struts proj is not working" Watch "Newbee, struts proj is not working" New topic
Author

Newbee, struts proj is not working

aditya rd
Greenhorn

Joined: Dec 08, 2010
Posts: 1
Hi,
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"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>User Registration Was Successful!</title>
</head>
<body>


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


---------------------------------------------------------

When I run the project after deploying the war on tomcat, i get 404 error
I tried with:
http://localhost:8080/TestStruts/pkg/action/userRegistration
http://localhost:8080/TestStruts/userRegistration
http://localhost:8080/TestStruts/

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
Rancher

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: http://aspose.com/file-tools
 
subject: Newbee, struts proj is not working