db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thoralf Rickert" <thoralf.rick...@cadooz.de>
Subject AW: If you "Struts", how do you validate?
Date Mon, 22 May 2006 12:52:21 GMT
Hi,

another solution could be to add the torque object to a struts form bean. For example: 

<form-bean name="AbsenceForm" type="org.apache.struts.action.DynaActionForm">
  <form-property name="item"   type="framework.database.ExampleTableItem"/>
  <form-property name="action" type="java.lang.String"/>
 ...
</form-bean>

So, you can read every property from the torque object and you can write directly into it
with a form submit by using something like <input type="text" name="item.name" value="..."/>.
Of course this is a security hole as Thomas wrote. But it's simple to replace the framework.database.ExampleTableItem
with a wrapper or extended class that controls the access to the properties.

Bye
Thoralf


> -----Urspr√ľngliche Nachricht-----
> Von: Thomas Fischer [mailto:fischer@seitenbau.net] 
> Gesendet: Montag, 22. Mai 2006 14:38
> An: Apache Torque Users List
> Betreff: RE: If you "Struts", how do you validate?
> 
> 
> Hi,
> 
> I do not use the Torque Data Objects as Struts form beans. 
> Instead, the struts action map those into each other. This 
> choice probably is non-standard but is founded in the kind of 
> application where I use Struts and Torque:  The data model 
> and the user screens often do not contain the same data. And 
> if the data ist the same and is editable by the user, the 
> user is e.g. not allowed to edit all fields (and the user 
> should under no circumstances be able to edit the fields he 
> is not allowed to edit, not even by sending "false posts"). 
> So I found it convenient to separate the data the user can 
> edit (struts beans) from the data in the data model (Torque 
> data objects) and the struts action knows how to map those 
> into one another. However, I would not consider this "best 
> practice" for all Struts-Torque applications, and maybe it is 
> not even the best choice for my applications, but it works.
> 
>      Thomas
> 
> Federico Fissore <federico.fissore@concept.it> schrieb am 21.05.2006
> 19:26:49:
> 
> > Hello list,
> >
> > I want to ask you a "best practice" question.
> >
> > I'm quite new to Struts and Torque and I'm having good experiences. 
> > Where I work, my colleagues are used in modifying the BaseObject to 
> > make it extend the ValidatorForm class of Struts. Then they 
> make all 
> > their tables have their own BaseObject as the baseClass in order to 
> > obtain Struts validation for free. I think of this as dirty but 
> > functional.
> >
> > But I see Struts has its BeanValidatorForm class, that *adapts* a 
> > "legacy" bean in order to *add* validation. Much cleaner 
> but awkward 
> > as this leads you to write more code.
> >
> > So my question is: how are you used to? and: do you have a best 
> > practice?
> >
> > Thank you all
> >
> > Federico
> > --
> > Concept - shaping technology
> >
> > Federico Fissore
> > Developer
> > federico.fissore@concept.it
> > http://www.concept.it
> >
> > Concept S.r.l - via F.Tamagno, 3 - 20124 - Milano
> > tel: +39 0229536401
> > fax: +39 0220402984
> >
> > E-Mail Disclaimer
> > This message contains confidential information and is intended only 
> > for the individual named. If you are not the named addressee you 
> > should not disseminate, distribute or copy this e-mail. 
> Please notify 
> > the sender immediately by e-mail if you have received this 
> e-mail by 
> > mistake and delete this e-mail from your system. E-mail 
> transmission 
> > cannot be guaranteed to be secure or error-free as 
> information could 
> > be intercepted, corrupted, lost, destroyed, arrive late or 
> incomplete, 
> > or contain viruses. The sender therefore does not accept 
> liability for 
> > any errors or omissions in the contents of this message, 
> which arise 
> > as a result of e-mail transmission.
> >
> > If verification is required please request a hard-copy version. 
> > Concept Srl, via F. Tamagno,3 - 20124 Milan - Italy - www.concept.it
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 



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


Mime
View raw message