Hi! I'm using struts 1.1. I have a index.jsp page shows all the categories of books I have in a DB. In struts-config.xml I have : <action path="/index" type="com.mtp.store.action.CategoryAction" scope="request" validate="false"> > <forward name="Success" path="/index.jsp"/> </action> and in web.xml : ... <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>application</param-name> <param-value>/WEB-INF/classes/ApplicationResources</param-value> </init-param> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>validate</param-name> <param-value>true</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- Action Servlet Mapping --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>/index.jsp</url-pattern> </servlet-mapping> ... so when I call index.jsp, I would like that CategoryAction access the db and return a vector of Strings. In CategoryAction I have : ... request.setAttribute("categories", categories); forward = mapping.findForward("Success"); return forward; ... where categories is the Vector. I have putsome println at the beginning of the execute method but I cannot see any. When I call : localhost:8080/bookstore/index.jsp in the prompt appears : action: Processing a GET for /index action: Setting locale 'en_US' Looking for Action instance for class com.mtp.store.action.CategoryAction action: Double checking for Action instance already there action: Creating new Action instance and stops here. Then the the index.jsp appears without any code. Does anyone know the problem ??? Thanks !!!
Erik Hatcher
Author
Ranch Hand
Joined: Jun 11, 2002
Posts: 111
posted
0
I would venture a guess and say that its working ok up to the index.jsp and perhaps what you've got there is causing the problem. What does your browser get from View Source? What is in your JSP page?
I think you should have a form-bean defined. wherein form-bean will have logic to get data from database and populate html.
Matthew Phillips
Ranch Hand
Joined: Mar 09, 2001
Posts: 2676
posted
0
pilania, JavaRanch has a naming policy which is strictly enforced. Please read the policy and change your display name if you wish to continue posting here. You can change your name: here
Matthew Phillips
Dustin Marx
Ranch Hand
Joined: Mar 06, 2001
Posts: 40
posted
0
I recommend, if this is still a problem, that you make sure that your action class (com.mtp.store.action.CategoryAction) extends the Struts Action class. If it does not extend this class, you can get a message like the one you are seeing.