You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jonas Buechel <jo...@gartenmann.ch> on 2006/01/10 09:55:34 UTC
Problems with getting property from map-backed ActionForm
Hi there
I've got problem using map-backed ActionForm.
The following snippet is the html output:
<form name="shopTextForm" method="post" action="/shopAdmin/jsp/structure/saveShopText.do">
<input type="hidden" name="sqlname" value="shopadmin_shop_text_detail">
<table cellspacing="0">
<tr>
<td class="label">Textidentifer</td>
<td class="input">[todo]:8341=ablaufdatum
<input type="text" name="keyProperty(8341)" maxlength="20" value="">
</td>
<td class="filler"> </td>
</tr>
<tr>
<td class="label">Text<br> resultSet.getString("sprach_bezeichnung")</td>
<td class="input">[todo]:16501=ABLAUFDATUM
<textarea name="dataProperty(var)"></textarea>
</td>
<td class="filler"> </td>
</tr>
<tr>
<td class="label">Text<br> resultSet.getString("sprach_bezeichnung")</td>
<td class="input">[todo]:16502=DATE D'ECHÉANCE
<textarea name="dataProperty(var)"></textarea>
</td>
<td class="filler"> </td>
</tr>
<tr>
<td class="label"> </td>
<td class="input_button"><input type="submit" value="Speichern" /> <input type="button" onclick="history.back();" value="Abbrechen" /></td>
<td class="filler"> </td>
</tr>
</table>
</form>
Problem: "keyProperty(8341)" seems not to be interpreted from struts. But if I change keyProperty(8341) to something like keyPropblabla(8341), struts tells me there is no getter method..
So I'm quite confused. Can anybody give me some suggestions how to find a solution, please?
I couldn't find any help on the web, which resolves my problem..
The Jsp-Code snippet:
<html:form action="jsp/structure/saveShopText">
<html:hidden property="sqlname" value="shopadmin_shop_text_detail" />
<table cellspacing="0">
<c:forEach var="var" items="${DynamicForm.keyProperties}">
<tr>
<td class="label">Textidentifer</td>
<td class="input">[todo]:<c:out value='${var}'/>
<html:text property="keyProperty(8341)" maxlength="20" />
</td>
<td class="filler"> </td>
</tr>
</c:forEach>
<c:forEach var="var" items="${DynamicForm.dataProperties}">
<tr>
<td class="label">Text<br> resultSet.getString("sprach_bezeichnung")</td>
<td class="input">[todo]:<c:out value='${var}'/>
<html:textarea property="dataProperty(var)" />
</td>
<td class="filler"> </td>
</tr>
</c:forEach>
<tr>
<td class="label"> </td>
<td class="input_button"><input type="submit" value="Speichern" /> <input type="button" onclick="history.back();" value="Abbrechen" /></td>
<td class="filler"> </td>
</tr>
</table>
</html:form>
Map-backed form class snippet:
public void setKeyProperty(String key, Object value) {
keyProperties.put(key, value);
}
public Object getKeyProperty(String key) {
return keyProperties.get(key);
}
Action in struts-config.xml:
<action path="/jsp/structure/loadShopText" type="ch.gsa.struts.actions.DynamicLoadAction" name="shopTextForm" scope="request" input="/jsp/structure/enter.jsp">
<forward name="failure" path="/jsp/structure/enter_success.jsp" />
</action>
DynamicLoadAction.java code snipped:
DynamicForm dynamicForm = DynamicFormPopulate.createDynamicForm(sqlname, paramArray);
request.setAttribute("DynamicForm", dynamicForm);
Mit freundlichen Grüssen
Jonas Büchel
dipl. Informatiktechniker TS
---------------------------------------------------------
Gartenmann Software AG
Erdbuehlstrasse 17, CH-8472 Seuzach
Telefon +41 52 338 00 81
Fax +41 52 338 00 88
http://www.gartenmann.ch/
mailto:jonas.buechel@gartenmann.ch
---------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org