SSM框架取不到jsp页面值
点击查询把结果显示在下拉选单中Controller/**药房盘点页*根据时间查询盘点单号*/@RequestMapping("querydh")publicStringq...
点击查询 把结果显示在下拉选单中
Controller
/*
* 药房盘点页
* 根据时间查询盘点单号
*/
@RequestMapping("querydh")
public String querydh(HttpServletRequest request,String starttime , String endtime) {
System.out.println("controlle1");
String starttime1 =request.getParameter(starttime);
String endtime1 =request.getParameter(endtime);//获取不到值
System.out.println("controlle1"+starttime1+endtime1);
request.setAttribute("list", yfServer.querydh(starttime1, endtime1));
return "yaofang/yaofangpandian";
}
server
public interface YaoFangServer {
//药房根据时间查询盘点单号
public Map<String,Object >querydh( String starttime,String endtime);
impl
@Service
@Transactional
public class YaoFangServerimpl implements YaoFangServer{
@Resource(name="yaoFangMapper")
private YaoFangMapper yfMapper;
//时间查询 单号
@Override
public Map<String, Object> querydh(String starttime, String endtime) {
return yfMapper.querydh(starttime, endtime);
}
public interface YaoFangMapper {
/*
* 根据时间 查询盘点单号
*/
public Map<String,Object> querydh( String starttime,String endtime);
<select id="querydh">
SELECT dbo.mz_yfpdd.pddh
FROM
dbo.mz_yfpdd
WHERE dbo.mz_yfpdd.pdsj>#{starttime} and dbo.mz_yfpdd.pdsj #{endtime};
</select>
Jsp下拉选单
<form id="form1" action="" method="post">
<table style="border-collapse:separate; border-spacing:40px;">
<thead>
<tr>
<th>
<font style="font-size:15px">开始时间</font> <input class="jcDate" name="starttime"
style="width:180px; height:36px; line-height:20px; padding:4px;"
id="start"
value="" />
</th>
<th>
<font style="font-size:15px">结束时间</font> <input class="jcDate" name="endtime"
style="width:180px; height:36px; line-height:20px; padding:4px;"
id="end"
value="" />
</th>
<th >
<input class="btn btn-primary" type="button" id="btn1" value="查询">
</th>
<th>
<font style="font-size:15px">盘点单号</font>
<select id="select" name="pddh" style="width:180px; height:36px; line-height:20px; padding:4px;" >
<option>请选择单号</option>
<c:forEach items="${list}" var="d" varStatus="status">
<option>请选择单号</option>
<option value="${d}">${d}</option>
</c:forEach>
</select>
</th>
<th> <font color="red" id="msg" >${msg}</font></th>
</tr>
</thead>
</table>
</form> 展开
Controller
/*
* 药房盘点页
* 根据时间查询盘点单号
*/
@RequestMapping("querydh")
public String querydh(HttpServletRequest request,String starttime , String endtime) {
System.out.println("controlle1");
String starttime1 =request.getParameter(starttime);
String endtime1 =request.getParameter(endtime);//获取不到值
System.out.println("controlle1"+starttime1+endtime1);
request.setAttribute("list", yfServer.querydh(starttime1, endtime1));
return "yaofang/yaofangpandian";
}
server
public interface YaoFangServer {
//药房根据时间查询盘点单号
public Map<String,Object >querydh( String starttime,String endtime);
impl
@Service
@Transactional
public class YaoFangServerimpl implements YaoFangServer{
@Resource(name="yaoFangMapper")
private YaoFangMapper yfMapper;
//时间查询 单号
@Override
public Map<String, Object> querydh(String starttime, String endtime) {
return yfMapper.querydh(starttime, endtime);
}
public interface YaoFangMapper {
/*
* 根据时间 查询盘点单号
*/
public Map<String,Object> querydh( String starttime,String endtime);
<select id="querydh">
SELECT dbo.mz_yfpdd.pddh
FROM
dbo.mz_yfpdd
WHERE dbo.mz_yfpdd.pdsj>#{starttime} and dbo.mz_yfpdd.pdsj #{endtime};
</select>
Jsp下拉选单
<form id="form1" action="" method="post">
<table style="border-collapse:separate; border-spacing:40px;">
<thead>
<tr>
<th>
<font style="font-size:15px">开始时间</font> <input class="jcDate" name="starttime"
style="width:180px; height:36px; line-height:20px; padding:4px;"
id="start"
value="" />
</th>
<th>
<font style="font-size:15px">结束时间</font> <input class="jcDate" name="endtime"
style="width:180px; height:36px; line-height:20px; padding:4px;"
id="end"
value="" />
</th>
<th >
<input class="btn btn-primary" type="button" id="btn1" value="查询">
</th>
<th>
<font style="font-size:15px">盘点单号</font>
<select id="select" name="pddh" style="width:180px; height:36px; line-height:20px; padding:4px;" >
<option>请选择单号</option>
<c:forEach items="${list}" var="d" varStatus="status">
<option>请选择单号</option>
<option value="${d}">${d}</option>
</c:forEach>
</select>
</th>
<th> <font color="red" id="msg" >${msg}</font></th>
</tr>
</thead>
</table>
</form> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询