You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nick Heudecker <ni...@systemmobile.com> on 2004/04/23 08:27:33 UTC

Re: generate struts ActionForm & strut's jsp from hibernate's map ping

Some people use the @struts.form XDoclet tags to create their form classes,
although I wasn't able to get it to work with non-EJB classes.  I've written
an XDoclet extension to create dynamic form bean definitions to get around
this.

Your problem is that you're going from HBM > Java Bean > Form Bean, while
XDoclet is Java Bean > (HBM, DynaForm Bean Definition).  You could hit the
HBM files with some XSL to create your form beans, however.  Shouldn't be too
hard and others may find it useful.



On 2004-Apr-23 13:04, Dionisius Purba wrote:
> David, It works perfectly fine.
> You see, based on, for instance, Person.hbm.xml,
> hbm2java will generate Person.java
> but since I use struts, I still need to generate PersonForm.java
> and Person.jsp 
> 
> PersonForm would be very similar to Person.java, with the difference is that
> in PersonForm, all fields's type (firstName, lastName, age) 
> become String. 
> 
> Then in the AddPerson.jsp I will have something repeated like this:
> <html:text property="firstName"/>
> <html:text property="lastName"/>
> <html:text property="age"/>
> 
> Is there anyone outthere who makes tool for such thing?
> It should not be very difficult to make one, but I just want to avoid
> reinvent the wheel.
> 
> regards,
> Dion
> 
> -----Original Message-----
> From: David Friedman [mailto:humble@ix.netcom.com]
> Sent: Friday, April 23, 2004 1:30 PM
> To: Struts Users Mailing List
> Subject: RE: generate struts ActionForm & strut's jsp from hibernate's
> mapping
> 
> 
> What's wrong with the hibernate extension tools
> and the Code Generator that creates .java files from
> the hbm.xml files you give it?
> 
> See:
> http://prdownloads.sourceforge.net/hibernate/?sort_by=date&sort=desc
> Item: hibernate-extensions-2.1.zip (or the 2.0.2 zip file for 2.0.X
> versions)
> 
> I've only used the extension's hbm2java program, not the other way around.
> Now that I'm using Xdoclet, I have no further need for those extension
> tools.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Dionisius Purba [mailto:Dionisius.Purba@mitrais.com]
> Sent: Friday, April 23, 2004 1:21 AM
> To: 'Struts Users Mailing List'
> Subject: generate struts ActionForm & strut's jsp from hibernate's
> mapping
> 
> 
> Altough my question is related to hibernate, I hope it's still relevant.
> Is anyone aware of tools, open source is better, that can generate
> ActionForm and the JSP's (containing struts's HTML Input tag)
> based on a hibernate's mapping (i.e. *.hmb.xml)?
> 
> cheers,
> dion
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

-- 
Nick Heudecker
System Mobile, Inc.
Email: nick@systemmobile.com
Web: http://www.systemmobile.com

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


RE: generate struts ActionForm & strut's jsp from hibernate's map ping

Posted by David Friedman <hu...@ix.netcom.com>.
Nick,

I'm new to Xdoclet but in my class I used a @struts.form tag and it only
seemed to add entries in the struts-config.xml file Xdoclet created.  You
sound like you're suggesting Xdoclet can make a String-based derived form
class based on my bean/java class.  Can you provide and example?

Regards,
David

-----Original Message-----
From: Nick Heudecker [mailto:nick@systemmobile.com]
Sent: Friday, April 23, 2004 2:28 AM
To: Struts Users Mailing List
Subject: Re: generate struts ActionForm & strut's jsp from hibernate's
map ping


Some people use the @struts.form XDoclet tags to create their form classes,
although I wasn't able to get it to work with non-EJB classes.  I've written
an XDoclet extension to create dynamic form bean definitions to get around
this.

Your problem is that you're going from HBM > Java Bean > Form Bean, while
XDoclet is Java Bean > (HBM, DynaForm Bean Definition).  You could hit the
HBM files with some XSL to create your form beans, however.  Shouldn't be
too
hard and others may find it useful.



On 2004-Apr-23 13:04, Dionisius Purba wrote:
> David, It works perfectly fine.
> You see, based on, for instance, Person.hbm.xml,
> hbm2java will generate Person.java
> but since I use struts, I still need to generate PersonForm.java
> and Person.jsp
>
> PersonForm would be very similar to Person.java, with the difference is
that
> in PersonForm, all fields's type (firstName, lastName, age)
> become String.
>
> Then in the AddPerson.jsp I will have something repeated like this:
> <html:text property="firstName"/>
> <html:text property="lastName"/>
> <html:text property="age"/>
>
> Is there anyone outthere who makes tool for such thing?
> It should not be very difficult to make one, but I just want to avoid
> reinvent the wheel.
>
> regards,
> Dion
>
> -----Original Message-----
> From: David Friedman [mailto:humble@ix.netcom.com]
> Sent: Friday, April 23, 2004 1:30 PM
> To: Struts Users Mailing List
> Subject: RE: generate struts ActionForm & strut's jsp from hibernate's
> mapping
>
>
> What's wrong with the hibernate extension tools
> and the Code Generator that creates .java files from
> the hbm.xml files you give it?
>
> See:
> http://prdownloads.sourceforge.net/hibernate/?sort_by=date&sort=desc
> Item: hibernate-extensions-2.1.zip (or the 2.0.2 zip file for 2.0.X
> versions)
>
> I've only used the extension's hbm2java program, not the other way around.
> Now that I'm using Xdoclet, I have no further need for those extension
> tools.
>
> Regards,
> David
>
> -----Original Message-----
> From: Dionisius Purba [mailto:Dionisius.Purba@mitrais.com]
> Sent: Friday, April 23, 2004 1:21 AM
> To: 'Struts Users Mailing List'
> Subject: generate struts ActionForm & strut's jsp from hibernate's
> mapping
>
>
> Altough my question is related to hibernate, I hope it's still relevant.
> Is anyone aware of tools, open source is better, that can generate
> ActionForm and the JSP's (containing struts's HTML Input tag)
> based on a hibernate's mapping (i.e. *.hmb.xml)?
>
> cheers,
> dion
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

--
Nick Heudecker
System Mobile, Inc.
Email: nick@systemmobile.com
Web: http://www.systemmobile.com

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


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