SSH常用注解
Dao: @Repository("questionDao")
Service: @Service("userService")
Action:
@Controller
@Scope("prototype")
Action跳过验证:
@SkipValidation
public String toRegPage(){
return "regPage" ;
}
监听器Listen: @Component
Service里的:
@Transactional 添加事物
需要在applicationContext.xml里添加事物注解:
<tx:annotation-driven transaction-manager="transactionManager"/>
配置文件参数key
//web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:beans.xml</param-value> </context-param> beans.xml: <!-- 分散配置 --> <context:property-placeholder location="classpath:jdbc.properties"/> <context:component-scan base-package="com.violet.surveypark.dao.impl,com.violet.surveypark.service.impl,com.violet.surveypark.struts2.action" />