Richard,
I put my bean in session scope when I create it in an action class:
OracleConnBean dbconn=null;
dbconn = (OracleConnBean)session.getAttribute("dbconnection");
if(dbconn == null) {
dbconn = new OracleConnBean();
session.setAttribute("dbconnection", dbconn);
}
Then, I can access the object from my jsp pages without using jsp:useBean.
I am not exactly sure because I am not very much experienced with
jsp/servlets, but this may be the reason for those 3 beans created. By the
way, how did you find that out? How do you debug? (This may be a more
general question as what is the best way to debug jsp/servlets? I don't
debug yet, but I want to. I am using Forte CE. I heard about debugging in
Tomcat using IBM VAJ, do I need to get that?)
When you don't use jsp:useBean, you better use the "type" attribute in your
iterate tag, to get the correct object type:
<struts_logic:iterate id="element" name="testGridForm" property="data"
type="type_of_your_data_element" >
HTH,
Turgay
-----------------------------------
From: Richard Murray
Subject: RE: How do you use indexed properties with html:input?
Date: Thu, 10 May 2001 02:44:02 -0700
--------------------------------------------------------------------------------
Hi,
I made the following changes in my Action class and got my save to work.
HttpSession session = request.getSession();
TestGridForm testGridForm = (TestGridForm)session.getAttribute(
"testGridForm" );
However, while trying to debug my problem I found I get 3 ActionForm Beans
created when I only expected 1.
In my jsp I have the following:
<jsp:useBean id="testGridForm" class="com.qspgroup.utc.TestGridForm"
scope="session" />
I have added scope="session to the logic:iterate tag e.g.
<struts_logic:iterate id="element" name="testGridForm" property="data"
scope="session" >
On the page where I display the results I also have:
<jsp:useBean id="testGridForm" class="com.qspgroup.utc.TestGridForm"
scope="session" />
I expected all the above to refer to the session scoped bean "testGridForm",
so why are 3 beans created?
Richard.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.