srping基本认识(2)

直接上代码吧
package com.zhongruan.controller;

import com.zhongruan.bean.User;
import com.zhongruan.service.Iuserservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class Dl {
@Autowired
private Iuserservice service;
@RequestMapping(“findall.do”)
public ModelAndView findall(){
ModelAndView modelAndView=new ModelAndView();
List finda =service.finda();
modelAndView.setViewName(“Cg.jsp”);
modelAndView.addObject(“hhh”,finda);
return modelAndView;

}
@RequestMapping("denl.do")
public String denl(User user){

// ModelAndView modelAndView=new ModelAndView();
// String us = req.getParameter(“username”);
// String pa=req.getParameter(“password”);
System.out.println(user);
Boolean pp=service.pd(user.getUsername(),user.getPassword());
if (pp){
return “redirect:/findall.do”;
}else{
return “Sb.jsp”;
}

}
@RequestMapping("delect.do")
public String delect(int id){
    service.shanchu(id);
    return "redirect:/findall.do";
}
@RequestMapping("modify.do")
public String modify(User user){
    service.xg(user);
    return "redirect:/findall.do";
}
@RequestMapping("modify2")
public ModelAndView modify2(User user){

    ModelAndView modelAndView=new ModelAndView();
    modelAndView.addObject("pp",user);
    modelAndView.setViewName("Xiugai.jsp");
    return modelAndView;
}
@RequestMapping("add.do")
public String add(User user){
    service.xz(user);
    return "redirect:/findall.do";
}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值