Sure:
    /**
     * Getter for property sql_stmt.
     * @return Value of property sql_stmt.
     */
    public String getSql_stmt() {

        return this.sql_stmt;
    }

However this is not the problem. I have tried many different getters and indeed in the debugger I have looked at the variables on the bean being used by the display jsp. The problem is that the display jsp is using a new instance of apache_connection_stats, but I want it to use the instance populated by the form...

I really don't know where i have gone wrong. Below is the applicable code for my struts-config and Action:

Struts config:
<form-beans>
<form-bean name="ApacheConnectionStats" type="com.ftid.mis.form.apache_connection_stats" />
...
</form-beans>

<action-mappings>
        <action
            path="/apache_connection_stats"
            type="com.ftid.mis.action.MisAction"
            name="ApacheConnectionStats"
            scope="request">
            <forward name="success" path="/pages/display.jsp" />
        </action>
...
</action-mappings>

Action:
public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {

        apache_connection_stats tempform = (apache_connection_stats) form;

tempform.doSql(this.getDataSource(request, "FTID"), this.getDataSource(request, "FTIDLOGS"));
        String moo = tempform.getSql_stmt();
        return mapping.findForward("success");
    }

Note: the string 'moo' does indeed contain the correct sql_stmt as constructed by the form bean

Martin Gainty wrote:
Brett-
Can we see the code for your Bean com.ftid.mis.form.apache_connection_stats ?
specifically the getSql_stmt() method ?
Martin-
----- Original Message ----- From: "Brett" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 12, 2005 7:23 AM
Subject: Loosing my form bean instance...


Hi

I have a problem that is driving me crazy.

I have a fairly simple struts web app with a jsp form that submits to a form bean, with an action set up and a display page. I have built a few struts apps and never had such a basic problem:

The jsp submits the data and the form bean recieves it. It then processes it correctly when the appropriate method is called from the action (with the form cast in). I have debugged up to this point and so know that everything is correct.

What should happen next is that my display page is shown and accesses my form bean using the getters to retrieve the appropriate data values. However when the action calls findforward, and the display page is called, it seems to create a new instance of my form bean and so all data values are null.

Any ideas?

My code on the display jsp is:

<%@ page language="java"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/taglibs-datetime.tld" prefix="dt" %>
<%@ taglib uri="/WEB-INF/displaytag_1_0.tld" prefix="display" %>

<jsp:useBean id="apacheConnectionStats" scope="session" class="com.ftid.mis.form.apache_connection_stats" />

<html>
   <head><title>JSP Page</title></head>
   <body>

       Well done
       <br>
      <%= apacheConnectionStats.getSql_stmt() %>
   </body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to