list在get请求怎么传值_页面传参和显示list(使用request)

controller接受参数并设置页面里的结果,接受的参数与页面的设置有关

//这里写注解,不然扫描不到.do

@Controller

public class WarehouseCheckController {

@Autowired

UserService ser;//要使用的service

@RequestMapping(value="Warehouse_Check_ProductShelfRelation.do",method={RequestMethod.GET,RequestMethod.POST})

//value里指明这个函数对应的.do

//页面里的action跳转时设置action="Warehouse_Check_ProductShelfRelation.do"就转到这个函数来处理

public ModelAndView linchao(HttpServletRequest request,Shelf sh){//这里加了HttpServletRequest参数,由页面传入,Shelf类由页面里的表单post而来

ModelAndView modelAndView=new ModelAndView();

modelAndView.setViewName("Warehouse_Check");

List list=ser.findAll();

request.setAttribute("atrlist",list);//这里注入list类参数

request.setAttribute("amount",13);//这里注入单个参数

return modelAndView;

}

}

在jsp页面的开头第二行加

通过form提交给controller参数

action="${pageContext.request.contextPath}/Warehouse_Check_ProductShelfRelation.do"

method="post">

货架名

name="shel_name" >

货架位置

name="shel_loc">

查询

table遍历一个list并动态添加显示出的行

数量${requestScope.amount}status.index ${user.user_email}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值