也就是说,还有其他选项,例如 Spring 包含 Spring MVC 以及更多其他选项。如果您打算投资克服学习曲线,请考虑哪种框架在中期对您最有利:例如,您所在地区的雇主倾向于寻找哪些框架?在这个时间点上,我会选择 Spring,我觉得 Spring 的势头很好,但 Struts 非常擅长它的功能。
I would look longer term than this project. As you saw, first time you use any technology is largely about making mistakes and learning from them. So this first project won't likely be a shining example of Struts usage once you're done.
Using Struts (and Tiles from what you indicate was a main concern: JSP copy and paste) will however be an excellent delve into "proper" MVC, i.e. it forces you to do things in a particularly structured way, and one which I happened to appreciate a lot, I was a big Struts fan.
That said, there are other options, e.g. Spring contains Spring MVC plus much much more. If you're going to invest in overcoming a learning curve, think about which framework will most benefit you overall in the medium term: which frameworks do employers in your area tend to look for, for example? At this point in time, I would go with Spring where I feel the momentum is but Struts is very good at what it does.
If you're going to learn a framework then I'd recommend Spring MVC over Struts. The learning curve isn't too steep and there are lots of Spring resources available on the internet.
Once you've got Spring in place you will find your application is much simpler to maintain and support. You'll also be able to add enhancements, like security, a lot easier.
First: don't let the name confuse you: Struts2 and Struts are very different frameworks.
Second: changing from JSP to Velocity can be a good or bad decisition, but that's not exactly the point. The point is to switch away from Model1 (rather ancient nomenclature, but still useful). That is, decoupling your view layer from your logic layer. (You can use JSP or Velocity for your view layer). Furthermore, to decide your view layer is just a part of your architecture: you still must decide who will process the request and produce the data that will be sent to the view. The most basic option is to use plain servlets, but, again, it's better to use some framework. For this, there are a lot of frameworks in Java. The "action based" ones are a subset among them, perhaps the most simple to learn. Among them, the oldest is Struts; today the most used for new projects are (in no particular order) Struts2 , Spring MVC and Stripes - they are quite similar.
如果您的雇主已经使用框架使用 Java 进行 Web 开发,请尝试学习实际使用的框架,并向您的同事寻求帮助来学习它。
Learning to separate the logic is excellent. You can do that without using Velocity, Struts or any framework whatsoever, and you'll likely learn more about what it takes to do this separation if you try it with minimal help first.
Learning a framework (in fact multiple frameworks) is also worthwhile, but I wouldn't personally choose Struts as a first framework unless it's the one used by your employer or a prospective employer. If your employer is using Struts, I hope it's Struts 2, as Struts 1 is getting ancient.
The framework I like to work with the most is Wicket, but it's a radical shift from what you're currently looking at. SpringMVC is also definitely worth a look.
If your employer is already doing web development in Java using a framework, try to learn the framework that's actually in use, and ask your co-workers for help learning it.
为什么你应该学习Struts?我的答案是:因为雇主经常需要了解它,特别是在维护旧项目时。我没有进行任何精确的测量,但我认为在我所在的地区,JSF 和 Struts 最常用于 Web 应用程序开发。
Struts 是一个相当古老的 Web 框架,用它编写现代 AJAX GUI 非常笨拙,因此创建了更好的框架。 JSF 对我来说不太笨拙,但也有一些问题。我最喜欢的 Web 框架是 Vaadin 和 GWT,但我不会为您提供任何建议 - 您应该自己做出决定。
Why you should learn Struts? My answer is: because employers often require knowledge of it, especially for maintaining of older projects. I didn't make any precise measurements, but I think that at my region JSF and Struts are used for web application development most often.
Struts is a quite old web framework, and it's quite clumsy to write modern AJAX GUIs with it, so there were created better frameworks. JSF is for me a bit less clumsy, but also has some problems. My favourite web frameworks are Vaadin and GWT, but I'm not suggesting anything for you - you should make the decision by yourself.
发布评论
评论(5)
我会比这个项目看得更长远。正如您所看到的,第一次使用任何技术主要是犯错误并从中学习。因此,一旦您完成,第一个项目不太可能成为 Struts 使用的光辉示例。
然而,使用Struts(以及您所指出的主要问题是Tiles:JSP复制和粘贴)将是对“正确的”MVC的极好的深入研究,即它迫使您以一种特别结构化的方式做事,而我碰巧遇到了这种情况非常感谢,我是 Struts 的忠实粉丝。
也就是说,还有其他选项,例如 Spring 包含 Spring MVC 以及更多其他选项。如果您打算投资克服学习曲线,请考虑哪种框架在中期对您最有利:例如,您所在地区的雇主倾向于寻找哪些框架?在这个时间点上,我会选择 Spring,我觉得 Spring 的势头很好,但 Struts 非常擅长它的功能。
I would look longer term than this project. As you saw, first time you use any technology is largely about making mistakes and learning from them. So this first project won't likely be a shining example of Struts usage once you're done.
Using Struts (and Tiles from what you indicate was a main concern: JSP copy and paste) will however be an excellent delve into "proper" MVC, i.e. it forces you to do things in a particularly structured way, and one which I happened to appreciate a lot, I was a big Struts fan.
That said, there are other options, e.g. Spring contains Spring MVC plus much much more. If you're going to invest in overcoming a learning curve, think about which framework will most benefit you overall in the medium term: which frameworks do employers in your area tend to look for, for example? At this point in time, I would go with Spring where I feel the momentum is but Struts is very good at what it does.
如果您要学习一个框架,那么我会推荐 Spring MVC 而不是 Struts。学习曲线并不太陡,并且互联网上有很多 Spring 资源。
一旦您安装了 Spring,您会发现您的应用程序的维护和支持变得更加简单。您还可以更轻松地添加增强功能,例如安全性。
If you're going to learn a framework then I'd recommend Spring MVC over Struts. The learning curve isn't too steep and there are lots of Spring resources available on the internet.
Once you've got Spring in place you will find your application is much simpler to maintain and support. You'll also be able to add enhancements, like security, a lot easier.
首先:不要让名称让您感到困惑:Struts2 和 Struts 是非常不同的框架。
其次:从 JSP 更改为 Velocity 可能是一个好决定,也可能是一个坏决定,但这并不是重点。重点是放弃 Model1 (相当古老的术语,但仍然有用)。也就是说,将视图层与逻辑层解耦。 (您可以将 JSP 或 Velocity 用于视图层)。
此外,要确定视图层只是架构的一部分:您仍然必须决定谁将处理请求并生成将发送到视图的数据。最基本的选择是使用普通 servlet,但是,最好还是使用一些框架。为此,Java 中有很多框架。 “基于行动”的方法是其中的一个子集,也许是最容易学习的。其中,最古老的是Struts;如今,新项目中最常用的是(排名不分先后)Struts2、Spring MVC 和 Stripes——它们非常相似。
First: don't let the name confuse you: Struts2 and Struts are very different frameworks.
Second: changing from JSP to Velocity can be a good or bad decisition, but that's not exactly the point. The point is to switch away from Model1 (rather ancient nomenclature, but still useful). That is, decoupling your view layer from your logic layer. (You can use JSP or Velocity for your view layer).
Furthermore, to decide your view layer is just a part of your architecture: you still must decide who will process the request and produce the data that will be sent to the view. The most basic option is to use plain servlets, but, again, it's better to use some framework. For this, there are a lot of frameworks in Java. The "action based" ones are a subset among them, perhaps the most simple to learn. Among them, the oldest is Struts; today the most used for new projects are (in no particular order) Struts2 , Spring MVC and Stripes - they are quite similar.
学习分离逻辑非常好。您可以在不使用 Velocity、Struts 或任何框架的情况下做到这一点,并且如果您首先在最少的帮助下尝试,您可能会更多地了解如何进行这种分离。
学习一个框架(实际上是多个框架)也是值得的,但我个人不会选择 Struts 作为第一个框架,除非它是你的雇主或未来雇主使用的框架。如果您的雇主正在使用 Struts,我希望它是 Struts 2,因为 Struts 1 已经过时了。
我最喜欢使用的框架是 Wicket,但它与您当前看到的框架发生了根本性的转变。 SpringMVC 也绝对值得一看。
如果您的雇主已经使用框架使用 Java 进行 Web 开发,请尝试学习实际使用的框架,并向您的同事寻求帮助来学习它。
Learning to separate the logic is excellent. You can do that without using Velocity, Struts or any framework whatsoever, and you'll likely learn more about what it takes to do this separation if you try it with minimal help first.
Learning a framework (in fact multiple frameworks) is also worthwhile, but I wouldn't personally choose Struts as a first framework unless it's the one used by your employer or a prospective employer. If your employer is using Struts, I hope it's Struts 2, as Struts 1 is getting ancient.
The framework I like to work with the most is Wicket, but it's a radical shift from what you're currently looking at. SpringMVC is also definitely worth a look.
If your employer is already doing web development in Java using a framework, try to learn the framework that's actually in use, and ask your co-workers for help learning it.
为什么你应该学习Struts?我的答案是:因为雇主经常需要了解它,特别是在维护旧项目时。我没有进行任何精确的测量,但我认为在我所在的地区,JSF 和 Struts 最常用于 Web 应用程序开发。
Struts 是一个相当古老的 Web 框架,用它编写现代 AJAX GUI 非常笨拙,因此创建了更好的框架。 JSF 对我来说不太笨拙,但也有一些问题。我最喜欢的 Web 框架是 Vaadin 和 GWT,但我不会为您提供任何建议 - 您应该自己做出决定。
Why you should learn Struts? My answer is: because employers often require knowledge of it, especially for maintaining of older projects. I didn't make any precise measurements, but I think that at my region JSF and Struts are used for web application development most often.
Struts is a quite old web framework, and it's quite clumsy to write modern AJAX GUIs with it, so there were created better frameworks. JSF is for me a bit less clumsy, but also has some problems. My favourite web frameworks are Vaadin and GWT, but I'm not suggesting anything for you - you should make the decision by yourself.