Thank you for your quick reply.

I use dyna form. Therefore i have to create a new instance of the dynaform.



//get the parameter I want to put by default
String secteurDefault = request.getParameter("secteur");
if(secteurDefault!=null)
{
 if(form == null)
 {
FormBeanConfig cfg = mapping.getModuleConfig().findFormBeanConfig("CorrespondanceForm"); form = (CorrespondanceForm) DynaActionFormClass.createDynaActionFormClass(cfg).newInstance();
 }
//form = (DynaActionForm)form;
 form.set("partner_id",secteurDefault);
}


But the "form.set ..." doesn't work. Why ?

Second question : how do i put the form in a scope to be taken into account by the jsp ?


Thibaut wrote the following on 1/19/2006 1:09 PM:

Hi,

I'd like to choose the default value of my html:select in the action class. What is the parameter to set ?


Set the value of the form bean property in your Action before you go to the form and that will be the default. Or, you could even set the value in the formBean itself if you know it's always going to be the same default value.

ie in Action:

MyForm myForm = (MyForm)form;
myForm.setPartner_id( defaultId );

in ActionForm:

int partner_id = 20; //or whatever you want it to be



Action :

request.setAttribute("partnerslist", getPartnerListFromDataBase(dataSource));


JSP:

       <html:select property="partner_id">
<html:options collection="partnerslist" property="value" labelProperty="label"/>
       </html:select>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to