Judy001

Greenhorn
+ Follow
since Jun 06, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Judy001

HI,
I want to display data from 2 different dynaActionFrom.That means my main screen contains multiple buttons. In that when i press address button, i have to populate master records data and 2(REG and COR buttons) more buttons. when i press REG button , i have to populate child's Register address in a table in same JSP similarly for COR button(for this correspondense adrress).

My struts-config file is..
<form-beans >
<form-bean name="clientListForm" type="com.avox.struts.form.ClientListForm" />
<form-bean name="ButtonsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="addresses" type="java.util.ArrayList" />
<form-property name="names" type="java.util.ArrayList" />
<form-property name="urls" type="java.util.ArrayList" />
</form-bean>
<form-bean name="AddressForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="regaddress" type="java.util.ArrayList" />
<form-property name="coraddress" type="java.util.ArrayList" />
<action
attribute="ButtonsForm"
input="/jsp/clientList.jsp"
name="ButtonsForm"
parameter="method"
path="/ButtonsAction"
scope="request"
type="com.avox.struts.action.ButtonsAction">
<forward
name="button_address"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
<forward
name="button_name"
path="/jsp/buttons/Name.jsp"
contextRelative="true" />
<forward
name="button_urls"
path="/jsp/buttons/Reg.jsp"
contextRelative="true" />
<action
attribute="AddressForm"
input="/jsp/buttons/Address.jsp"
name="AddressForm"
parameter="method"
path="/AddressAction"
scope="request"
unknown="false"
type="com.avox.struts.action.AddressAction">
<forward
name="button_correspondence"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
<forward
name="button_register"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
</action>

Address.jsp
<body>
Master Address: <br><br>
<CENTER>
<table border="1" width="60%" rules="none">
<logic:empty name="ButtonsForm" property="maddress" >
<tr>
<td> NO Master Address Available</td>
</tr>
</logic:empty>
<logic:notEmpty name="ButtonsForm" property="maddress" >
<logic:iterate name="ButtonsForm" property="maddress" id="address" >
<tr>
<td><bean:write name="address" property="address" /></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>
<br><br><br>
<html:form action="/AddressAction">
<TABLE border="0" width="60%">
<TR>

<TD align="center">
<html:submit property="method">
<bean:message key="button.register"/>
</html:submit>
</TD>
<TD align="center">
<html:submit property="method">
<bean:message key="button.correspondence"/>
</html:submit>
</TD>
</TR>
</TABLE>
</html:form>
</center>
Children Addresses:
<CENTER><br><br>

<table border="1" width="60%" rules="none">
<logic:empty name="AddressForm" property="addresses" >
<tr>
<td> NO Children Address Available</td>
</tr>
</logic:empty>
<logic:notEmpty name="AddressForm" property="addresses" >
<logic:iterate name="AddressForm" property="addresses" id="address" >
<tr>
<td><bean:write name="addresses" property="address" /></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>

</CENTER>
</body>

Master address is working well when i press REG button iam getting error. i know that error meaning but i don't know how write code for that.how i can i populate data from 2 different beans.
could u please help me.

Thanks in advance
17 years ago
HI,
I want to display data from 2 different dynaActionFrom.That means my main screen contains multiple buttons. In that when i press address button, i have to populate master records data and 2(REG and COR buttons) more buttons. when i press REG button , i have to populate child's Register address in a table in same JSP similarly for COR button(for this correspondense adrress).

My struts-config file is..
<form-beans >
<form-bean name="clientListForm" type="com.avox.struts.form.ClientListForm" />
<form-bean name="ButtonsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="addresses" type="java.util.ArrayList" />
<form-property name="names" type="java.util.ArrayList" />
<form-property name="urls" type="java.util.ArrayList" />
</form-bean>
<form-bean name="AddressForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="regaddress" type="java.util.ArrayList" />
<form-property name="coraddress" type="java.util.ArrayList" />
<action
attribute="ButtonsForm"
input="/jsp/clientList.jsp"
name="ButtonsForm"
parameter="method"
path="/ButtonsAction"
scope="request"
type="com.avox.struts.action.ButtonsAction">
<forward
name="button_address"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
<forward
name="button_name"
path="/jsp/buttons/Name.jsp"
contextRelative="true" />
<forward
name="button_urls"
path="/jsp/buttons/Reg.jsp"
contextRelative="true" />
<action
attribute="AddressForm"
input="/jsp/buttons/Address.jsp"
name="AddressForm"
parameter="method"
path="/AddressAction"
scope="request"
unknown="false"
type="com.avox.struts.action.AddressAction">
<forward
name="button_correspondence"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
<forward
name="button_register"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
</action>

Address.jsp
<body>
Master Address: <br><br>
<CENTER>
<table border="1" width="60%" rules="none">
<logic:empty name="ButtonsForm" property="maddress" >
<tr>
<td> NO Master Address Available</td>
</tr>
</logic:empty>
<logic:notEmpty name="ButtonsForm" property="maddress" >
<logic:iterate name="ButtonsForm" property="maddress" id="address" >
<tr>
<td><bean:write name="address" property="address" /></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>
<br><br><br>
<html:form action="/AddressAction">
<TABLE border="0" width="60%">
<TR>

<TD align="center">
<html:submit property="method">
<bean:message key="button.register"/>
</html:submit>
</TD>
<TD align="center">
<html:submit property="method">
<bean:message key="button.correspondence"/>
</html:submit>
</TD>
</TR>
</TABLE>
</html:form>
</center>
Children Addresses:
<CENTER><br><br>

<table border="1" width="60%" rules="none">
<logic:empty name="AddressForm" property="addresses" >
<tr>
<td> NO Children Address Available</td>
</tr>
</logic:empty>
<logic:notEmpty name="AddressForm" property="addresses" >
<logic:iterate name="AddressForm" property="addresses" id="address" >
<tr>
<td><bean:write name="addresses" property="address" /></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>

</CENTER>
</body>

Master address is working well when i press REG button iam getting error. i know that error meaning but i don't know how write code for that.how i can i populate data from 2 different beans.
could u please help me.

Thanks in advance
17 years ago
Hi you are correct..I got it.i forgot about that.Many Thanks for your reply.
I have another doubt. In my address screen, i have 2 more buttons REG for register address and COR for correspondence address..when i press REG button i have to display all child's register addresses similarly COR button also. Before these buttons i have to populate master address. This master address works fine . but i don't know how to display these buttons's data in the same JSP.For this i have created action mapping like this...
<form-bean name="AddressForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="addresses" type="java.util.ArrayList" />
</form-bean>
<action
attribute="AddressForm"
input="/jsp/buttons/Address.jsp"
name="AddressForm"
parameter="method"
path="/AddressAction"
scope="request"
unknown="false"
type="com.avox.struts.action.AddressAction">
<forward
name="button_correspondence"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
<forward
name="button_register"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
</action>
</action-mappings>
I have written Address.jsp like this
<body>
Master Address: <br><br>
<CENTER>
<table border="1" width="60%" rules="none">
<logic:empty name="ButtonsForm" property="maddress" >
<tr>
<td> NO Master Address Available</td>
</tr>
</logic:empty>
<logic:notEmpty name="ButtonsForm" property="maddress" >
<logic:iterate name="ButtonsForm" property="maddress" id="address" >
<tr>
<td><bean:write name="address" property="address" /></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>
<br><br><br>
<html:form action="/AddressAction">
<TABLE border="0" width="60%">
<TR>

<TD align="center">
<html:submit property="method">
<bean:message key="button.register"/>
</html:submit>
</TD>
<TD align="center">
<html:submit property="method">
<bean:message key="button.correspondence"/>
</html:submit>
</TD>
</TR>
</TABLE>
</html:form>
</center>
Children Addresses:
<CENTER><br><br>

<table border="1" width="60%" rules="none">
<logic:empty name="AddressForm" property="addresses" >
<tr>
<td> NO Children Address Available</td>
</tr>
</logic:empty>
<logic:notEmpty name="AddressForm" property="addresses" >
<logic:iterate name="AddressForm" property="addresses" id="address" >
<tr>
<td><bean:write name="addresses" property="address" /></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>

</CENTER>
</body>
</html:html>

Master address's logic works fine but when i press REG button it shows error like this
Cannot find bean ButtonsForm in any scope
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:934)
at org.apache.struts.taglib.logic.EmptyTag.condition(EmptyTag.java:79)
at org.apache.struts.taglib.logic.EmptyTag.condition(EmptyTag.java:52)
at org.apache.struts.taglib.logic.ConditionalTagBase.doStartTag(ConditionalTagBase.java:174)
at org.apache.jsp.jsp.buttons.Address_jsp._jspx_meth_logic_empty_0(Address_jsp.java:315)
at org.apache.jsp.jsp.buttons.Address_jsp._jspService(Address_jsp.java:115)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Thanks in advance
17 years ago
Hi,
I am using Struts and jsp for my Screens. My Main Screen contains 8 buttons.
button.name= Name
button.address=Address
button.ids=IDs
button.url=URL....

When i press name button , it works fine .After that when i went for url or address or ids button iam getting error like
java.sql.SQLException: Closed Connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.PhysicalConnection.prepareCall(PhysicalConnection.java:919)
at oracle.jdbc.driver.PhysicalConnection.prepareCall(PhysicalConnection.java:885)
at com.avox.struts.action.ButtonsAction.ids_button(ButtonsAction.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.LookupDispatchAction.execute
........
But when i stop and strt my tomcat, then another button works fine remaining are not working..
In struts-config.xml, my code look like this
<form-beans >
<form-bean name="ButtonsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="names" type="java.util.ArrayList" />
<form-property name="addresses" type="java.util.ArrayList" />
<form-property name="legalnames" type="java.util.ArrayList" />
<form-property name="urls" type="java.util.ArrayList" />
<form-property name="ids" type="java.util.ArrayList" />
</form-bean>
....
<action
attribute="ButtonsForm"
input="/jsp/clientList.jsp"
name="ButtonsForm"
parameter="method"
path="/ButtonsAction"
scope="request"
type="com.avox.struts.action.ButtonsAction">
<forward
name="button_address"
path="/jsp/buttons/Address.jsp"
contextRelative="true" />
<forward
name="button_name"
path="/jsp/buttons/Name.jsp"
contextRelative="true" />
<forward
name="button_ids"
path="/jsp/buttons/Ids.jsp"
contextRelative="true" />
<forward
name="button_url"
path="/jsp/buttons/Url.jsp"
contextRelative="true" />

My action class
public class ButtonsAction extends LookupDispatchAction {

DBConnection db = new DBConnection();
CommonData cd = new CommonData();
OracleCallableStatement cstmt = null;
DataTGenericData genericData = null;
Connection conn = null;ResultSet rs=null;
public ButtonsAction() throws Exception{
db.init(); conn=db.getConnection();cd.init();
}

// Name Button
public ActionForward name_button(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
DynaActionForm ButtonsForm = (DynaActionForm) form;
. try {
mnames= new ArrayList(); int j=0;
cstmt =(OracleCallableStatement)conn.prepareCall
( "begin ? := pkg_csr_data.get_data2(?,?,?,?); end;" );
cstmt.registerOutParameter( 1,OracleTypes.STRUCT,"DATA_T_GENERIC_DATA");
........
........
mclients.add(new Mclient(result.toString()));
ButtonsForm.set("names",mnames);
}
cstmt.close();cstmt = null;
db.close(conn);
} catch (Exception e) {e.printStackTrace();}
finally {
if (cstmt != null) {
try {
cstmt.close();
} catch (SQLException e) {;}
}
}
return (mapping.findForward("button_name"));
}
public ActionForward address_button(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException, Exception
{
DynaActionForm ButtonsForm = (DynaActionForm) form;
try {
maddress= new ArrayList(); int j=0;
cstmt =(OracleCallableStatement)conn.prepareCall
( "begin ? := pkg_csr_data.get_data2(?,?,?,?); end;" );
cstmt.registerOutParameter( 1,OracleTypes.STRUCT,"DATA_T_GENERIC_DATA");
........
........
mclients.add(new Mclient(result.toString()));
ButtonsForm.set("addresses",maddress);
}
cstmt.close();cstmt = null;
db.close(conn);
} catch (Exception e) {e.printStackTrace();}
finally {
if (cstmt != null) {
try {
cstmt.close();
} catch (SQLException e) {;}
}
}
return (mapping.findForward("button_address"));
}
protected Map getKeyMethodMap()
{
Map map = new HashMap();
map.put("button.name","name_button");
map.put("button.address","address_button");
map.put("button.ids","ids_button");
map.put("button.url","url_button");
return map;
}
}
In my action class, i am instatiating my dynaction form every time. i think my error is due to that re-instatiation.i have to store all of my buttons data globally in diferent arraylists. i am trying to that but iam unable to retrive those data.

how can i solve this problem. I have spent 2 days for this error.still iam not getting right data.

Thanks in advance
17 years ago