spring 在jsp页面中使用spring bean的教程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4031293/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 04:10:37  来源:igfitidea点击:

Tutorial for using spring beans in jsp pages

springjspservletsspring-mvc

提问by Worker

(I am not familar with technologies related to HTML delivery, like JSP... But I know basic concepts...)

(我不熟悉与 HTML 交付相关的技术,例如 JSP……但我知道基本概念……)

In my application I use Spring Beans and Spring Security together with Blaze DS to communicate with Flex applications over AMF protocol. Everything works just fine.

在我的应用程序中,我将 Spring Beans 和 Spring Security 与 Blaze DS 一起使用,通过 AMF 协议与 Flex 应用程序进行通信。一切正常。

Now I have a task to deliver some services via HTTP/HTML eg. it should be some sort of servlets or JSP pages that generates HTML for users. To not reproduce all business and data access logic I want to utilize my existing Spring Beans (I love Spring.). So, basically I want to create HTML view for my Spring Beans.

现在我有一项任务是通过 HTTP/HTML 提供一些服务,例如。它应该是某种为用户生成 HTML 的 servlet 或 JSP 页面。为了不重现所有业务和数据访问逻辑,我想利用我现有的 Spring Beans(我喜欢 Spring。)。所以,基本上我想为我的 Spring Bean 创建 HTML 视图。

My question: What would be the best way to do it? Which technologies I should use? What guru-guys will suggest?

我的问题:最好的方法是什么?我应该使用哪些技术?大师们会建议什么?

The best tip would be a link to small tutorial that will explain how to access Spring Beans for JSP pages. I tried to goole myself but there are too much information and I am a little bit nixed up with different version - so I really have no clue what should I start with...

最好的提示是一个小教程的链接,该教程将解释如何访问 JSP 页面的 Spring Bean。我试图自己使用谷歌,但信息太多,我对不同的版本有点厌烦 - 所以我真的不知道我应该从什么开始......

回答by William

You should look into Spring MVC. You can find an introduction here.

你应该看看Spring MVC。您可以在此处找到介绍。

Also the accepted answer to thisquestion discusses how to do what you want specifically (i.e. access your Spring Beans from JSP pages).

问题的公认答案还讨论了如何做您想要的具体操作(即从 JSP 页面访问您的 Spring Bean)。