Hi,
 
I have another simple question here.
 
I want to setup jsp pages to update a List<object>, e.g. searchParameters 
 
In my Action class I have:
 
public class SearchParameterAction implements Preparable {
private SearchParameterService service;
private List<SearchParameter> searchParameters;
 
In the main.jsp page:
 
<s:url action="parameterlist" id="parlistUrl">
<s:param name="orderid" value="%{#parameters.search_order_id}" />
</s:url>
<div id="search_parameters">
<div style="text-align: right;">
<s:a theme="ajax" notifyTopics="/refresh">Refresh</s:a>
</div>
<s:div id="searchParameters" theme="ajax" href="%{parlistUrl}" 
loadingText="Loading..." listenTopics="/refresh"/>
</div>
 
In the list.jsp:
 
<%@ taglib prefix="s" uri="/struts-tags"%>
<h2>Search Parameters </h2>
<s:if test="searchParameters.size > 0">
<table>
<s:iterator value="searchParameters">
<table id="row_<s:property value="search_parameter_id"/>">
<s:textfield id="search_parameter_id" name="search_parameter_id" 
cssStyle="display:none"/>
<s:textfield id="search_order_id" name="search_order_id" 
cssStyle="display:none"/>
<s:textfield id="search_name" label="Search Name" name="search_name" size="30" 
maxlength="90"/>
<s:textfield id="surname" label="Surname" name="surname" size="30" 
maxlength="90"/>
<s:textfield id="forenames" label="Forenames" name="forenames" size="30" 
maxlength="90"/>
<s:textfield id="address" label="Address" name="address" size="55" 
maxlength="90"/>
<s:url id="removeUrl" action="removeparameter">
<s:param name="id" value="search_parameter_id" />
<s:param name="orderid" value="search_order_id" />
</s:url>
<s:a href="%{removeUrl}" theme="ajax" targets="searchParameters">Remove</s:a>
</table> 
</s:iterator>
</table>
</s:if>
 
Now, I want to change some values in the text fields and update the database 
afterward. The questions are:
 
1. Is my object searchParameters actually bound to the text fields? If it 
isn't, how to do the data binding?
 
2. When I issue a update action, how can I access the searchParameters object 
in the Action class? In Struts 1, one can access it via requst.getParameter() 
method. What should I do in the Struts 2?
 
 Thanks in advance for your help,
Willa


       
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

Reply via email to