给我一个例子,说明为什么我们使用 Struts?
我想开始学习 Apache Struts 2。请解释一下使用 Struts 2 等 Web 框架的好处。另外,Struts 1 和 Struts 2 之间有什么区别?
I want to start learning Apache Struts 2. Please explain the benefits of using a web framework such as Struts 2. Also what are the differences between Struts 1 and Struts 2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之:您将需要使用框架来向应用程序的结构添加顺序和标准。框架允许快速开发。它们强制执行您继承的架构风格。它们提供模块化、抽象、低耦合和高内聚。
Struts2 是一个非常稳定、简单且使用起来很有趣的框架。
Struts2 比 Struts 更容易使用。线程更安全,因为操作是 POJO 而不是单例。 这里列出了两者之间的差异。
In a nutshell: you will need to use a framework in order to add order and standards to the structure of your applications. Frameworks allow rapid development. They enforce architectural styles which you inherit. They offer modularity, abstraction, low coupling, and high cohesion.
Struts2 is a very stable and simple framework that is fun to use.
Struts2 is a lot easier to use than Struts. Threads are safer because actions are POJOs and not singletons. Here is a long list of differences between the two.
好吧,Suresh 首先,没有人可以告诉你或让你下定决心学习什么,不学习什么......
关于在java中使用struts..我们没有在java中使用struts,但我们在struts中使用java。
如果我答对了你的问题,这里有一些提示我们为什么使用 struts..struts/spring/wicket 或任何其他众所周知的名称是软件领域中的框架,这些只是一个平台,可以为您提供轻松的工作并帮助您专注于你的逻辑而不是其他平常的事情。
让我们以 struts 为例,这个框架可以帮助您以更快、更高效的方式开发 Web 应用程序,因为您无需深入思考如何处理请求并将其转发到您的核心操作类,该类实际上将完成主要工作工作时,您不需要从请求/响应中提取每个参数,而是由 struts 处理它们,并且通过一些易于使用的方法,您可以轻松获得这些东西。
另一个像 hibernate 的例子,在这种情况下,你不需要为 CRUD 编写每个 sql 查询,事实上我们使用普通的 java 类方法,hibernate 在幕后负责为我们生成 SQL 语法以及处理连接和其他东西。
关于struts1和struts2的区别我认为你首先需要知道框架到底是什么以及它们为我们做了什么,然后你才能看到两者之间的差异。
希望这能让你明白一些事情
Well Suresh first of all there is no one who can tell you or make your mind set to learn what and what not...
regarding using struts in java..we are not using struts in java but we are using java in struts.
if i got your question right that here goes some hints why we are using struts..struts/spring/wicket or any other well known names are framework in the software domain these are just a platform which provides you ease of work and help you to concentrate on your logic rather than other usual stuff.
lets take an example of struts,this framework help you to develop web-application in much faster and productive way as you need not to thik in very deep how request is being handled and being forwarded to your core action class which actually will do the main work, you need not to extract every paramers from the request/response rather they are being handled by struts and with some easy to use methods you can easily get these things.
another example like hibernate in that case you need not to write each and every sql query for CRUD infact we are using plain java like methods and hibernate under the hood taking care of generating SQL syntax for us as well handling conection and other stuff.
regarding struts1 and struts2 difference i thik you first need to know what exactly are the framework and what they doing for us,only than you can see the differences between both.
hope this will clear something for you