You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ha...@informatiefabriek.nl on 2003/09/19 11:50:21 UTC

Bean population question (Urgent)

Hi all,

I'm sorry for the urgent-tag. But, I have a deadline to make this weekend.

Okay the problem:

I have a ActionForm wich contains a ValueObject. Like this 
(DeleteCorrectionForm):

package nl.informatiefabriek.om.action.correction;

import nl.informatiefabriek.om.correction.value.CorrectionValue;

import org.apache.struts.action.ActionForm;

/**
 * @author harm
 *
 * @struts.form
 *              name = "deleteCorrectionForm"
 */
public class DeleteCorrectionForm extends ActionForm {
        private String id;
        private CorrectionValue correctionValue;
 
 
        /**
         * @return
         */
        public CorrectionValue getCorrectionValue() {
                return correctionValue;
        }

        /**
         * @return
         */
        public String getId() {
                return id;
        }

        /**
         * @param value
         */
        public void setCorrectionValue(CorrectionValue value) {
                correctionValue = value;
        }

        /**
         * @param string
         */
        public void setId(String string) {
                id = string;
        }

}

In my JSP I have to iterate throug a Collection of 'Corrections' like 
this.
The corrections Collection contains CorrectionValueObjects:

<c:forEach items="${corrections}" var="correction">
<html:form action="/delete_correction">
        <html:hidden name="idBean" property="id"/>
        <html:hidden name="correction" property=
"correctionValue.correctionId"/>
        <html:submit styleClass="button" value="Delete"/>
</html:form>
</c:forEach>


This piece of JSP generates this html:

<form name="deleteCorrectionForm" method="post" 
action="/ordermanager-ejb/delete_correction.do">
<input type="hidden" name="id" value="A simple id">
<input type="hidden" name="correctionValue.correctionId" value="A id">
<input type="submit" value="Delete" class="button">
</form>

But when I submit the form I get:

javax.servlet.ServletException: BeanUtils.populate

What is the way to do this?

Many, many thanks,

Harm de Laat
Informatiefabriek
The Netherlands


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


RE: Bean population question (Urgent)

Posted by ha...@informatiefabriek.nl.
<snip>
Awww geeee. Thats too bad.
My heart bleeds for you. Join the club mate.
</snip>

Okay, got the point! ;-)

But you will be happy to know your suggestion solved the problem.

Thanks a lot....

Cheers,

Harm de Laat
Informatiefabriek




"Andrew Hill" <an...@gridnode.com> 
09/19/2003 11:57 AM
Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
"Struts Users Mailing List" <st...@jakarta.apache.org>
cc

Subject
RE: Bean population question (Urgent)






<snip>
I'm sorry for the urgent-tag. But, I have a deadline to make this weekend.
</snip>

Awww geeee. Thats too bad.
My heart bleeds for you. Join the club mate.

Request scoped form?
It could be that the correction property is null. Try changing your form 
to
use:

private CorrectionValue correctionValue = new CorrectionValue();

so that you have the sub-bean ready for beanutils to populate (it doesnt
create it for you Im afraid - though that would be a nice enhancement 
imho)

You could also instantiate it in the reset() method if you wanted



-----Original Message-----
From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
Sent: Friday, 19 September 2003 17:50
To: struts-user@jakarta.apache.org
Subject: Bean population question (Urgent)


Hi all,

I'm sorry for the urgent-tag. But, I have a deadline to make this weekend.

Okay the problem:

I have a ActionForm wich contains a ValueObject. Like this
(DeleteCorrectionForm):

package nl.informatiefabriek.om.action.correction;

import nl.informatiefabriek.om.correction.value.CorrectionValue;

import org.apache.struts.action.ActionForm;

/**
 * @author harm
 *
 * @struts.form
 *              name = "deleteCorrectionForm"
 */
public class DeleteCorrectionForm extends ActionForm {
        private String id;
        private CorrectionValue correctionValue;


        /**
         * @return
         */
        public CorrectionValue getCorrectionValue() {
                return correctionValue;
        }

        /**
         * @return
         */
        public String getId() {
                return id;
        }

        /**
         * @param value
         */
        public void setCorrectionValue(CorrectionValue value) {
                correctionValue = value;
        }

        /**
         * @param string
         */
        public void setId(String string) {
                id = string;
        }

}

In my JSP I have to iterate throug a Collection of 'Corrections' like
this.
The corrections Collection contains CorrectionValueObjects:

<c:forEach items="${corrections}" var="correction">
<html:form action="/delete_correction">
        <html:hidden name="idBean" property="id"/>
        <html:hidden name="correction" property=
"correctionValue.correctionId"/>
        <html:submit styleClass="button" value="Delete"/>
</html:form>
</c:forEach>


This piece of JSP generates this html:

<form name="deleteCorrectionForm" method="post"
action="/ordermanager-ejb/delete_correction.do">
<input type="hidden" name="id" value="A simple id">
<input type="hidden" name="correctionValue.correctionId" value="A id">
<input type="submit" value="Delete" class="button">
</form>

But when I submit the form I get:

javax.servlet.ServletException: BeanUtils.populate

What is the way to do this?

Many, many thanks,

Harm de Laat
Informatiefabriek
The Netherlands


---------------------------------------------------------------------
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




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


RE: Bean population question (Urgent)

Posted by Andrew Hill <an...@gridnode.com>.
<snip>
I'm sorry for the urgent-tag. But, I have a deadline to make this weekend.
</snip>

Awww geeee. Thats too bad.
My heart bleeds for you. Join the club mate.

Request scoped form?
It could be that the correction property is null. Try changing your form to
use:

private CorrectionValue correctionValue = new CorrectionValue();

so that you have the sub-bean ready for beanutils to populate (it doesnt
create it for you Im afraid - though that would be a nice enhancement imho)

You could also instantiate it in the reset() method if you wanted



-----Original Message-----
From: harm@informatiefabriek.nl [mailto:harm@informatiefabriek.nl]
Sent: Friday, 19 September 2003 17:50
To: struts-user@jakarta.apache.org
Subject: Bean population question (Urgent)


Hi all,

I'm sorry for the urgent-tag. But, I have a deadline to make this weekend.

Okay the problem:

I have a ActionForm wich contains a ValueObject. Like this
(DeleteCorrectionForm):

package nl.informatiefabriek.om.action.correction;

import nl.informatiefabriek.om.correction.value.CorrectionValue;

import org.apache.struts.action.ActionForm;

/**
 * @author harm
 *
 * @struts.form
 *              name = "deleteCorrectionForm"
 */
public class DeleteCorrectionForm extends ActionForm {
        private String id;
        private CorrectionValue correctionValue;


        /**
         * @return
         */
        public CorrectionValue getCorrectionValue() {
                return correctionValue;
        }

        /**
         * @return
         */
        public String getId() {
                return id;
        }

        /**
         * @param value
         */
        public void setCorrectionValue(CorrectionValue value) {
                correctionValue = value;
        }

        /**
         * @param string
         */
        public void setId(String string) {
                id = string;
        }

}

In my JSP I have to iterate throug a Collection of 'Corrections' like
this.
The corrections Collection contains CorrectionValueObjects:

<c:forEach items="${corrections}" var="correction">
<html:form action="/delete_correction">
        <html:hidden name="idBean" property="id"/>
        <html:hidden name="correction" property=
"correctionValue.correctionId"/>
        <html:submit styleClass="button" value="Delete"/>
</html:form>
</c:forEach>


This piece of JSP generates this html:

<form name="deleteCorrectionForm" method="post"
action="/ordermanager-ejb/delete_correction.do">
<input type="hidden" name="id" value="A simple id">
<input type="hidden" name="correctionValue.correctionId" value="A id">
<input type="submit" value="Delete" class="button">
</form>

But when I submit the form I get:

javax.servlet.ServletException: BeanUtils.populate

What is the way to do this?

Many, many thanks,

Harm de Laat
Informatiefabriek
The Netherlands


---------------------------------------------------------------------
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