You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by venkatnsm <ve...@gmail.com> on 2012/07/04 15:13:15 UTC
java pojo/Bean to generate html (textfield, dropdown,radio buttons)
hi,
how to generate html page from java POJO.
Suppose in pogo i have name & age, for these fields i want to generate text
field automatically in HTML with validations.
Thanks in advance.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/java-pojo-Bean-to-generate-html-textfield-dropdown-radio-buttons-tp4650359.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: java pojo/Bean to generate html (textfield, dropdown,radio buttons)
Posted by Kees van Dieren <in...@squins.com>.
Stackoverflow post about wicket scaffolding:
http://stackoverflow.com/questions/9997688/scaffolding-in-wicket
Best regards / Met vriendelijke groet,
Kees van Dieren
Squins | IT, Honestly
Oranjestraat 23
2983 HL Ridderkerk
The Netherlands
Phone: +31 (0)180 415559
Mobile: +31 (0)6 30413841
www.squins.com
http://twitter.com/keesvandieren
Chamber of commerce Rotterdam: 24435130
Boeken voor school en werk bestel je op studieboekencenter.nl
2012/7/4 venkatnsm <ve...@gmail.com>
> hi,
>
> how to generate html page from java POJO.
>
> Suppose in pogo i have name & age, for these fields i want to generate text
> field automatically in HTML with validations.
>
> Thanks in advance.
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/java-pojo-Bean-to-generate-html-textfield-dropdown-radio-buttons-tp4650359.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: java pojo/Bean to generate html (textfield, dropdown,radio
buttons)
Posted by yesotaso <ye...@yahoo.com>.
While I absolutely agree with Thomas, I'd suggest using a text generator
template like FTL, Ruby or even String#format will do as well :) Below is a
FTL piece.
> package ${class.package.name};
>
> import org.apache.wicket.markup.html.basic.Label;
> import org.apache.wicket.markup.html.panel.Panel;
> import org.apache.wicket.model.IModel;
>
> public class ${class.simpleName}DisplayPanel extends Panel {
> private static final long serialVersionUID = 1L;
> public ${class.simpleName}DisplayPanel(String id,
> IModel<${class.simpleName}> model) {
> super(id, model);
> <#foreach field in class.declaredFields>
> <#if !modifier.isFinal(field.modifiers) &&
> !modifier.isStatic(field.modifiers)>
> <#assign generate = true>
> <#foreach annotation in field.declaredAnnotations>
> <#assign atype = annotation.annotationType().simpleName>
> <#if atype == "ManyToOne" || atype == "OneToMany" || atype == "Version"
> || atype == "Id">
> <#assign generate = false>
> </#if>
> </#foreach>
> <#if generate>
> add(new Label("${field.name}"));
> </#if>
> </#if>
> </#foreach> }
> }
>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/java-pojo-Bean-to-generate-html-textfield-dropdown-radio-buttons-tp4650368p4650387.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: java pojo/Bean to generate html (textfield, dropdown,radio buttons)
Posted by Thomas Götz <to...@decoded.de>.
Nothing easier than that!
MyBean bean = new MyBean();
System.out.println(bean.toHtmlWithFieldsAndValidationAndEverything());
Seriously: if you want us to help you should ask serious questions. Nobody will be able to explain how to automatically generate a HTML page from a POJO. You might as well ask: I have some sugar, 2 eggs and and pound of flour, how to automatically bake a cake out of this?!
SCNR,
-Tom
On 04.07.2012, at 15:13, venkatnsm wrote:
> hi,
>
> how to generate html page from java POJO.
>
> Suppose in pogo i have name & age, for these fields i want to generate text
> field automatically in HTML with validations.
>
> Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org