Stripes for Java Web Dev, is it worth learning ? Is it easier ? how it compared to Struts?
I am tired of Java web, and started to learn Ruby on Rails because of that, but I just found this Framework and it looks promessing... But I am not in the mood to study more Java, so I would like to know if this one is worth my time ( that w开发者_开发技巧ould mean, less configuration and action mapping and so on)
Is it better then Struts 2(WebWorks) ??? because those are way better then Struts 1 but still not a RoR.
Spring MVC ?
I would like a Hands On Opnion, not a specs compare.
Thanks !
I have successfully used Stripes in multiple low/medium navigational complexity projects since around 2007. It's a pretty good framework to have in your toolbox.
IMHO, Stripes has a relatively low learning curve assuming you have the following two concepts clear in your mind -
1. HTTP Request - Response cycle
2. Using JavaBeans in JSPs
While using Stripes, the only place you need to mess with XMLs is configuring the StripesFilter and DispatcherServlet in web.xml (standard filter and servlet configurations)
Besides that, all other configuration & mapping is via class/field/method level annotations.
Quick Start guide should get you running in 10-15 minutes
Comparison with Struts/Spring MVC - Personally, I never went back to Struts after trying out Stripes. Spring MVC did not exist then. I do use Spring MVC for more complex webapps.
The problem is not in language. At least for the last ten years it is mostly not in the language. Please stay with Java. Many people are tired of Java Web though - that is exactly why each year at least one new attempt to suggest a Java framework happens. Currently there are about 50 of presentation frameworks only. The so called "mainstream" Java technologies (Spring, Wicket, Struts and JSF) prove to be very very conservative after they reach some success and size.
The new wave like Web4j, Play and HybridJava concentrate strongly on making things back as simple as they were for Adam. Before leaving this (Java) world forever consider using one of those new.
This question: https://stackoverflow.com/questions/1619758/is-struts2-still-a-good-choice-of-web-framework-for-new-projects is about one user debating to use struts2 which may be pertinent to others making the decision.
Following is an example of Struts2, although struts has it's own tags which would make the follwing more maintainable I decided to go with plain html where possible to make it clearer how it automagically moves values to the action and then to the view.
/WEB-INF/content/hello.jsp
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<body>
<form action="hello-world">
Enter Your Name: <input type="text" name="name"/>
<input type="submit" value="Submit" />
</form>
</body>
</html>
When the above is submitted "name" is set on the following action (If I had encapsulated name with get/set the example would work exactly the same but be longer)
package struts2;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorldAction extends ActionSupport{
public String name;
}
then this page is rendered /WEB-INF/content/hello-world.jsp
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<body>
<h1>Hello World <s:property value="name"/></h1>
</body>
</html>
This is an example of Struts2 with conventions (one extra jar on the class path), no other configuration required.
精彩评论