随遇而安30
https://github.com/QiSimon/Projects.git
幕布斯8779773
https://github.com/QiSimon/Projects.git
Saber00
Window->Preferences->Java->Installed JREs
在右边的"Installed JREs:"窗口中选中所使用的JRE,
点击其右边的"Edit",在弹出的"Edit JRE"窗口中,
有一个"JRE system libraries:"列表,
在其中找到 "...jdk1.6.0_13\jre\lib\rt.jar" 并选中,
点击右边的"Source Attachment...",
在弹出的"Source Attachment Configuration"界面中,
点击文本框右边的"External File",
选择你下载的源文件zip包,一路OK即可
qq_陌尐悦_0
https://repo.spring.io/libs-release-local/org/springframework/spring/5.0.2.RELEASE/spring-framework-5.0.2.RELEASE-dist.zip
阿崔cuicui
配置文件上哪下载?
精慕门0597454
struts , hibernate , spring 都可以直接在网上搜索的
如:http://struts.apache.org/download.cgi 这个就是struts2 下载网址, 你可以选择版本
Tarotnineteen
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
</struts>
qq_断了离殇_03822732
慕工程0281360
么么小跳跳
struts:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="bl" extends="struts-default" namespace="/">
<action name="Yisheng_*" class="yishengAction" method="{1}">
</action>
</package>
</struts>
spring:
<?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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- 引入外部的属性文件 -->
<context:property-placeholder location="classpath:jdbc.properties" />
<!-- 配置连接池 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<!-- hibernate相关属性配置-->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl_auto">update</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>domin/TYisheng.hbm.xml</value>
<value>domin/TKeshi.hbm.xml</value>
</list>
</property>
</bean>
<!-- action配置 -->
<bean id="yishengAction" class="action.YishengAction" scope="prototype">
<property name="yishengService" ref="yishengService"></property>
</bean>
<!-- 业务层配置 -->
<bean id="yishengService" class="service.YishengService">
<property name="yishengDao" ref="yishengDao">
</property>
</bean>
<!-- dao层配置 -->
<bean id="yishengDao" class="dao.YishengDao">
</bean>
</beans>web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
慕粉1258586916
报错了还是什么?
慕粉1258586916
老师用的是spring-web-3.2.0.RELEASE-source.jar, 说明你没有下载这个JAR包吧
慕粉1527515719
虽然你说的不是很清楚,但是我能猜到,应该是你的配置文件有点问题,导致你服务器没有起来,服务器没起来的话所有对你服务器的请求都会报404的错误,不知道是不是这个问题,如果不是回复我,帮你解答
秦家小小神
直接放在src下 在applicationContext.xml中会有调用
肖申克de救赎
https://github.com/Utihbi/ssh
秦家小小神
额,记下来完全没必要啊,清楚骨架就行了,剩下的如果是新手就可以去搜索,多写写,慢慢就熟悉了,不是说一定要记住,但是能记住就可以证明尿性足!
慕粉202536760
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
蓝小七
是啊,请问如何找到application.xml.
慕粉2140071187
不知所向3751676
能不能发我一个
qq_Soul冷眸_03284601
可能是spring的版本不同
weibo_小宝宝囍_0
web.xml中要如下配置Spring:
<!-- Spring框架核心监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml
</param-value>
</context-param>
weibo_小宝宝囍_0
呃,把代码贴出来,好帮你看那里出问题,这是监听器那段代码,看看错没
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>Classpath:applicationContext.xml</param-value>
</context-param>
qq_吸煙傷肺想妳傷心_0
慕娘8172444
<!-- 配置Action的类 -->
<bean id="productAction" class="action.ProductAction" scope="prototype">
<!-- 手动注入Service -->
<property name="priductService" ref="productService"></property>
</bean>
<!-- 配置业务层的类 -->
<bean id="productService" class="service.ProductService">
<property name="productDao" ref="productDao"/>
</bean>
<!-- 配置Dao类 -->
<bean id="productDao" class="dao.ProductDao"> </bean>
class要写全类名
iOnestu
你的意思是否要生成sturts.xml文件?
打油酱
ERROR - Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 31 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 31; columnNumber: 4; cvc-elt.1: 找不到元素 'beans' 的声明。
慕粉4348652
直接用这个吧:
log4j.rootLogger=DEBUG,Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
log4j.logger.org.apache=INFO
慕粉4270678
Alt+回车
dove向日葵
我有!!!!!!!!!!!