<form-bean name="registerFull" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="id" type="java.lang.Integer" />
<form-property name="fullname" type="java.lang.String" />
<form-property name="notify" type="java.lang.Integer" />
</form-bean>
..
<html:text property="fullname" /> <html:text property="id" /> <html:text property="notify />
or if you are nesting you bean which in that case i wouldn't (too short).
<form-property name="mybean" type="cz.chalu.struts.modules.completeregister.ComplRegisterDTO">
Then assuming that fullname, id, and notify are all properties of ComplRegisterDTO.
<html:text property="mybean.fullname" /> <html:text property="mybean.id" /> <html:text property="mybean.notify" />
Cheers Mark
On Sunday, August 31, 2003, at 03:00 PM, Jiri Chaloupka wrote:
Thanks Mark I do not know if I understnad well. No I have in struts config:
<form-bean name="registerFull" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="prop" type="cz.chalu.struts.modules.completeregister.ComplRegisterDTO" />
<form-property name="id" type="java.lang.Integer" />
<form-property name="fullname" type="java.lang.String" />
<form-property name="notify" type="java.lang.Integer" />
...
, action definition:
<action
path="/Register2"
type="cz.chalu.struts.modules.completeregister.LoadDataAction"
parameter=".main.registerFinish"/>
, LoadDataAction is:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception, DatabaseException
{
LoadDataService service = new LoadDataService(); ComplRegisterDTO registerDTO = service.loadUser(request); BeanUtils.copyProperties(form, registerDTO); return (mapping.findForward("success")); }
and form:
<html:form action="/FinishRegister" method="post" focus="registerFull">
<table border="0">
<tr>
<td><bean:message key="register.name.Fullname" />:</td>
<td><html:text property="fullname" /></td>
</tr>
<tr>
<td><bean:message key="register.name.Mail" />:</td>
<td><html:text property="mail" /></td>
</tr>
<tr>
<td><bean:message key="register.name.MailNotification" />:</td>
<td valign="top">
<html:radio property="notify" value="1" ><bean:message key="register.name.MailNotifYes" /></html:radio>
<html:radio property="notify" value="0" ><bean:message key="register.name.MailNotifNo" /></html:radio>
</td>
</tr>
...
and i got exception
ServletException: No destination bean specified
what is wrong?
Mark Lowe wrote:
Your from bean definition is the most useful thing you can provide to answer this..
if in your formBean definition or in the actionForm class you've got type
<form-property name="myprop" type="com.whatever.ComplRegisterDTO" />
Then you're on the right lines.. But you're nesting so you jsp needs to be more like
ComplRegisterDTO myObj = whatever...
theForm.set("myprop",myObj);
.. or if you dig beanutils
BeanUtils.copyProperties(theForm, myObj) ; //a bit silly in the this case,
<html:text property="myprop.fullname" />
......Other wise if you've got (recommended).
<form-property name="fullname" type="java.lang.String" /> <form-property name="mail" type="java.lang.String" />
DynaACtionForm theForm = (DynaActionForm) form;
theForm.set("fullname","Joe Bloggs"); theForm.set("mail","[EMAIL PROTECTED]");
Does this help?
Cheers MArk
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]