You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Frederic Dernbach <fr...@free.fr> on 2003/10/03 12:14:46 UTC

Help drasticaly needed ; indexed properties

I recently asked for some help on indexed properties and I still some
assistance. However, I made some progress in the understanding of the
issue. I traced the Struts source code to understand a little better why
I'm loosing collection date in between Struts actions.

I have a very simple JSP (not using struts-layout here since I wanted to
test the most simple example possible). It uses a 'signals' property of
a my form names 'strategyForm'. See below.

When I hit the validate button, I have lost the 'signals' property. I
debugged Strsts source files and I realized that the request does not
have the 'signals' parameter (RequestUtils.populate() which calls
BeanUtils.populate() ).

==> QUESTIONS 
- How do I make sure that an indexed property will be populated in the
form of a Struts action
- How to I make sure in the JSP file that the 'signals' property in the
HTML form ? Should I add a hidden field ? But how ?

Any response will be appreciated.

Below, you will find the entire JSP file and the relevant part of my
strategy form source code.

Thanks in advance for your help.

Fred


<html>
<head>
<title>Test Indexed property</title>
</head>
<body>
	
	<html:form action="/DisplayStrategy.do?reqCode=display">

		<html:text property="code" />
		<html:text property="label" />
		<html:hidden property="itemCount" />
		
		<table width="650" border="0" cellspacing="0" cellpadding="0">
			<tr align="left">
				<th>Order</th>
				<th>Code</th>
			</tr>
			
			<logic:iterate id="orderedSignal" name="strategyForm"
property="signals">
				<tr align="left">
					<td>
						<bean:write name="orderedSignal" property="order"/>
					</td>
					<td>
						<bean:write name="orderedSignal" property="signal.code"/>
					</td>
				</tr>
			</logic:iterate>
			
			<html:submit>Validate</html:submit>
			
		</table>	
		
	</html:form>

</body>
</html>

import com.rubis.web.system.OrderedSignalBean;

public class StrategyForm extends ValidatorActionForm implements
java.io.Serializable {
	
	public OrderedSignalBean getSignals(int index) {
		return signals[index];
	}
	public OrderedSignalBean[] getSignals() {
		return signals;
	}
	public void setSignals(int index, OrderedSignalBean signal) {
		signals[index] = signal;
	}
	public void setSignals(OrderedSignalBean[] array) {
		this.signals = array;
	}
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getLabel() {
		return this.label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		
		this.code 		= null;
		this.label		= null;
		this.signals		= null;
	}	



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