> I was curious if there are any people here who have converted from using > struts to using webworks. If yes, then could you please give me some > insight as to why you switched. Also, following are a few questions that I > would appreciate an answer on if you would be willing. > > Struts comparison questions: > How was your production time impacted by switching to Webworks? > (quicker,slower,indifferent)
I had been using struts for some years now, but only recently looked into WebWork. I've been amazed at how much faster development goes. I would say the most significant aspect of that is the WebWork Expression Language. One of my main gripes with Struts is how cumbersome the configuration and the tag libraries were. Although not enforced by Struts, Struts encourages you to use the ActionForm to pass in parameters to your action and request attributes to pass values back to the view. This gets bulks quickly. > What would you say is the main advantage(s) over struts? Without a doubt, the expression language. Here's an email I recently sent to a friend that compares the two. You might find it interesting: ----------[ snip ]------------ Struts has a number of things that it does well: * good tag library support * simple conceptual model * large developer base * excellent third party tools * well understood However, it also has a lot of warts: * tag library is confusing to use. It's large and very fine grained. * using struts ties the application to the web tier, so most people end up writing an intermediate layer. This is probably one of the more egregious problems with struts as it causes a whole layer of crap. To perform the simplest of actions, I probably need to: i. extend ActionForm (a concrete class) ii. extend Action (also a concrete class) iii. update the struts-config.xml file Webwork * webwork looks a lot like struts, but I think it's far more clever * the form and the action are bundled together so you never need to map the two * the form need only implement Action (an interface) rather than a concrete * the configuration is much simpler. Side by side example: Let's say you wanted to lookup some data in the database and return it's value. Struts ====== public class MyForm extends ActionForm { private String thingId ; public String getThingId() { return this.thingId ; } public void setThingId(String thingId) { this.thingId = thingId ; } } public class MyAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { MyForm myForm = (MyForm)form ; String thingId = myForm.getThingId() ; // do work here Object result ; // set the result to object request.setAttribute(ResultNames.RESULT, result) ; } } public class ResultNames { final public static String RESULT = "project.result" ; } <form-beans> <form-bean name="myForm" type="com.indigoegg.project.MyForm"/> </form-beans> <actions> <action name="myForm" path="/doit" scope="request" type="com.indigoegg.project.MyAction" unknown="false" validate="false"> <forward name="SUCCESS" path="/WEB-INF/views/doit-success.jsp" redirect="false"/> <forward name="INPUT" path="/WEB-INF/views/doit-input.jsp" redirect="false"/> </actions> Bleh! Now the webwork way: public class MyWebWorkAction implements Action { private String thingId ; private Object result ; public void setThingId(String thingId) { this.thingId = thingId ; } public Object getResult() { return this.result ; } public String execute() throws Exception { // set the result to object } } done! The MyWebWorkAction is visible from the HTML page, so you can just ask it for the result value. No funny traversals, etc. You can access is by name or map it as you would in struts. The mapping is optional. Here's an example mapping. <action name="com.indigoegg.project.MyWebWorkAction" alias="go"> <view name="success">/WEB-INF/views/doit-success.jsp</view> <view name="input">/WEB-INF/views/doit-input.jsp</view> </action> The action mapping is optional :) -- Matt Ho Principal Indigo Egg, Inc. http://www.indigoegg.com/ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork