controller
package com.hnjdxy.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.hnjdxy.pojo.scheme;
import com.hnjdxy.service.schemeService;
@Controller
public class schemeController<UserInfo> {
@Autowired
private schemeService schemservice;
@RequestMapping("/findAll")
public ModelAndView findAll() {
List<scheme> list=schemservice.findAll();
ModelAndView mav=new ModelAndView();
mav.setViewName("listOffer.jsp");
mav.addObject("list",list);
return mav;
}
@RequestMapping("/findUserByid")
public ModelAndView getUserById(HttpServletRequest request){
ModelAndView mav=new ModelAndView();
String bpl_guid=request.getParameter("bpl_guid");
scheme scheme=schemservice.findUserByid(bpl_guid);
mav.setViewName("updateOffer.jsp");
mav.addObject("scheme",scheme);
return mav;
}
@RequestMapping("/update")
public ModelAndView update(HttpServletRequest request) {
ModelAndView mav=new ModelAndView();
String bpl_guid=request.getParameter("bpl_guid");
String unit_name=request.getParameter("unit_name");
String period1_area=request.getParameter("period1_area");
String per_sum_area=request.getParameter("per_sum_area");
String inputer=request.getParameter("inputer");
scheme s=new scheme();
s.setBpl_guid(bpl_guid);
s.setUnit_name(unit_name);
s.setPeriod1_area(period1_area);
s.setPeriod1_area(period1_area);
s.setInputer(inputer);
schemservice.update(s);
mav.setViewName("/findAll");
return mav;
}
}
mapper
package com.hnjdxy.dao;
import java.util.List;
import com.hnjdxy.pojo.scheme;
public interface schemeMapper {
public List<scheme> findAll();
public int update(scheme scheme);
public scheme findUserByid(String bpl_guid);
}
xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnjdxy.dao.schemeMapper">
<select id="findAll" resultType="com.hnjdxy.pojo.scheme">
select * from t_land_offer_scheme
</select>
<update id="update" parameterType="com.hnjdxy.pojo.scheme" >
UPDATE t_land_offer_scheme SET unit_name=#{unit_name},
period1_area=#{period1_area}, per_sum_area=#{per_sum_area},inputer=#{inputer}
WHERE bpl_guid=#{bpl_guid}
</update>
<select id="findUserByid" resultType="com.hnjdxy.pojo.scheme">
select * from t_land_offer_scheme where bpl_guid=#{bpl_guid}
</select>
</mapper>
service
package com.hnjdxy.service;
import java.util.List;
import com.hnjdxy.pojo.scheme;
public interface schemeService {
public List<scheme> findAll();
public int update(scheme scheme);
public scheme findUserByid(String bpl_guid);
}
serviceimpl
package com.hnjdxy.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hnjdxy.dao.schemeMapper;
import com.hnjdxy.pojo.scheme;
@Service
public class schemeServcieImpl implements schemeService {
@Autowired
private schemeMapper schememapper;
@Override
public List<scheme> findAll() {
// TODO Auto-generated method stub
return schememapper.findAll();
}
@Override
public int update(scheme scheme) {
// TODO Auto-generated method stub
return schememapper.update(scheme);
}
@Override
public scheme findUserByid(String bpl_guid) {
// TODO Auto-generated method stub
return schememapper.findUserByid(bpl_guid);
}
}
jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无</title>
</head>
<body>
<table width="495" border="1" style="border-collapse:collapse">
<tr>
<td width="72"><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000"> 说明书序号</font> </div></td>
<td width="72"><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000"> 单位名称 </font></div></td>
<td width="72"><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000" > 第一期面积</font></div></td>
<td width="95"><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000">本期用地总面积</font></div> </td>
<td width="46"><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000">填表人</font></div></td>
<td width="105"><div align="center"></div></td>
</tr>
<tr>
<c:forEach items="${list}" var="list">
<td><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000">${list.bpl_guid}</font></div></td>
<td><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000">${list.unit_name}</font> </div></td>
<td><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000">${list.period1_area}</font></div></td>
<td><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000">${list.per_sum_area}</font></div></td>
<td><div align="center"><font color="#3074A2" style="font-size:9pt;color:#000000">${list.inputer}</font></div></td>
<td>
<input type="button" name="bt1" value="删除">
<a href="${pageContext.request.contextPath }/findUserByid?${lists.bpl_guid}"><input type="button" name="bt2" value="修改" ></a>
</td>
</tr>
</c:forEach>
</table>
</body>
</html>
修改jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加供地方案
</title>
</head>
<body>
<script language="javascript">
</script>
<table width="340" border="0">
<tr><td width="553"><form action="${pageContext.request.contextPath }/update" method="post" name="form1" onSubmit="return check()">
<c:forEach items="${list}" var="lists">
<table width="290" height="70" border="1" align="center" style="border-collapse:collapse">
<tr>
<!-- 01 -->
<td width="131" height="9"><div align="right">
<font color="#3074A2" style="font-size: 9pt; color: #000000">说明书序号</font>
</div></td>
<td width="188"><input name="bpl_guid" type="text" id="bpl_guid" size="20" value="${lists.bpl_guid}" readonly="true"></td>
</tr>
<tr>
<!-- 蟠龙欣苑 -->
<td width="131" height="4"><div align="right">
<font color="#3074A2" style="font-size: 9pt; color: #000000">单位名称</font>
</div></td>
<td><input name="unit_name" type="text" id="unit_name" size="20" value="${lists.unit_name}"><span style="color: red;">*</span></td>
</tr>
<tr>
<!-- 20公顷 -->
<td width="131" height="29"><div align="right">
<font color="#3074A2" style="font-size: 9pt; color: #000000">第一期面积</font>
</div></td>
<td><input name="period1_area" type="text" id="period1_area" size="20" value="${lists.period1_area}"></td>
</tr>
<tr>
<!-- 110公顷 -->
<td width="131" height="4"><div align="right">
<font color="#3074A2" style="font-size: 9pt; color: #000000">本期用地总面积</font>
</div></td>
<td><input name="per_sum_area" type="text" id="per_sum_area" size="20" value="${lists.per_sum_area}"></td>
</tr>
<tr>
<!-- 方颜 -->
<td height="4"><div align="right">
<font color="#3074A2" style="font-size: 9pt; color: #000000">填表人</font>
</div></td>
<td><input name="inputer" type="text" id="inputer" size="20" value="${lists.inputer}"></td>
</tr>
<tr>
<td width="131" height="4"><div align="right"></div></td>
<td><input type="submit" name="bt1" value="确定"></td>
</tr>
</c:forEach>
</table>
</form></td>
</tr>
</table>
</body>
</html>
为什么我运行出来是空白的,点击修改就连表格都没有,