比如我在servlet 的 post方法中 声名一个 int id = 1122; 怎样在jsp中引用呢? servlet中:.....
int id = 1122;
request.setAttribute("userID", id);
.....------------------------------------------------------------------
jsp中:<%=request.getParameter("userID")%>为什么是null?
int id = 1122;
request.setAttribute("userID", id);
.....------------------------------------------------------------------
jsp中:<%=request.getParameter("userID")%>为什么是null?
解决方案 »
- jsp页面的跳转问题 急~!~!
- 请高手们帮帮我呀!好急呀!好急呀!好急呀!好急呀!
- test.jsp?username=豪华会议室 为何接受到的是"豪华会议�"
- 小弟在这愚蠢了,请各位大侠帮个忙,小弟跪谢了
- 一个下载的问题
- JAVA编译的问题,请大家帮帮忙!
- 高分求书!初学jsp,请介绍几本好书?高分求书!
- 谁有适用于jboss2.4.4的官方文档?
- 谁有与数据库相连的java beans 的源代码,能否共享?
- Hibernate映射中date类型和java.util.Date变Timestamp的问题
- jbpm3.2.2在发布流程时提示"Error deploying process: Archive is null "
- 要做一个个人网站 想做成RIA的 请问
jsp:<%=request.getParameter("userID")%>
你应该这么写int id = 1122;
request.setAttribute("userID", new Integer(id));然后你在前端jsp里面应该是
int id=(Integer)request.getAttribute("userID");
便可以获得了,
总结一下就是request,session,属性封装的时候应该是对象,不能是基本类型