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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "action class not being called." Watch "action class not being called." New topic

action class not being called.

lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
Hi all,
this there a way to check if my actionclass is being call. I tried to put the Systm.out.println. but nothing is display so i assumed my action is not being call.

Im using Struts 1.3.5

Action Class:
private final static String SUCCESS = "success";
public ActionForward insert(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
ContentForm cfrm = (ContentForm) form;
Session session = null;

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
//Create new instance of Contact and set values in it by reading them from form object
System.out.println("Inserting Record");
Content content = new Content();
}catch (Exception e)
return mapping.findForward(SUCCESS);

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

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

This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.

Struts Validator is configured using the factory defaults
and is ready-to-use.

NOTE: If you have a generator tool to create the corresponding Java classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with the
corresponding "name" and "type" attributes, as shown here.

<form-bean name="contentForm"

<action path="/list"
<forward name="success" path="/list.jsp"/>
<action path="/insert" forward="/insert.jsp"/>
<action path="/listAdd"
<forward name="success" path="/list.jsp"/>
<message-resources parameter="com.strutsexample.message" null="false"/>

JSP page:
<%@ taglib uri="" prefix="bean" %>
<%@ taglib uri="" prefix="html" %>
<%@ taglib uri="" prefix="logic" %>
<%@ taglib uri="" prefix="tiles" %>

<html:form action="/listAdd" method="get">
<tr><td><bean:message key=""/></td><td><html:text property="name"/></td></tr>
<tr><td><bean:message key="label.title"/></td><td><html:text property="title"/></td></tr>
<tr><td><bean:message key="label.content"/></td><td><html:textarea property="content"/></textarea></td></tr>
<tr><td><bean:message key="label.file"/></td><td><html:file property="file"/></td></tr>
<tr><td> <html:hidden property="method" value="insert" />
<html:submit value="submit"></html:submit></td><td></td></tr>
Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
Debug breakpoints.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
So what behavior are you seeing? Note that the default value for the validate property of an action mapping is "true". It could be the case that validation is failing in which case the action class is never called.

- Brent
Suresh Kumar Ramasamy

Joined: Mar 18, 2008
Posts: 7
Brent Sterling wrote:So what behavior are you seeing? Note that the default value for the validate property of an action mapping is "true". It could be the case that validation is failing in which case the action class is never called.

- Brent

I know it is a 5 year old thread, but I am not able to resist posting Thanks. I spent almost a day debugging and only after reading your tip my problem got solved. Thank You.
I agree. Here's the link:
subject: action class not being called.
It's not a secret anymore!