Your original question was on how to survive without the name-attribute in
the <html:form> tag.

The answer is that the later versions of taglib/struts dont allow you to use
the same Action-class on different ActionForms by changing the
name-attribute (since it has been removed).
You are now forced to have a mapping for every combination of
ActionForm/Action.

Since I dont know how your ActionForm-classes looks like I cant give you
exact help.
But wouldnt it be possible to share a ActionForm-class for the
edit/delete/search/create Actions?

> Yes, the flow is like this:
> 
> My struts config has this action for the search page:
> 
> <action path="/actionClient"
>         type="com.medina.web.action.ActionClientAction"
>         name="actionClientForm"
>         scope="session"
>         input="/searchClient.jsp">
>         <forward name="edit" path="/editClient.jsp"/>
>         <forward name="delete" path="/deleteClient.jsp"/>
>     </action>
> 
> This sends the actionclientForm to the actionclientaction class.
> 
> This class goes to the db gets the information then forwards 
> to editClient.jsp which has the action mapped:
> 
> <action path="/updateClient"
> > > > >         type="com.medina.web.action.UpdateClientAction"
> > > > >         name="createClientForm"
> > > > >         scope="session"
> 
> So when I tried to re cast it it threw a class cast because I 
> was trying to cast actionClientForm to createClientForm.  
> 
> The bean named createCleintForm is of class createClientForm 
> which is mapped in the form beans of config.xml.
> 
> Does the same still apply?
> 
> Thanks
> 
> -----Original Message-----
> From: Ekberg Mats KONSULT [mailto:[EMAIL PROTECTED] 
> Sent: 29 September 2005 11:02
> To: 'Struts Users Mailing List'
> Subject: SV: prepopulating jsp page
> 
> Ok, so you  have a different formbean coming in to this action:
> 
> > > > > <action path="/updateClient"
> > > > >         type="com.medina.web.action.UpdateClientAction"
> > > > >         name="createClientForm"
> > > > >         scope="session"
> 
> The bean named createClientForm is NOT of class CreateClientForm?
> 
> If you have a bean class other than the one mapped to the 
> executing action
> that you want to populate and later display in the 
> success-form, then you
> have to:
> 
> 1 create the bean
> 2 populate it
> 3 put it in page/request/session scope
> 4 return from action
> 5 in jsp, get the bean from the scope you put it in
> 
> 
> > -----Ursprungligt meddelande-----
> > Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> > Skickat: den 29 september 2005 11:55
> > Till: user@struts.apache.org
> > Ämne: RE: prepopulating jsp page
> > 
> > I cannot do the following 
> > 
> > CreateClientForm updateForm = (CreateClientForm)actionForm;
> > 
> > Because the action is called from a search page and has a 
> > different form coming in.  Thus when I try to reassign it I 
> > get a class cast exception.
> > 
> > I also tried the first way you mentioned, but that did not 
> > populate the form either.
> > 
> > 
> > -----Original Message-----
> > From: Ekberg Mats KONSULT 
> [mailto:[EMAIL PROTECTED] 
> > Sent: 29 September 2005 10:46
> > To: 'Struts Users Mailing List'
> > Subject: SV: prepopulating jsp page
> > 
> > I seen to be very fast and erronous today, try this:
> > 
> > 
> > 
> > public ActionForward execute(
> >       ActionMapping actionMapping,
> >       AtionForm actionForm, 
> >       HttpServletRequest httpServletRequest,
> >       HttpServletResponse httpServletResponse) throws Exception 
> >  
> >       CreateClientForm updateForm = (CreateClientForm)actionForm;
> > 
> >       // populate the bean here
> >       updateForm.setXXX( );
> >       updateForm.setYYY( );
> > 
> > 
> > 
> > > -----Ursprungligt meddelande-----
> > > Från: Ekberg Mats KONSULT 
> > [mailto:[EMAIL PROTECTED] 
> > > Skickat: den 29 september 2005 11:41
> > > Till: 'Struts Users Mailing List'
> > > Ämne: SV: prepopulating jsp page
> > > 
> > > 
> > > 
> > > > -----Ursprungligt meddelande-----
> > > > Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> > > > Skickat: den 29 september 2005 11:38
> > > > Till: user@struts.apache.org
> > > > Ämne: RE: prepopulating jsp page
> > > > 
> > > > Do this in your action:
> > > > 
> > > >    CreateClientForm updateForm = new CreateClientForm();
> > > >    // populate the bean here
> > > > 
> > > >    // then
> > > >    form = updateForm;
> > > > 
> > > > When you say 
> > > > 
> > > > form = updateForm;
> > > > 
> > > > what is my variable form of type?
> > > 
> > >   Form is the variable you got in your actions execute method:
> > > 
> > >     public ActionForward execute(ActionMapping actionMapping, 
> > > ActionForm
> > > actionForm, HttpServletRequest httpServletRequest, 
> > HttpServletResponse
> > > httpServletResponse) throws Exception 
> > > 
> > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Ekberg Mats KONSULT 
> > > [mailto:[EMAIL PROTECTED] 
> > > > Sent: 29 September 2005 10:34
> > > > To: 'Struts Users Mailing List'
> > > > Subject: SV: prepopulating jsp page
> > > > 
> > > > 
> > > > 
> > > > > -----Ursprungligt meddelande-----
> > > > > Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> > > > > Skickat: den 29 september 2005 11:26
> > > > > Till: user@struts.apache.org
> > > > > Ämne: prepopulating jsp page
> > > > > 
> > > > > Hi,
> > > > >  
> > > > > I am trying to pre-populate my JSP page with the values 
> > > > returned from
> > > > > the database when a user edits a client. I have just 
> > > > recently upgraded
> > > > > to Struts download 1.2.4.  
> > > > >  
> > > > > This is what I did before which worked: 
> > > > >  
> > > > > In my action class I created the form  then populated it with 
> > > > > the values
> > > > > from the DB.
> > > > >  
> > > > > CreateClientForm updateForm = new CreateClientForm();
> > > > 
> > > > Do this in your action:
> > > > 
> > > >    CreateClientForm updateForm = new CreateClientForm();
> > > >    // populate the bean here
> > > > 
> > > >    // then
> > > >    form = updateForm;
> > > > 
> > > > 
> > > > >  
> > > > >  
> > > > > My struts config sent the response to the jsp page where I 
> > > > > displayed the
> > > > > values as follows
> > > > >  
> > > > > <html:form action="/updateClient"
> > > > >   name="createClientForm"
> > > > >   type="com.medina.web.forms.CreateClientForm">
> > > > >  
> > > > > However in this new download the html tag library does not 
> > > > have a tag
> > > > > for name.  Thus I cannot add the name tag to the 
> html:form tag.
> > > > >  
> > > > > So my jsp now looks ike this:
> > > > >  
> > > > > <html:form action="/updateClient">
> > > > >  
> > > > > and my struts config.xml :
> > > > >  
> > > > > <action path="/updateClient"
> > > > >         type="com.medina.web.action.UpdateClientAction"
> > > > >         name="createClientForm"
> > > > >         scope="session"
> > > > >         parameter="update"
> > > > >         input="/editClient.jsp">
> > > > >         <forward name="failure" path="/jsp/failure.jsp"/>
> > > > >         <forward name="success" path="/jsp/success.jsp"/>
> > > > >     </action>
> > > > >  
> > > > > Can anyone please advise what I need to do to get these 
> > > > > values into the
> > > > > jsp page as it appears empty.  How do I get around this 
> > name tag?
> > > > >  
> > > > > Thanks
> > > > >  
> > > > > 
> > > > 
> > > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > > 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]
> > > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > 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]
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > 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]
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to