Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

I want to map POJO's to web forms. What framework would suit me best? Thx!

 
Ranch Hand
Posts: 42
Android Google Web Toolkit Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm want to map my POJO's (users, events etc) to web forms. So the thing I need is a way to alter the state of my Objects via web form input and vice versa.

I've done a lot of reading but can't figure out what framework to go for. (Stripes / JSF / Spring...)

I work in MyEclipse so I was thinking about going for JSF or Spring because there are some built-in features for them. Stripes could also be an option for its simplicity... (Struts wouldn't be a good option for me I think, because I'm starting a new project, though MyEclipse has a lot of built-in features for it)

Would appreciate some advice of people who have a little bit more experience in this.


Thanks a lot in advance for the input!
[ July 06, 2008: Message edited by: Jochen Szostekske ]
 
Marshal
Posts: 67425
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use real words when posting to the forums. Abbreviations such as "thx" in place of "thanks" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
 
Bear Bibeault
Marshal
Posts: 67425
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, please check your private messages.
 
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts2 (or Webwork) supports your kind of requirement.
 
Jochen Szostek
Ranch Hand
Posts: 42
Android Google Web Toolkit Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Rajah Nagur:
Struts2 (or Webwork) supports your kind of requirement.



Thank you very much for your reply!

Indeed it might be possible for me to use Struts2 for this (think via the modeldriven interface) I guess.
But while collecting information via google yesterday I read quite often that it's not a good practice (anymore) to create any new projects using Struts, because their framework is becoming a bit "outdated". Since JSF and maybe also Spring offer a better MVC model (as it seems, I don't speak from any experience, I just read these things online) I was considering going for one of them.

Also yesterday I head via an ex-colleague that Spring has a possibility to use your business logic objects directly in your forms. That sounds like something I could appreciate a lot (and it also seems to be a very modular framework), so I think I'm going to experiment a little bit with Spring first.

I'm not at all sure if I'm making the right choices or doing the right considerations so I still appreciate any comments here.

Thanks again for your reply and have a nice day!

Jochen
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many (or most) frameworks support form-to-POJO binding these days. I like Stripes a lot (a lot more than JSF or Struts, to be sure), because there's so little to configure if you follow the standard naming conventions. And what there is to configure goes into the bean classes as annotations - no config files.

As regards Struts, version 1.x is obsolete. Version 2.x is very much alive, but it's rather different (based on another framework), so if one were to migrate away from Struts 1, then one might as well evaluate other frameworks (which indeed many people are doing). I doubt that Struts 2 will be anywhere near as popular as Struts 1, simple because there are so many other capable frameworks available now.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
Many (or most) frameworks support form-to-POJO binding these days. I like Stripes a lot (a lot more than JSF or Struts, to be sure), because there's so little to configure if you follow the standard naming conventions. And what there is to configure goes into the bean classes as annotations - no config files.



I'll take this a bit further with an example...







When the web page is submitted the values for firstName, lastName, and age are automatically populated into the User object and all basic type converting is handled for you (String, Integer, Double, Float, Date, etc).
 
Jochen Szostek
Ranch Hand
Posts: 42
Android Google Web Toolkit Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried Stripes and it indeed is quite easy to implement. In a couple of hours I got my own bidirectional (from form to pojo and vice versa) example running!

Thanks a whole lot for the tip!

And if I might ask another question, would it be possible somehow to generate forms from POJO's?

E.g. if I have a user class with 2 String properties (username and password), would it be possbile to generate a form with two textfields for this?

Agains thanks a lot for the advice! Really appreciate the help.

Greets,

Jochen
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's nothing in Stripes that will generate forms for you. I've often thought that might make a nice add on package but once you get past those simple forms with a handful of properties you'll soon discover that those types of tools are a waste of time because they won't cover enough scenarios. Especially when you start needing checkboxes, selects, radio buttons, etc.

That said, you might consider looking at Grails if code generation is needed. Grails does quite a bit of that for you.
[ July 07, 2008: Message edited by: Gregg Bolinger ]
 
Rajah Nagur
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would still recommend Struts 2. It is based on Webwork. It is one of the finest frameworks written. Very clean, modular and tested framework. Ajax support is very good.

AFAIK, Struts2, Spring MVC, Ruby on Rails, Stripes, Wicket all allow to use the model objects (i.e. Business entity objects) on the form. Since these are POJOs, it becomes very easy to use in the view layer.

Please take a look at this. It will help you decide.
 
Jochen Szostek
Ranch Hand
Posts: 42
Android Google Web Toolkit Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Gregg Bolinger:
There's nothing in Stripes that will generate forms for you. I've often thought that might make a nice add on package but once you get past those simple forms with a handful of properties you'll soon discover that those types of tools are a waste of time because they won't cover enough scenarios. Especially when you start needing checkboxes, selects, radio buttons, etc.

That said, you might consider looking at Grails if code generation is needed. Grails does quite a bit of that for you.

[ July 07, 2008: Message edited by: Gregg Bolinger ]



I see what you mean. I always thought form generation would be superb feature when you're working on a project with a lot of different objects that need to be customizable via a web interface. (just to get you started with some basic forms to adjust by hand) But I just discovered MyEclipse a few days ago as an Eclipse user, and it has a lot of nice visual tools to help you create forms. I guess if you use such a tool to create your forms decently from the first run, you will spend even less time than correcting some auto-generated forms.

Originally posted by Rajah Nagur:
I would still recommend Struts 2. It is based on Webwork. It is one of the finest frameworks written. Very clean, modular and tested framework. Ajax support is very good.

AFAIK, Struts2, Spring MVC, Ruby on Rails, Stripes, Wicket all allow to use the model objects (i.e. Business entity objects) on the form. Since these are POJOs, it becomes very easy to use in the view layer.

Please take a look at this. It will help you decide.



Aha, well I think the articles I read about Struts were from quite a while back. Because there were some people that claimed that JSF was going to make Struts obsolete and there wasn't even going to be a Struts2 because the development team was already on something else. (I guess this might be Webwork)

Thanks a whole lot for the frameworks table too! For a frameworks newbie like me this can be very very useful.


Actually the project I'm starting is something based on a website me and a friend had like 5 or more years ago or so, which actually had a lot of visitors back then. But we lost all our date due to a HD crash. So the last couple of years I've been thinking about redesigning that site (I started it once more in PHP, but didn't have enough time), and I also came up with a lot of nice extra features to implement since that first version.

So actually I'm quite nervous on choosing for a specific framework to start with. This is going to be something I probably will need (read as "want" :-)to maintain and update for the rest of my life. And I guess it's not that easy to switch your framework once you're running.


Thanks again a lot for the info guys! Wouldn't know where to start without this info.

Have a nice day and greetings from Belgium!
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm in a similar situation. First on my own TODO list is to try out Wicket, as I wrote in this thread. It might be worth checking out for you as well.
 
    Bookmark Topic Watch Topic
  • New Topic