You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mu Mike <mi...@hotmail.com> on 2004/03/12 11:17:48 UTC

help! I m going mad

I just cant use logic:iterate correctly!

this is my form bean class:
public class TestBeanForm extends ActionForm {

    public String[] getTestBean() {
        return testBean;
    }

    public void setTestBean(String[] testBean) {
        this.testBean = testBean;
    }

    String[] testBean;

and this is my form bean declaration
        <form-bean name="TestBeanForm" type="com.mike.form.TestBeanForm"/>
and this is what I have in my jsp file:

<html:form action="/testAction.do">
   <logic:iterate name="TestBeanForm" property="testBean" id="mybean" 
indexId="index1" >
<%--     <html:text  property="fontName" value="12" indexed="true"/>--%>
   </logic:iterate>
   <html:submit property="submitValue">Submit Changes</html:submit>
</html:form>

you can see, I commented out the <html:text> line, but I still kept getting 
"No collection found" error, why? arent String[] a collection?

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  


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


Re: help! I m going mad

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
In your struts-config.xml, is the action which initially displays your jsp
page associated with TestBeanForm?

Niall

----- Original Message ----- 
From: "Mu Mike" <mi...@hotmail.com>
To: <st...@jakarta.apache.org>
Sent: Friday, March 12, 2004 10:17 AM
Subject: help! I m going mad


> I just cant use logic:iterate correctly!
>
> this is my form bean class:
> public class TestBeanForm extends ActionForm {
>
>     public String[] getTestBean() {
>         return testBean;
>     }
>
>     public void setTestBean(String[] testBean) {
>         this.testBean = testBean;
>     }
>
>     String[] testBean;
>
> and this is my form bean declaration
>         <form-bean name="TestBeanForm" type="com.mike.form.TestBeanForm"/>
> and this is what I have in my jsp file:
>
> <html:form action="/testAction.do">
>    <logic:iterate name="TestBeanForm" property="testBean" id="mybean"
> indexId="index1" >
> <%--     <html:text  property="fontName" value="12" indexed="true"/>--%>
>    </logic:iterate>
>    <html:submit property="submitValue">Submit Changes</html:submit>
> </html:form>
>
> you can see, I commented out the <html:text> line, but I still kept
getting
> "No collection found" error, why? arent String[] a collection?
>
> _________________________________________________________________
> 与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



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


Re: help! I m going mad

Posted by Mark Lowe <ma...@talk21.com>.
Okay here's a full example, first of all i'm going to mess with your 
naming conventions as they'd drive me mad also
//bean
package com.sparrow.struts;

public class TestBean {
	private String name;

	public String getName() {
		return name;
	}	
	
	public void setName(String name) {
		this.name = name;
	}
}

//the form
package com.sparrow.struts;

import java.util.ArrayList;
import java.util.List;
import org.apache.struts.action.ActionForm;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.collections.Factory;

public class TestBeanForm extends ActionForm {

	private List testBeanList;

	public SizesForm() {
		initLists();
	}

     private void initLists() {
         Factory factory = new Factory() {
             public Object create() {
                 return new TestBean();
             }
         };
         this. testBeanList = ListUtils.lazyList(new ArrayList(), 
factory);
     }
	
	public List getTestBeans() {
		return testBeanList;
	}

	public void setTestBeans(List testBeanList) {
		this. testBeanList = testBeanList;
	}

	public TestBean getTestBean(int index) {
		return (TestBean) testBeanList.get(index);
	}

	public void setTestBean(int index,TestBean testBean) {
		this. testBeanList.add(index, testBean);
	}

}

//struts config

<form-bean name="testBeanForm" type="com.sparrow.struts.TestBeanForm" />

<action path="/testAction" name="testBeanForm" scope="request" ...


//jsp

<html:form action="/testAction.do">

	<logic:iterate id="mybean" name="testBeanForm" property="testBeans">
	<html:text name="mybean" property="name" indexed="true" />
...





On 12 Mar 2004, at 11:17, Mu Mike wrote:

> I just cant use logic:iterate correctly!
>
> this is my form bean class:
> public class TestBeanForm extends ActionForm {
>
>    public String[] getTestBean() {
>        return testBean;
>    }
>
>    public void setTestBean(String[] testBean) {
>        this.testBean = testBean;
>    }
>
>    String[] testBean;
>
> and this is my form bean declaration
>        <form-bean name="TestBeanForm" 
> type="com.mike.form.TestBeanForm"/>
> and this is what I have in my jsp file:
>
> <html:form action="/testAction.do">
>   <logic:iterate name="TestBeanForm" property="testBean" id="mybean" 
> indexId="index1" >
> <%--     <html:text  property="fontName" value="12" 
> indexed="true"/>--%>
>   </logic:iterate>
>   <html:submit property="submitValue">Submit Changes</html:submit>
> </html:form>
>
> you can see, I commented out the <html:text> line, but I still kept 
> getting "No collection found" error, why? arent String[] a collection?
>
> _________________________________________________________________
> 与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: Example commons_logging.properties

Posted by Julio Cesar De Salvo <jd...@itechnology.com.ar>.
My version is set to work with log4j, that's where you set the logging
level to INFO.


Commons-logging.properties
--------------------------
# Directly selects log4j logging implementation class.
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Lo
g4jFactory

# Maps to a Log4J category (uses log4j.properties)
#  note: org.apache.log4j.Category is deprecated in favor of
org.apache.log4j.Logger
#  and requests for a Category object will return a Logger object.
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCate
goryLog

lo4j.properties
---------------
# Set the root logger level to DEBUG and its only appender to rolling
log4j.rootLogger=WARN, stdout

# Set the logger level for everything under "org.apache" to DEBUG
log4j.logger.org.apache.torque=DEBUG, rolling
log4j.logger.org.apache.struts=DEBUG, rolling
log4j.logger.org.itechnology=DEBUG, org.itechnology

# Log for Itechnology Intranet inner classes 
log4j.appender.org.itechnology=org.apache.log4j.FileAppender
log4j.appender.org.itechnology.file=./logs/itechnology_intranet.log
log4j.appender.org.itechnology.layout=org.apache.log4j.PatternLayout
log4j.appender.org.itechnology.layout.conversionPattern=%d [%t] %-5p %c
- %m%n
log4j.appender.org.itechnology.append=false

# Configure the stdout appender to be a ConsoleAppender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d - %p %c - %m%n

# Configure the rolling appender to be a RollingFileAppender
log4j.appender.rolling=org.apache.log4j.RollingFileAppender
log4j.appender.rolling.File=./logs/itechnology_intranet_org_apache.log
log4j.appender.rolling.MaxFileSize=1MB
log4j.appender.rolling.MaxBackupIndex=5
log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
log4j.appender.rolling.layout.ConversionPattern=%d [%t] %-5p %c- %m%n




-----Mensaje original-----
De: jmutonho@za.safmarine.com [mailto:jmutonho@za.safmarine.com] 
Enviado el: Lunes, 15 de Marzo de 2004 05:21 a.m.
Para: struts-user@jakarta.apache.org
Asunto: Example commons_logging.properties






Hi
Can someone show me(or a pointer to a good example on the web)  an
example commons_logging.properties file with logging set to INFO only

jeff mutonho



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


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


Example commons_logging.properties

Posted by jm...@za.safmarine.com.




Hi
Can someone show me(or a pointer to a good example on the web)  an
example commons_logging.properties file with logging set to INFO only

jeff mutonho



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


Re: help! I m going mad

Posted by Siamack <sa...@yahoo.ca>.
Hello:
 
the  "name" attribute in your logic:iterate should be your object name not your class name. Hope this helps.
 
<html:form action="/testAction.do">
   <logic:iterate name="YOUR OBJECT NAME" property="testBean" id="mybean" 
indexId="index1" >
<%--     <html:text  property="fontName" value="12" 
indexed="true"/>--%>
   </logic:iterate>
   <html:submit property="submitValue">Submit Changes</html:submit>
</html:form>



 
regards,
 
 



---------------------------------
Post your free ad now! Yahoo! Canada Personals