struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Barrows" <jbarr...@sssc.com>
Subject RE: can someone help me?
Date Thu, 08 Jul 2004 19:17:07 GMT
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ÿffffffffffe8ye [mailto:galoyabe@yahoo.fr]
> Sent: Thursday, July 08, 2004 2:14 AM
> To: struts-user@jakarta.apache.org
> 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
> <form-bean name="prospectForm"
> type="com.youcompany.struts.form.ProspectForm">
> <form-property name="emailDtP" type="java.lang.String"
> />
> <form-property name="emailRhP" type="java.lang.String"
> />
> <form-property name="phoneP" type="java.lang.String"
> />
> form-property name="nameP" type="java.lang.String" />
> <form-property name="addressP" type="java.lang.String"
> />
> <form-property name="faxP" type="java.lang.String" />
> <form-property name="emailGenP"
> type="java.lang.String" />
> <form-property name="idA" type="java.lang.String" />
> <form-property name="emailDcP" type="java.lang.String"
> />
> </form-bean>
> <action name="prospectForm" path="/editprospect"
> scope="request"
>         
> type="com.youcompany.struts.action.EditprospectAction"
> validate="false">
> <forward name="prospect" path="/prospect.jsp" />
> </action>
> 
> here is my prospect.jsp file
> 
>  <html:form action="/majprospect" name="prospectForm"
> type="com.youcompany.struts.form.ProspectForm">
> 		     <table border="0" width="100%">
> 		 
> 		
> 		       <tr> 
> 		           <th align="right">  
> 		        	   nameP 
> 		        	</th> 
> 		        	 <td align="left">
> 		        	      <html:text property="nameP"  
> readonly="false" size="16"
> maxlength="30"/><html:errors property="nameP"/>
> 		        	 </td> 
> 		       </tr> 
> 		       <tr>
> 		        	<th align="right">  
> 		        	       emailGenP 
> 		        	 </th> 
> 		        	 <td align="left">
> 		        	      <html:text property="emailGenP"
> size="16" maxlength="30"/><html:errors
> property="emailGenP"/>
> 		        	 </td>
> 		       </tr>	
> 		        <tr>
> 		        	<th align="right">
> 		        	   phoneP 
> 		        	</th> 
> 		        	<td align="left">
> 		        	     <html:text 
> property="phoneP" size="16"
> maxlength="15"/><html:errors property="phoneP"/>
> 		        	 </td>
> 		        </tr>
> 		         <tr>
> 		            <th align="right">	
> 		        	   emailRhP 
> 		        	</th>
> 		        	<td align="left">
> 		        	   <html:text 
> property="emailRhP" size="16"
> maxlength="30"/><html:errors property="emailRhP"/>
> 		        	</td>
> 		        </tr>
> 		        <tr>
> 		            <th align="right">
> 		        	    addressP 
> 		        	</th>
> 		        	<td align="left">
> 		              <html:text property="addressP"
> size="16" maxlength="50"/><html:errors
> property="addressP"/>
> 		            </td> 
> 		         </tr>	
> 		         <tr>
> 		             <th align="right">
> 		        	    emailDcP 
> 		        	 </th>
> 		        	 <td align="left">
> 		                <html:text property="emailDcP"
> size="16" maxlength="30"/><html:errors
> property="emailDcP"/>
> 		             </td>
> 		         </tr>	
> 		         <tr>
> 		             <th align="right">
> 			           emailDtP 
> 			          </th>
> 			          <td align="left">
> 			            <html:text property="emailDtP"
> size="16" maxlength="30"/><html:errors
> property="emailDtP"/>
> 			          </td>
> 			      </tr>  
> 			      <tr>
> 			         <th align="right">
> 			           faxP 
> 			         </th> 
> 			         <td align="left">
> 			           <html:text property="faxP" size="16"
> maxlength="15"/><html:errors property="faxP"/>
> 			         </td>
> 			       </tr> 
> 			       <tr>
> 			          <td align="right">
> 			               <html:submit/>
> 			           </td>
> 			           <td align="left">
> 			               <html:cancel/>
> 			           </td>
> 			       </tr> 
> 			    </table>
> 		      </html:form>
> 
> 
> 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 en direct avec vos amis grâce à Yahoo! Messenger 
> !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


Mime
View raw message