Je peux pré-remplir mon formulaire Stripes JSP avec un objet, client
dans mon cas, mais quand je soumets ce formulaire, mon objet est de retour nul.Stripes: Je peux pré-remplir un formulaire, mais après soumettre le formulaireBean est nul
J'ai créé un second objet « temp » qui est une copie parallèle de client
et cela conserve ses valeurs, donc je ne vois pas un problème qui passe un objet dans la demande
Ma forme est la suivante:
<s:form beanclass="com.jameselsey.salestracker.action.ViewClientAction">
<s:hidden name="clientA" value="${actionBean.clientA}"/>
<s:hidden name="clientId" value="${actionBean.clientId}"/>
<table>
<tr>
<td>Name : </td>
<td><s:text name="client.name"/></td>
</tr>
<tr>
<td>Sector : </td>
<td><s:text name="client.sector"/></td>
</tr>
<!-- omitted some attirbutes, not needed here -->
</table>
</s:form>
Mon action ressemble
public class ViewClientAction extends BaseAction
{
@SpringBean
ClientService clientService;// = new ClientService();
private Integer clientId;
private Client client;
private Client clientA;
public void setClient(Client client)
{
this.client = client;
}
public Integer getClientId()
{
return clientId;
}
public void setClientId(Integer clientId)
{
this.clientId = clientId;
}
public Client getClientA()
{
return clientA;
}
public void setClientA(Client clientA)
{
this.clientA = clientA;
}
public Client getClient()
{
return client;
}
@DefaultHandler
public Resolution quickView()
{
clientA = clientService.getClientById(clientId);
client = clientService.getClientById(clientId);
return new ForwardResolution("/jsp/viewClientQuickView.jsp");
}
public Resolution save()
{
clientService.persistClient(client);
return new ForwardResolution("/jsp/reports.jsp");
}
public Resolution viewClientInfo()
{
client = clientService.getClientById(clientId);
return new ForwardResolution("/jsp/viewClientClientInfo.jsp");
}
...
Si je mets un point d'arrêt à clientService.persistClient(client);
je peux voir que ClientA
a toutes les valeurs d'origine de l'objet, mais client
est annulé.
Ai-je manqué quelque chose qui lie le bean formulaire à l'objet client
dans mon action?
Merci