You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2005/11/14 21:34:49 UTC

initialize dynaform

Is it possible to initialize dynaform?

and how can this be done?

Thanks.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


Re: initialize dynaform

Posted by Michael Jouravlev <jm...@gmail.com>.
See also http://marc.theaimsgroup.com/?l=struts-dev&m=112916036300196&w=2

On 11/14/05, Niall Pemberton <ni...@blueyonder.co.uk> wrote:
> Yes, using the "initial" attribute for a form property in the
> struts-config.xml...
>
> <form-bean name="myForm" type="org.apache.struts.action.DynaActionForm">
>     <form-property name="myProp" type="java.lang.Boolean" initial="true" />
> </form-bean>
>
> Niall
>
> ----- Original Message -----
> From: "fea jabi" <zy...@hotmail.com>
> To: <us...@struts.apache.org>
> Sent: Monday, November 14, 2005 8:34 PM
> Subject: initialize dynaform
>
>
> > Is it possible to initialize dynaform?
> >
> > and how can this be done?

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


Re: initialize dynaform

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Yes, using the "initial" attribute for a form property in the
struts-config.xml...

<form-bean name="myForm" type="org.apache.struts.action.DynaActionForm">
    <form-property name="myProp" type="java.lang.Boolean" initial="true" />
</form-bean>

Niall

----- Original Message ----- 
From: "fea jabi" <zy...@hotmail.com>
To: <us...@struts.apache.org>
Sent: Monday, November 14, 2005 8:34 PM
Subject: initialize dynaform


> Is it possible to initialize dynaform?
>
> and how can this be done?
>
> Thanks.



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


Re: initialize dynaform

Posted by Michael Jouravlev <jm...@gmail.com>.
http://www.catb.org/~esr/faqs/smart-questions.html#beprecise
http://www.catb.org/~esr/faqs/smart-questions.html#volume
http://www.catb.org/~esr/faqs/smart-questions.html#id3001578
http://www.catb.org/~esr/faqs/smart-questions.html#homework

On 11/15/05, fea jabi <zy...@hotmail.com> wrote:
> thankyou for your resposes. But where do I have to write this code? Is it in
> the Action that prepares the jsp data before it gets launched?
>
> I did not write the below and getting
>
> javax.servlet.ServletException: No getter method for property custName of
> bean org.apache.struts.taglib.html.BEAN
>         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
>
> I am trying to use the dynaform for the first time and having challenges
> with it.
>
> Thanks.

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


Re: initialize dynaform

Posted by Michael Jouravlev <jm...@gmail.com>.
Whoa. Even if you knew nothing about Struts, what do you think this
typecast and immediate return gives you:

>   DynaActionForm Form1 = (DynaActionForm) form;
>   return mapping.findForward("success");

Try to use the type that you are supposed to use:

<form-bean
        name="Form1"
        type="org.apache.struts.action.DynaActionForm" dynamic="true">
        <form-property name="custName" type="java.lang.String"/>
</form-bean>

also use <html:form> around your table, because <html:text> builds an
input element of an HTML form (you may need it for input later) and
because Struts implicitly refers to action form that corresponds to
the action that is referenced in <html:form> tag. It is easier to use
"name" attribute in your input controls like:

<html:text name="Form1" property="custName" size="40"
styleClass="invisibleInput" readonly="true" tabindex="-1"/>

Try to search the Net for DynaActionForm for a change. There are
plenty of examples around.

Michael.

On 11/15/05, fea jabi <zy...@hotmail.com> wrote:
> sorry, if I am not clear enough in my posts
>
> For now I am just just trying to lauch the jsp with all blank values.
>
> I am using dynaform beans.
>
>
> <form-bean
>         name="Form1"
>         type="com.formbeans.Form1" dynamic="true">
>         <form-property name="custName" type="java.lang.String"/>
> </form-bean>
>
> <tr>
>                     <td>
>                         <bean:message key="lbl.customername"/> <bean:message
> key="colon"/>
>                     </td>
>                     <td>
>                         <html:text property="custName" size="40"
> styleClass="invisibleInput" readonly="true" tabindex="-1"/>
>                     </td>
>                     <td></td>
>                 </tr>
>
>
> PrepareForm1Action class has ---
> public ActionForward execute(ActionMapping mapping,
>                                ActionForm form,
>                                HttpServletRequest request,
>                                HttpServletResponse response)
>                        throws ServletException, IOException{
>   DynaActionForm Form1 = (DynaActionForm) form;
>   return mapping.findForward("success");
>      }
>
> <action
>         path="/PrepareForm1Action"
>         type="com.actions.PrepareForm1Action"
>         name="Form1"
>         scope="session"
>         validate="false"
>         input="/pages/Form1.jsp">
>         <forward name="success" path="/pages/Form1.jsp" redirect="false"/>
>      </action>
>
>
> I am getting error
> javax.servlet.ServletException: No getter method for property custName of
> bean org.apache.struts.taglib.html.BEAN
>         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
>
>
> I do have to prepopulate my Jsp with some values later. To do this where do
> I have to write?
> ModuleConfig moduleConfig =
> >RequestUtils.getModuleConfig(request,
> >getServlet().getServletContext());
> >     FormBeanConfig formConfig =
> >
> >moduleConfig.findFormBeanConfig("your_form_name");
> >     DynaActionFormClass dynaClass =
> >
> >DynaActionFormClass.createDynaActionFormClass(formConfig);
> >
> >     try {
> >       myForm = (DynaActionForm)
> >dynaClass.newInstance();
> >     }
> >     catch (Exception e) {
> >       logger.error(e);
> >     }
>
>
>
> Thanks.
>
> >From: Richard Yee <ry...@yahoo.com>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: Struts Users Mailing List <us...@struts.apache.org>
> >Subject: Re: initialize dynaform
> >Date: Mon, 14 Nov 2005 13:10:15 -0800 (PST)
> >
> >Fea,
> >To initialize a dynaform staticly, do as Niall
> >suggested. To dynamically pre-populate a dynaform, you
> >need code to do it as follows:
> >
> >     ModuleConfig moduleConfig =
> >RequestUtils.getModuleConfig(request,
> >getServlet().getServletContext());
> >     FormBeanConfig formConfig =
> >
> >moduleConfig.findFormBeanConfig("your_form_name");
> >     DynaActionFormClass dynaClass =
> >
> >DynaActionFormClass.createDynaActionFormClass(formConfig);
> >
> >     try {
> >       myForm = (DynaActionForm)
> >dynaClass.newInstance();
> >     }
> >     catch (Exception e) {
> >       logger.error(e);
> >     }
> >
> >
> >Regards,
> >
> >Richard
> >
> >
> >--- fea jabi <zy...@hotmail.com> wrote:
> >
> > > Is it possible to initialize dynaform?
> > >
> > > and how can this be done?
> > >
> > > Thanks.

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


Re: initialize dynaform

Posted by fea jabi <zy...@hotmail.com>.
thankyou for your resposes. But where do I have to write this code? Is it in 
the Action that prepares the jsp data before it gets launched?

I did not write the below and getting

javax.servlet.ServletException: No getter method for property custName of 
bean org.apache.struts.taglib.html.BEAN
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)

I am trying to use the dynaform for the first time and having challenges 
with it.

Thanks.

>From: Richard Yee <ry...@yahoo.com>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: Struts Users Mailing List <us...@struts.apache.org>
>Subject: Re: initialize dynaform
>Date: Mon, 14 Nov 2005 13:10:15 -0800 (PST)
>
>Fea,
>To initialize a dynaform staticly, do as Niall
>suggested. To dynamically pre-populate a dynaform, you
>need code to do it as follows:
>
>     ModuleConfig moduleConfig =
>RequestUtils.getModuleConfig(request,
>getServlet().getServletContext());
>     FormBeanConfig formConfig =
>
>moduleConfig.findFormBeanConfig("your_form_name");
>     DynaActionFormClass dynaClass =
>
>DynaActionFormClass.createDynaActionFormClass(formConfig);
>
>     try {
>       myForm = (DynaActionForm)
>dynaClass.newInstance();
>     }
>     catch (Exception e) {
>       logger.error(e);
>     }
>
>
>Regards,
>
>Richard
>
>
>--- fea jabi <zy...@hotmail.com> wrote:
>
> > Is it possible to initialize dynaform?
> >
> > and how can this be done?
> >
> > Thanks.
> >
> >
>_________________________________________________________________
> > Express yourself instantly with MSN Messenger!
> > Download today - it's FREE!
> >
>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> >
>---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> >
>
>
>
>
>__________________________________
>Start your day with Yahoo! - Make it your home page!
>http://www.yahoo.com/r/hs
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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


Re: initialize dynaform

Posted by fea jabi <zy...@hotmail.com>.
sorry, if I am not clear enough in my posts

For now I am just just trying to lauch the jsp with all blank values.

I am using dynaform beans.


<form-bean
        name="Form1"
        type="com.formbeans.Form1" dynamic="true">
        <form-property name="custName" type="java.lang.String"/>
</form-bean>

<tr>
                    <td>
                        <bean:message key="lbl.customername"/> <bean:message 
key="colon"/>
                    </td>
                    <td>
                        <html:text property="custName" size="40" 
styleClass="invisibleInput" readonly="true" tabindex="-1"/>
                    </td>
                    <td></td>
                </tr>


PrepareForm1Action class has ---
public ActionForward execute(ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
                       throws ServletException, IOException{
  DynaActionForm Form1 = (DynaActionForm) form;
  return mapping.findForward("success");
     }

<action
        path="/PrepareForm1Action"
        type="com.actions.PrepareForm1Action"
        name="Form1"
        scope="session"
        validate="false"
        input="/pages/Form1.jsp">
        <forward name="success" path="/pages/Form1.jsp" redirect="false"/>
     </action>


I am getting error
javax.servlet.ServletException: No getter method for property custName of 
bean org.apache.struts.taglib.html.BEAN
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)


I do have to prepopulate my Jsp with some values later. To do this where do 
I have to write?
ModuleConfig moduleConfig =
>RequestUtils.getModuleConfig(request,
>getServlet().getServletContext());
>     FormBeanConfig formConfig =
>
>moduleConfig.findFormBeanConfig("your_form_name");
>     DynaActionFormClass dynaClass =
>
>DynaActionFormClass.createDynaActionFormClass(formConfig);
>
>     try {
>       myForm = (DynaActionForm)
>dynaClass.newInstance();
>     }
>     catch (Exception e) {
>       logger.error(e);
>     }



Thanks.

>From: Richard Yee <ry...@yahoo.com>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: Struts Users Mailing List <us...@struts.apache.org>
>Subject: Re: initialize dynaform
>Date: Mon, 14 Nov 2005 13:10:15 -0800 (PST)
>
>Fea,
>To initialize a dynaform staticly, do as Niall
>suggested. To dynamically pre-populate a dynaform, you
>need code to do it as follows:
>
>     ModuleConfig moduleConfig =
>RequestUtils.getModuleConfig(request,
>getServlet().getServletContext());
>     FormBeanConfig formConfig =
>
>moduleConfig.findFormBeanConfig("your_form_name");
>     DynaActionFormClass dynaClass =
>
>DynaActionFormClass.createDynaActionFormClass(formConfig);
>
>     try {
>       myForm = (DynaActionForm)
>dynaClass.newInstance();
>     }
>     catch (Exception e) {
>       logger.error(e);
>     }
>
>
>Regards,
>
>Richard
>
>
>--- fea jabi <zy...@hotmail.com> wrote:
>
> > Is it possible to initialize dynaform?
> >
> > and how can this be done?
> >
> > Thanks.
> >
> >
>_________________________________________________________________
> > Express yourself instantly with MSN Messenger!
> > Download today - it's FREE!
> >
>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> >
>---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> >
>
>
>
>
>__________________________________
>Start your day with Yahoo! - Make it your home page!
>http://www.yahoo.com/r/hs
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


Re: initialize dynaform

Posted by Richard Yee <ry...@yahoo.com>.
Fea,
To initialize a dynaform staticly, do as Niall
suggested. To dynamically pre-populate a dynaform, you
need code to do it as follows:

    ModuleConfig moduleConfig =
RequestUtils.getModuleConfig(request,
getServlet().getServletContext());
    FormBeanConfig formConfig = 
           
moduleConfig.findFormBeanConfig("your_form_name");
    DynaActionFormClass dynaClass =
           
DynaActionFormClass.createDynaActionFormClass(formConfig);
        
    try {
      myForm = (DynaActionForm)
dynaClass.newInstance();
    }
    catch (Exception e) {
      logger.error(e);
    }


Regards,

Richard


--- fea jabi <zy...@hotmail.com> wrote:

> Is it possible to initialize dynaform?
> 
> and how can this be done?
> 
> Thanks.
> 
>
_________________________________________________________________
> Express yourself instantly with MSN Messenger!
> Download today - it's FREE! 
>
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs

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