j2ee 配置 spring
我从官网下载了spring-framework-3.1.1.RELEASE-with-docs.zip现在有个问题恳请大家的协助:
我使用的是myeclipse6.5,add spring capabilities的话,最高只能到2.5,
如果不copy已有的工程,也不copy网络上搜索出来的网页,
applicationContext.xml怎么写?
(从spring-framework-3.1.1.RELEASE-with-docs.zip里面能找到入口吗?)
谢谢. --------------------编程问答-------------------- 官网上下载下来的都带有demo你看看就明白了 --------------------编程问答-------------------- web.xml里面加上
<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
然后在里的classPath里创建applicationContext文件
内容的话自己需要什么加什么啊。。
--------------------编程问答-------------------- 下载错jar 包了,应该下载spring-framework-3.1.1.RELEASE.zip --------------------编程问答-------------------- to suciver :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
</beans>
struts2.3.3 我已经把struts-blank的web.xml以及struts.xml以及相应的jar包弄进来了,
我现在在spring-framework-3.1.1.RELEASE-with-docs找不到example,
请你把具体的步骤说明一下,可以吗? --------------------编程问答-------------------- to alison007 : 好的,我马上去下. --------------------编程问答-------------------- to alison007 :
我之前下的with-docs,至少还有docs,你说的那个版本除了没有docs,其他的都是一样的.
你的解决办法是无效的. --------------------编程问答-------------------- windows>preferences>MyEclipse>Project Capabities>spring
来到这个界面后点击你的spring的最高版本,一般都会有几个选择把里面的jar包换成你下载的spring的核心包,关闭重启Myeclipse项目加入add spring capabilities,虽然选择最高版本虽然还是你的2.5但实际已经是你下载的最新spring的支持了这样就不用愁spring配置文件模板配置了 --------------------编程问答-------------------- to cuihuaming198809 :
我的电脑上有myeclipse6.5和myeclipse8.6,
windows>preferences>MyEclipse>Project Capabities>spring这样的路径操作都不存在,
可以windows>preferences>里面直接索引Project Capabities,但是界面里面仍然找不到spring,
请你把详细的步骤描述一下,可以吗? --------------------编程问答-------------------- 补充说明:
1.不使用myeclipse的add spring capabilities
2.不copy已有的工程 --------------------编程问答--------------------
上面两步都不使用,那你自己把每种版本的写法死背下来吧!
配置文件首部的写法是根据你需要哪些功能添加的,比如你要使用注解方式,最基本的书写格式就不行,还需要在下面配置信息添加注解功能需要的配置
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
补充:Java , Java EE