码迷,mamicode.com
首页 > 其他好文 > 详细

页面与页面之间传递参数

时间:2014-07-01 17:08:24      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:文件   os   cti   for   io   window   

方式一:

<jsp:useBean id="userForm" class="com.wgh.UserForm" scope="page"/>在这个类里面set get
<jsp:setProperty name="userForm" property="*"/>

 

输入框<input name="pwd" type="password" id="pwd"></td>要有类的一致

${userForm.pwd} 取得属性

 

方式二:

<form name="form1" method="post" action="PollServlet">
在配置文件里面

<servlet>
    <servlet-name>PollServlet</servlet-name>
    <servlet-class>com.wgh.servlet.PollServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>PollServlet</servlet-name>
    <url-pattern>/PollServlet</url-pattern>
  </servlet-mapping>

类里面用map元素

 String[] arr={"基础教程类","实例集锦类","经验技巧类","速查手册类","案例剖析类"};
   map=new HashMap();
   for(int i=0;i<arr.length;i++){
    if(item.equals(arr[i])){ //判断是否为选定的投票项
     map.put(arr[i], 1);
    }else{
     map.put(arr[i], 0);
    }

out.println("<script>alert(‘投票成功!‘);window.location.href=‘showResult.jsp‘;</script>"); //投票完之后来到这个页面

 

然后在这个界面‘showResult.jsp‘取得结果

  (${empty applicationScope.pollResult["案例剖析类"] ? 0 :applicationScope.pollResult["案例剖析类"]})

 

可以在这里返回结果    <input name="Button" type="button" class="btn_grey" value="返回" onClick="window.location.href=‘index.jsp‘"></td>

页面与页面之间传递参数,布布扣,bubuko.com

页面与页面之间传递参数

标签:文件   os   cti   for   io   window   

原文地址:http://www.cnblogs.com/bluewelkin/p/3818035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!