Re: can someone help me?

2004-07-08 Thread Denis Avdic
What is your action mapping for majprospect action?

Since your form is going to be submitted to majprospect.do (you need
to add .do in there)  your action mapping should basically have a
name="prospectForm" in it.

Also, to make sure your form is being named correctly:

request.setAttribute("prospectForm", form);  
(if you are setting the form in request, make sure that the action
mapping for majprospect also has scope="request" otherwise it will be
looking for the form in the wrong scope)

I assume that the form has values prepopulated  already and that you
have checked that before you exit that action all the values that need
to be there are there.

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



Re: can someone help me?

2004-07-08 Thread Wendy Smoak
From: "KEBE Cheikh Silÿffe8ye" <[EMAIL PROTECTED]>
> In my editProspectAction.java, i do
> public ActionForward execute(
> ActionMapping mapping,
> ActionForm form,
   ^

Populate the 'form' that is passed into the method, don't create a new one:

> form=new ProspectForm();
> form=prospect;
> request.setAttribute(mapping.getAttribute(),form);

Actually I'm not certain what's going on in those three lines.  Take a look
at the struts-example webapp, it shows how to pre-populate a form using
BeanUtils.copyProperties.

It goes something like...
1. read Value Object from database
2. copy matching properties over to form bean
3. forward to JSP

-- 
Wendy Smoak


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



RE: can someone help me?

2004-07-08 Thread Jim Barrows
The short answer is read the java documentation better...
you don't do a new Form().  That won't work for reasons related to Java and passing 
variables.
In your struts-config.xml you should set the name, and probably validation=false.
Then something like:
MyForm myForm = (MyForm) form 
myForm.setThisField( some.getData());
return mapping.findForward("dearGodItWorked");
in your action class will fill it nicely.


> -Original Message-
> From: KEBE Cheikh Silÿffe8ye [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 08, 2004 2:14 AM
> To: [EMAIL PROTECTED]
> Subject: can someone help me?
> 
> 
> hi,
> i have an action class that calls a business object
> (prospect). And i want to display the information for
> a prospect in a form in jsp file (prospect.jsp)
>  Here is my struts-config.xml
>  type="com.youcompany.struts.form.ProspectForm">
>  />
>  />
>  />
> form-property name="nameP" type="java.lang.String" />
>  />
> 
>  type="java.lang.String" />
> 
>  />
> 
>  scope="request"
> 
> type="com.youcompany.struts.action.EditprospectAction"
> validate="false">
> 
> 
> 
> here is my prospect.jsp file
> 
>   type="com.youcompany.struts.form.ProspectForm">
>
>
>   
>   
>
>  nameP 
>
>
>  readonly="false" size="16"
> maxlength="30"/>
> 
>   
>  
> 
>  emailGenP 
> 
>
>  size="16" maxlength="30"/> property="emailGenP"/>
>
>  
>   
>   
>  phoneP 
>
>   
> property="phoneP" size="16"
> maxlength="15"/>
>
>   
>
> 
>  emailRhP 
>   
>   
>   property="emailRhP" size="16"
> maxlength="30"/>
>   
>   
>   
>   
>   addressP 
>   
>   
>  size="16" maxlength="50"/> property="addressP"/>
>
>  
>
>
>   emailDcP 
>
>
>size="16" maxlength="30"/> property="emailDcP"/>
>
>  
>
>
>  emailDtP 
> 
> 
>size="16" maxlength="30"/> property="emailDtP"/>
> 
>   
> 
>
>  faxP 
> 
>
>   maxlength="15"/>
>
>   
>  
> 
>  
>  
>  
>  
>  
>   
>   
> 
> 
> 
> In my editProspectAction.java, i do 
> 
> public ActionForward execute(
>   ActionMapping mapping,
>   ActionForm form,
>   HttpServletRequest request,
>   HttpServletResponse response)
>   throws Exception {
> ProspectForm prospect=new ProspectForm();
> // here, i ask my db for retrieving a prospect 
> .
> 
> form=new ProspectForm();
> form=prospect;
> request.setAttribute(mapping.getAttribute(),form);
> return (mapping.findForward("prospect"));
> }
> 
> 
> when i do editprospect.do, the prospect.jsp is
> displayed but the prospect data are not pre populate.
> can someone help me?
> thant
> 
> =
> Cheikh Silèye KEBE
> 
> 
> 
>   
> 
>   
>   
> Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
> 
> Dialoguez e