发送
int pageCount=ubc.getPageCount();
request.setAttribute("pageCount",new Integer(pageCount));
接收
String s_pageCount=(String)request.getAttribute("pageCount");
int pageCount=Integer.parseInt(s_pageCount);
为什么会在String s_pageCount=(String)request.getAttribute("pageCount");这句报错 把上面的new Integer(pageCount)改成pageCount+"" 就对
解决方案 »
- Ext得表单。求解答。。在线等!急!!!!
- 求助:用Runtime的exec方法执行svn的备份命令,命令执行完毕,但是并没有在相应的目录下生成备份文件?
- 如何用js实现网页浮动窗口
- 一个困饶我一周的问题,帮帮忙吧!
- 求助!The server encountered an internal error () that prevented it from fulfilling this request.
- getremotehost的问题
- JSP页面直接取action里的值,怎么取?
- 请在广州做web开发的在这里留个联系方式
- Servlet生命周期问题
- Jsp中怎么得到submit的值?
- 急急、、用applet画图的方法
- 一个简单的AJAX问题
int pageCount=ubc.getPageCount();
request.setAttribute("pageCount",pageCount);
//接收
int pageCount=(int)request.getAttribute("pageCount");
另外,基本数据类型java会自己封装成对象的,int----》Integer,float----》Float..........因此
setAttribute("pageCount",pageCount)就可以了。。
pageCount+"" 的意思是将pageCount转为字符串。。