首頁>技術>

SSM整合配置

----Spring/Spring mvc/Mybatis1.需要匯入的jar包

----<dependencies>標籤內匯入

例:

package cn.zl.java.mapper;import org.springframework.stereotype.Repository;@Repositorypublic interface UserMapper {//    int saveUser(int id);    int deleteUser(int id);}
8.controller包

註解:

@Controller--controller註解@RequestMapping--對映路徑@Autowired--自動注入依賴

例:

package cn.zl.java.controller;import cn.zl.java.service.UserService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;@Controller@RequestMapping("/user")public class UserController {    @Autowired    private UserService service;            @RequestMapping("/delete")    public String deleteUser(String id){                int i = service.deleteUser(Integer.parseInt(id));                String page="";                if (i>0){                    page = "/index.jsp";                }                return page;            }}
9.service包

註解:

@Service--service註解@Autowired--自動注入依賴
package cn.zl.java.service;import cn.zl.java.mapper.UserMapper;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;@Servicepublic class UserService {    @Autowired    private UserMapper mapper;    public  int deleteUser(int id){        return  mapper.deleteUser(id);    }}
10. 其他包

註解:

  • BSA-TRITC(10mg/ml) TRITC-BSA 牛血清白蛋白改性標記羅丹明
  • flutter 基礎程式碼結構