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

new to struts

Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Hi all,
I am new to struts i want to a sample program in struts,for this i did like following

I did every thing for doing the program in struts like Action clss,web.xml,struts-config.xml

here i am sending my path

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\appstruts\WEB-INF\classes\>this is action class

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\appstruts\WEB-INF\web.xml,struts-config.xml

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\appstruts\WEB-INF\lib\-->here i included related jar files


<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"


<!-- ========== Form Bean Definitions ============ -->
<form-bean name="login" type="test.struts.LoginForm" />

<!-- ========== Global Forward Definitions ========= -->

<!-- ========== Action Mapping Definitions ======== -->
path="/actOne"type="Aone" >

<forward name="valid" path="/jsp/MainMenu.jsp" />
<forward name="invalid" path="/jsp/LoginView.jsp" />



<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"


<!-- Action Servlet Configuration -->

<!-- Action Servlet Mapping -->

<!-- Struts Tag Library Descriptors -->






import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class Aone extends Action
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServlet res)throws Exception
System.out.println("----execute of aone---");
return null;

but when i am going to excute in tomcat its going to another file
i am clicking on the folder appstruts like following


but its directly going to http://localhost:8082/appstruts/example/HelloWorld.action this link
i changed and i typed there like following http://localhost:8082/appstruts/
its giving the error uable to find requsted resorce
what to do
where did i mistaked

please any one help me
kenji kunoichi
Ranch Hand

Joined: Jun 02, 2007
Posts: 46
you havent made any JSP page ? you need a view component right ? when starting struts download struts-blank.war file from the apache website and try to run the war file put the war file in Tomcat's webapps folder . se struts blank is running or not ( first from your services start tomcat )...if tomcat is starting well then try to run the struts-blank.war
It is sorta covered in the JavaRanch Style Guide.
subject: new to struts