struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitar Stavrakov <DStavra...@infinet-inc.com>
Subject RE: Struts 1.0.2 checkbox - Error Message: No collection found
Date Wed, 27 Mar 2002 19:49:17 GMT
You can try using the present tag ex :

<logic:present id="conflicts" name="ConflictResolutionForm"
property="conflicts" type="com.pioneer.sales.terrmaint.demo.ConflictBean"> 

before actually going into the iterate and checkbox tags. This will check to
see if the collection exists, before executing the logic inside the tag. 

	Regards, 

		Dimitar

-----Original Message-----
From: Mike Finn [mailto:michael_finn@frontiercorp.com] 
Sent: Wednesday, March 27, 2002 12:54 PM
To: Struts Users Mailing List
Subject: RE: Struts 1.0.2 checkbox - Error Message: No collection found

Yu,
This looks like the same problem I posted this AM (subject = logic:iterate
and "no collection found"). I found that if the array actually has data in
it, everything works OK. It's only when it's empty or null that it blows up.
Post if you find a solution and I will do the same. I am going to try to
step through the source this afternoon.
Mike

-----Original Message-----
From: Yu, Yanhui [mailto:yanhui.yu@pioneer.com]
Sent: Wednesday, March 27, 2002 1:03 PM
To: 'struts-user@jakarta.apache.org'
Subject: RE: Struts 1.0.2 checkbox - Error Message: No collection found


Sorry I forgot that the reset method in the ActionForm looks like this:
==============================================================
public void reset(ActionMapping mapping, HttpServletRequest request)
{
cat.debug("ConflictResolutionForm reset");
/*
this.checked = false;
this.linenum = null;
this.field = null;
this.level = null;
this.currentValue = null;
this.overrideValue = null;
*/

 if(conflicts != null) {
            for(int i=0; i< conflicts.size(); i++) {
                ((ConflictBean) conflicts.get(i)).setChecked(false);
            }
        }
}
==============================================================
Looking forward to hearing any hints, thank you very much,
Yanhui



-----Original Message-----
From: Yu, Yanhui
Sent: Wednesday, March 27, 2002 12:00 PM
To: struts-user@jakarta.apache.org
Subject: Struts 1.0.2 checkbox - Error Message: No collection found


Hi All,

We are using struts verions 1.0.2 here.  I have a problem using checkbox in
a jsp, getting No collection found error.  Here is my sample code and I
really appreciate if anyone can give me a hand on this.

in jsp
=====================================
	<logic:iterate id="conflicts" name="ConflictResolutionForm"
property="conflicts"
                 type="com.pioneer.sales.terrmaint.demo.ConflictBean">
    	<tr>
    		<td><html:checkbox name="conflicts"  property="checked"
/></td>
    		<td><bean:write name="conflicts" property="field" /> </td>
    		<td><bean:write name="conflicts" property="level" /> </td>
    		<td><bean:write name="conflicts" property="currentValue"
/></td>
    		<td><bean:write name="conflicts" property="overrideValue" />
</td>
	 	</tr>
	</logic:iterate>
=======================================

in ConflictBean class
========================================
	private String linenum = null;
	private String field = null;
	private String level = null;
	private String currentValue = null;
	private String overrideValue = null;
	private boolean checked = false;

	// all public getters and setters for all the String attributes

	public boolean getChecked() {
		return checked;
	}
	public void setChecked(boolean _checked){
		checked = _checked;
	}
==================================================

in Action class
==================================================
	ConflictResolutionForm conFlictForm = new ConflictResolutionForm();
	ArrayList conflicts = new ArrayList();
	// Fill in the list here

	ConflictBean cb = new ConflictBean();
	cb.setLinenum("1");
	cb.setField("Field 1");
	cb.setLevel("Area");
	cb.setCurrentValue("012345678");
	cb.setOverrideValue("012345678");
  	conflicts.add(cb);

	conFlictForm.setConflicts(conflicts);
	return (mapping.findForward("conflictresolution"));   //set up in
struts-config.xml
====================================================

in ActionForm
=====================================================
	private ArrayList conflicts = null;

	public ArrayList getConflicts() {
		return conflicts;
	}

	public void setConflicts(ArrayList _conflicts) {
		conflicts = _conflicts;
	}

	public ConflictBean getConflicts(int index) {
		return (ConflictBean) conflicts.get(index);
	}

	public void setConflicts(int index, ConflictBean conflict) {
		conflicts.set(index,conflict);
	}
======================================================


Any help would be greatly appreciated.  What I did wrong here? Maybe
multibox is what I need?

Yanhui




--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message