作者:菜鸟来袭 | 来源:互联网 | 2022-03-15 19:22
每天记录一点点,慢慢的成长,今天我们学习了ssm,这是我自己总结的笔记,大神勿喷!谢谢,主要代码!! !
spring&spring
每天记录一点点,慢慢的成长,今天我们学习了ssm,这是我自己总结的笔记,大神勿喷!谢谢,主要代码!! !
spring&springmvc&mybatis整合(注解)
1.jar包
2.引入web.xml文件
contextConfigLocation
classpath:applicationContext.xml
org.springframework.web.context.ContextLoaderListener
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc.xml
springmvc
*.action
3.创建实体类
4.引入一个(类名)dao.xml
update accounting set mOney=#{money} where name=#{name}
5.创建一个(类名)dao
public void update(Accounting a);
public Accounting findMoneyByName(String name);
6.写service
public void remit(String from,String to,double money);
7.写serviceimpl
@Service
public class AccountServiceImpl implements AccountService {
@Autowired
private AccountDao ad;
@Override
public void remit(String from, String to, double money) {
Accounting fromAccount=ad.findMoneyByName(from);
fromAccount.setMoney(fromAccount.getMoney()-money);
ad.update(fromAccount);
Accounting toAccount=ad.findMoneyByName(to);
toAccount.setMoney(toAccount.getMoney()+money);
ad.update(toAccount);
}
}
8.引入applicationContext.xml
9.引入db.properties文件和log4j.properties文件
10.引入springmvc.xml文件
11.jsp页面编写
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。