struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Struts and Hibernate
Date Tue, 04 Jul 2006 06:42:10 GMT
Hi David,

there is no default mechanism to get struts to manipulate a Hibernate pojo with child objects
like that. You have to manually find the user from lesUtilisateurs and then set it on the
Task. You can do the read automatically though using dot notation as you have already tried.


Adam

DOUILLARD David on 03/07/06 08:02, wrote:
> Hello,
> 
> I'm working on struts and hibernate. J'ai une tache qui est affectée à un
> utilisateur.
> 
> I have a Actionform named Task.
> 
> Private Integer code ;
> Private String codeus ; // Login of user
> Private String libelle;
> 
> 
> I have also a POJO Task.
> 
> Private Integer code;
> Private User user;  // Many-to-one relation with user Class.
> Private String libelle;
> 
> 
> And I have a action class which gets back my user's list to show it in a
> combobox in my jsp when i create a task. 
> 
> Code :
> <html:select property="codeus">
>    <html:options property="codeus" collection="lesUtilisateurs"
> labelProperty="nom">
> </html:select>
> 
> The code above allows me to show a comobox with the names of my users. The
> parameter sent to get back the user is codeus. Up to there, it works. After
> recording in my database, my problem is to show the user allocated to the
> task in modify.jsp.
> 
> If i do
> 
> Code :
> <html:select property="codeus" name="tache">
>    <html:options property="codeus" collection="lesUtilisateurs"
> labelProperty="nom">
> </html:select>
> 
> my user recording in database is not selected by default.
> 
> If I do 
> 
> <html:select property="utilisateur.codeus" name="tache">
>    <html:options property="codeus" collection="lesUtilisateurs"
> labelProperty="nom">
> </html:select>
> 
> My user is selected, but the actionform doesn't recognize my attribute
> utilisateur.codeus because it wants codeus
> 
> Does it mean that my actionform must have utilisateur.codeus as attribute ?


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


Mime
View raw message