homepage收获 jsp ----id isExist!

类别:软件工程 点击:0 评论:0 推荐:
//提交的jsp
Vector vector = new Vector();
  id = scbean.getAttSuccessfulCaseID();
  vector.addElement(String.valueOf(id));
session.setAttribute("id",vector);

//提交到的jsp
//script  function
    if(isExist(id.value)){
     alert("<ses:i18n localize='i18nId'>homepage.message.isExist</ses:i18n>");
     id.focus();
     id.select();
     return false;
    }
//
<SCRIPT LANGUAGE="JavaScript">
<%
Vector vector = (Vector) session.getAttribute("id");
%>
 p = new Array(<%=vector.size()%>)
<%
 for(int i=0;i<vector.size();i++)
 {
  Object object = vector.elementAt(i);
  String string = String.valueOf(object);
  out.println("p[" + i + "] = '" + string + "';");
 }
%>
 function isExist(id){ 
  for(j =0 ;j < p.length; j ++) {
   if(p[j] == id)
    return true;
  }
  return false;
 }
</SCRIPT>

本文地址:http://com.8s8s.com/it/it33198.htm