struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BinhMinh Nguyen <struts_informat...@yahoo.com>
Subject pre-populate and request scope problem in struts.
Date Tue, 21 Aug 2001 18:19:45 GMT
Hi,
I have the following problem, can anyone help me to
spot it.

I am using the following technique for pre-populate:

1- in the Action object   of 'fromJSP' , I create an
objetc of the Form objetc of the 'toJSP'
2-I then set all the properties  of the Form objetc of
the 'toJSP' here by calling the setters of this Form
object. As followed:

Partner partner = new Partner(tradingID,
fnDataSource);
					//get the product-list from a given partner
					String[] products = partner.getProducts();

					//pre=populating
					System.out.println("<RetailerMainAction>-
Data-Pre-Populating for form processForm");
					ProcessForm processForm = new ProcessForm();

					processForm.setProducts(products);
					System.out.println("<RetailerMainAction>- set
product-collection");

					processForm.setTradingID(tradingID);
					System.out.println("<RetailerMainAction>- set
partner-ID");

					request.setAttribute("processForm",processForm);
				
//the_session.setAttribute("processForm",processForm);
					System.out.println("<RetailerMainAction>- save
processForm bean");





3- set the Form object to the request scope.
				request.setAttribute("processForm",processForm);
										

4- then I give out the 'toJSP'

so far, every works perfectly. All the properies are
preloaded as expected.

<P>
<font color="green" size="+2">
   Trading ID&nbsp;<bean:write  name="processForm"
property="tradingID" scope="request"
/>(<%=user_name%>) 
</font>

<hr>
<table border="0" width="100%">
<tr><td colspan="2">&nbsp;</td></tr>
<tr>  
      
    <td align="left" width="10%">
       Product-Line:&nbsp;&nbsp;    
    </td>   
      
    <td align="left">
       <html:select property="selProduct" size="1" >
            <html:options property="products" />
       </html:select> 
       
    </td>
</tr>

5- then in the 'toJSP' I issue a command submit to g
oto the 'lastJSP'. The action forward the request is
defined in strut-config.xml as below:


<!-- Order -->
     <action     path="/main/order/order"
                
type="com.furnishnet.struts.OrderAction"
       	         name="orderForm"  
                 input="/main/order/order_screen.jsp" 
                 scope="request"
                 validate="false">
                
                <forward  name="confirm"            
path="/main/order/order_screen.jsp"/>
                <forward  name="process_edit"       
path="/main/operation/process_screen.jsp" />          
  
                
     </action>

In this 'lastJSP'   I have the button "Edit" which
bring the user back to the previous JSP, 'toJSP'.
But the serlvet raised an exception. There is
something wrong with the <select> tag and <option>
tag,
if I remove these tag from the JSP, before I
"come-back"  to this 'toJSP', nothing worng happens,
therefor, there must be something wrong with this
property and the Form that I save off the attribute

Can some one spot it out for me please.
  
really appreciate you help

Binh Nguyen
 

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Mime
View raw message