Stripes for Java Web Dev,值得学习吗?容易吗?它与Struts相比如何?

发布于 2024-10-12 18:51:21 字数 240 浏览 7 评论 0原文

我厌倦了 Java web,因此开始学习 Ruby on Rails,但我刚刚找到了这个框架,它看起来很有前途......但我没有心情学习更多 Java,所以我想知道是否这个值得我花时间(这意味着更少的配置和操作映射等)

它比 Struts 2(WebWorks) 更好吗???因为它们比 Struts 1 好得多,但仍然不是 RoR。

春季MVC?

我想要一个实际操作选项,而不是规格比较。

谢谢 !

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 would 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 !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沉鱼一梦 2024-10-19 18:51:21

自 2007 年左右以来,我已经在多个低/中导航复杂性项目中成功使用了 Stripes。这是一个非常适合您工具箱中的框架。

恕我直言,假设您清楚地了解以下两个概念,Stripes 的学习曲线相对较低 -
1. HTTP请求-响应周期
2. 在 JSP 中使用 JavaBean

使用 Stripes 时,唯一需要处理 XML 的地方是在 web.xml 中配置 StripesFilter 和 DispatcherServlet(标准过滤器和 servlet 配置)
除此之外,所有其他配置和功能都可以。映射是通过类/字段/方法级别注释进行的。

快速入门指南应该可以让您在 10-15 分钟内运行起来

与 Struts 的比较/Spring MVC -
就我个人而言,在尝试过 Stripes 后我再也没有回到 Struts。那时 Spring MVC 还不存在。我确实将 Spring MVC 用于更复杂的 Web 应用程序。

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.

生寂 2024-10-19 18:51:21

问题不在于语言。至少在过去的十年里,它大多不是用语言来表达的。请继续使用 Java。不过,许多人已经厌倦了 Java Web——这正是每年至少出现一次新的 Java 框架尝试的原因。目前只有大约 50 个演示框架。所谓的“主流”Java 技术(Spring、Wicket、Struts 和 JSF)在取得一定成功和规模后被证明是非常非常保守的。

像 Web4j、Play 和 HybridJava 这样的新浪潮强烈致力于让事情恢复到 Adam 那样简单。在离开这个(Java)世界之前,请永远考虑使用其中一种新的。

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.

鹿! 2024-10-19 18:51:21

这个问题: https://stackoverflow .com/questions/1619758/is-struts2-still-a-good-choice-of-web-framework-for-new-projects 是关于一位用户争论是否使用 struts2,这可能与其他人制作决定。

下面是 Struts2 的一个示例,虽然 struts 有自己的标签,这将使下面的内容更易于维护,但我决定尽可能使用纯 html,以便更清楚地了解它如何自动将值移动到操作,然后移动到视图。

/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>

当上面提交时,“名称”在以下操作中设置(如果我使用 get/set 封装了名称,则该示例的工作原理完全相同,但更长),

package struts2;
import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldAction extends ActionSupport{
    public String name;
}

然后呈现此页面/WEB-INF/content/hello-world.jsp

<%@taglib prefix="s" uri="/struts-tags"%>
<html>
    <body>
        <h1>Hello World <s:property value="name"/></h1>
    </body>
</html>

这是一个带有约定的 Struts2 示例(类路径上有一个额外的 jar),不需要其他配置。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文