• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Struts2 Action + Model

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Guys !!

1) Is it suppose to use action class as model class in Struts2, no need for separate model ?
2) Which is the best template engine which can be used with Struts2 ?
3) Has validation is different in Struts2 ?

Thanks and regards,
Ajay
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


1) Is it suppose to use action class as model class in Struts2, no need for separate model?


That is one approach, although it's very easy to use one or more domain objects as action properties and use their properties on the web page either has form properties or just displayable properties.

There is also use the ModelDriven approach, which is (sort of) similar to ActionForms from Struts 1. See the ModelDriven interceptor docs.


2) Which is the best template engine which can be used with Struts2?


"Best" is somewhat subjective, of course. Out of the box Struts 2 supports JSP, FreeMarker, and Velocity. I'm not very familiar with the Velocity support; both JSP and FreeMarker work well.


3) Has validation is different in Struts2?


Yes, although it's somewhat similar. JavaScript (client-side) validation is somewhat less flexible in Struts 2 (compared to Struts 1), although there's a patch going in soon that alleviates that somewhat. Server-side validation, IMO, is better under Struts 2 than Struts 1, due partially to Struts 2's type conversion capabilities. Type conversion converts form string data into domain objects via an interceptor, rather than in the main code. See the Validation page and the Type Conversion page.

Dave
[ November 11, 2008: Message edited by: David Newton ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic