这个问题似乎只需要一点点简单的Javascript的知识就可以做到了吧。:)
随便找个写过JS 的人可以给你一堆如何在提交前校验各个字段(是否为空,是否数字,是否EMAIL,等等等等)的例子。好象用不着象你题目上写的重定向吧。

解决方案 »

  1.   

    不可能的,jsp在后台运行,不可能知道前台的分页情况,你可以用javascript来解决。
    <%
    if (request.getParameter("text").equals("")) {
    %>
    <script language="JavaScript">
    window.open('some.jsp', '')
    </script>
    <%
    } else {
       response.sendRedirect("some.jsp");
    }
    %>
      

  2.   

    不错,用javascript可以做,但是怎样将弹出的窗口的菜单和工具按钮去掉?
      

  3.   

    <a href="javascript:window.open("tmp.htm",'WinName','scrollbars= 1,resizable=0,width=700,height=500"></a>
      

  4.   

    新开窗口
    <a href="javascript:window.open("some.htm","","menubar=no, toolbar=no">some.htm</a> 
    没有菜单和工具蓝
    在新开的窗口可以用opener指向原窗口。比如原窗口有form名为aform,里面有一个input1
    那么可以用
    opener.document.aform.input1.value得到它的值
      

  5.   

    不好意思,请问这句是javascript?
    怎么关掉这个打开的窗口?windows.close()?
      

  6.   

    我已经完成了,我把所有代码贴出来共享.
    peihe_bilv.jsp<%@page import="java.sql.*,java.util.*" contentType="text/html;charset=Shift-JIS"%>
    <%@page import="cn.com.food.entity.haig.*" %>
    <%@page import="java.util.*" %>
    <%@page import="java.lang.*" %>
    <%@page import="java.sql.Date" %>
    <%@page import="javax.ejb.FinderException" %><html>
    <head>
    <title>怴妛峑媼怘僔僗僥儉亅暯嬒強梫塰梴検曄峏</title>
    <style type="text/css">
    h2 {color:maroon;text-decoration:underline;text-align:center;}
    .p1 {text-align:center;}
    .p2 {margin-right:50;text-align:right;}
    .p3 {background-color: #ACDDB6;}
    .p4 {text-align:left;}
    </style>
    <script language="JavaScript"><!--
    function input(ok)
    {
        if (!confirm("Are you sure to update?")){
            return false;
        }
        return true;
    }
    // --></script>
    </head>
    <%!
    public class checks{
    public String checknum(String snum)
    {
    String sr="";
    double num=0.0;
    if ((snum=="") || (snum.length()==0))
    {
    }
    else
    {
    num=Double.valueOf(snum).doubleValue();
    if (num>1000.0)
    {
    sr="The number"+num+"  is more than 1000 !";
    }
    }
    return sr;
    }
    public String checkin(String s1,String t1){
    String sr="";
    if (t1=="1")//char
    {
    if (s1.length()>5)
    {
    sr="The input :"+s1+" long more than 5.";
    }
    }
    else
    {
    if (t1=="2")//num
    {
    for (int i=0;i<s1.length() ;i++ )
    {   
    char c1=s1.charAt(i);
    if ((c1<'0') || (c1>'9'))
    {
    if (c1=='.')
    {}
    else
    {
    sr="The input :"+s1+" is not the right number.";
    break;
    }
    }
    }
    }
    else
    {
    if (t1=="3")//time
    {
    if (s1.length()!=8)
    {
    sr="The input :"+s1+" length must be 8 and yyyymmdd type.";
    }
    else
    {//add code to do check the date or time type is well or not.
    //
    }
    }
    }
    }
    return sr;
    }
    }
    %>
    <%
    String chuli="";
    String shipinfanhao="";
    String shipinname="";
    String[] show=new String[20];
    String flagin="";
    String flagcopy="";
    String flagbutton="";
    String errorinfo="";
    String[] paramin=new String[20];
    String err="";
    String paramcopy="";
    double[] dataupdate=new double[20];
    chuli=(String) session.getAttribute("clqffrom");
    shipinfanhao=(String) session.getAttribute("spfhfrom");
    shipinname=(String) session.getAttribute("spnfrom");
    String copyto="";
    //copyto=(String) session.getAttribute("copyto");if ((chuli.equals("峏怴")) || (chuli.equals("怴婯")) || (chuli.equals("専嶕")) || (chuli.equals("嶍彍")))
    {
    Properties props = System.getProperties();
    javax.naming.Context ctx = new javax.naming.InitialContext(props);
    HaigHome home = (HaigHome) ctx.lookup("HaigHome"); if (request.getParameter("back")!=null)
    {//go to back
    response.sendRedirect("shipin_main.jsp");
    } else if (request.getParameter("submit1")!=null)  //click the chuli button
    {//submit
    // errorinfo="click the "+chuli+" button!";
    if ((chuli.equals("峏怴"))||(chuli.equals("怴婯")))
    {
    for (int col=0;col<20;col++)
    {
    if (request.getParameter("ei"+col)!=null)
    {
    paramin[col]=request.getParameter("ei"+col);
    if (paramin[col].length()==0) {paramin[col]="";}
    checks fc=new checks();
    //check the input FlingName is String and length less than 80
    err=fc.checkin(paramin[col],"2");
    if (err!="") 
    {
    errorinfo=err;
    break;
    }
    else
    {
    err=fc.checknum(paramin[col]);
    if (err!="")
    {
    errorinfo=err;
    break;
    }
    }
    }
    else
    {
    paramin[col]="";
    };
    }
    }
    if ((chuli.equals("峏怴"))&&(errorinfo==""))//update
    {
    try
    {
    HaigPK s1 =new HaigPK(shipinfanhao);
    Haig source1 = home.findByPrimaryKey(s1);
    for (int row=0;row<20;row++)
    {
    if ((paramin[row]=="")||(paramin[row].length()==0))
    {
    dataupdate[row]=0.0;
    }
    else
    {
    dataupdate[row]=Double.valueOf(paramin[row]).doubleValue();
    }
    };
    //get the airline date from the findbyprimarykey
    source1.setKokurui(dataupdate[0]);
    source1.setImo(dataupdate[1]);
    source1.setSatou(dataupdate[2]);
    source1.setKasi(dataupdate[3]);
    source1.setAbura(dataupdate[4]);
    source1.setTane(dataupdate[5]);
    source1.setMiso(dataupdate[6]);
    source1.setDaizu(dataupdate[7]);
    source1.setFish(dataupdate[8]);
    source1.setFish_s(dataupdate[9]);
    source1.setMeat(dataupdate[10]);
    source1.setEgg(dataupdate[11]);
    source1.setNyuuseihin(dataupdate[12]);
    source1.setYasai_midori(dataupdate[13]);
    source1.setYasai_sonota(dataupdate[14]);
    source1.setFruit(dataupdate[15]);
    source1.setKinoko(dataupdate[16]);
    source1.setSourui(dataupdate[17]);
    source1.setDrink(dataupdate[18]);
    source1.setSonota(dataupdate[19]);
    source1.setUp_user("jin");
    java.util.Date nowdate=new java.util.Date();
    long timeLong=nowdate.getTime();
    java.sql.Date update =new java.sql.Date(timeLong);
    source1.setUp_date(update);
    errorinfo="Update succeed!"; show[0]=(new Double(source1.getKokurui())).toString();
            show[1]=(new Double(source1.getImo())).toString();
            show[2]=(new Double(source1.getSatou())).toString();
            show[3]=(new Double(source1.getKasi())).toString();
    show[4]=(new Double(source1.getAbura())).toString();
            show[5]=(new Double(source1.getTane())).toString();
            show[6]=(new Double(source1.getMiso())).toString();
            show[7]=(new Double(source1.getDaizu())).toString();
            show[8]=(new Double(source1.getFish())).toString();
            show[9]=(new Double(source1.getFish_s())).toString();
            show[10]=(new Double(source1.getMeat())).toString();
            show[11]=(new Double(source1.getEgg())).toString();
            show[12]=(new Double(source1.getNyuuseihin())).toString();
            show[13]=(new Double(source1.getYasai_midori())).toString();
            show[14]=(new Double(source1.getYasai_sonota())).toString();
            show[15]=(new Double(source1.getFruit())).toString();
            show[16]=(new Double(source1.getKinoko())).toString();
            show[17]=(new Double(source1.getSourui())).toString();
            show[18]=(new Double(source1.getDrink())).toString();
            show[19]=(new Double(source1.getSonota())).toString();
    }
    catch (FinderException e)
    {
    errorinfo="No this data:"+shipinfanhao +" !";
    } };
    if ((chuli.equals("怴婯"))&&(errorinfo==""))//insert
    {
    HaigPK s1 =new HaigPK(shipinfanhao);
    try
    {
    Haig source1 = home.findByPrimaryKey(s1);
    errorinfo="There have this record,can't input again!";
    }
    catch (FinderException e)
    {
    for (int row=0;row<20;row++)
    {
    if ((paramin[row]=="")||(paramin[row].length()==0))
    {
    dataupdate[row]=0.0;
    }
    else
    {
    dataupdate[row]=Double.valueOf(paramin[row]).doubleValue();
    }
    };
    java.util.Date nowdate=new java.util.Date();
    long timeLong=nowdate.getTime();
    java.sql.Date crdate =new java.sql.Date(timeLong);
    java.sql.Date update=new java.sql.Date(timeLong);
    Haig source1=(Haig)  home.create(shipinfanhao,dataupdate[0],dataupdate[1],dataupdate[2],dataupdate[3],dataupdate[4],dataupdate[5],dataupdate[6],dataupdate[7],dataupdate[8],dataupdate[9],dataupdate[10],dataupdate[11],dataupdate[12],dataupdate[13],dataupdate[14],dataupdate[15],dataupdate[16],dataupdate[17],dataupdate[18],dataupdate[19],"jin",update,crdate);
    errorinfo="Insert succeed!You can update!";
    show[0]=(new Double(source1.getKokurui())).toString();
            show[1]=(new Double(source1.getImo())).toString();
            show[2]=(new Double(source1.getSatou())).toString();
            show[3]=(new Double(source1.getKasi())).toString();
    show[4]=(new Double(source1.getAbura())).toString();
            show[5]=(new Double(source1.getTane())).toString();
            show[6]=(new Double(source1.getMiso())).toString();
            show[7]=(new Double(source1.getDaizu())).toString();
            show[8]=(new Double(source1.getFish())).toString();
            show[9]=(new Double(source1.getFish_s())).toString();
            show[10]=(new Double(source1.getMeat())).toString();
            show[11]=(new Double(source1.getEgg())).toString();
            show[12]=(new Double(source1.getNyuuseihin())).toString();
            show[13]=(new Double(source1.getYasai_midori())).toString();
            show[14]=(new Double(source1.getYasai_sonota())).toString();
            show[15]=(new Double(source1.getFruit())).toString();
            show[16]=(new Double(source1.getKinoko())).toString();
            show[17]=(new Double(source1.getSourui())).toString();
            show[18]=(new Double(source1.getDrink())).toString();
            show[19]=(new Double(source1.getSonota())).toString();
    chuli="峏怴";
        session.setAttribute("clqffrom",chuli);
        session.setAttribute("spfhfrom",shipinfanhao);
        session.setAttribute("spnfrom",shipinname);
    }
    };
    if (chuli.equals("嶍彍"))//delete
    {
    HaigPK s1 =new HaigPK(shipinfanhao);
    try
    {
    Haig source1 = home.findByPrimaryKey(s1);
    source1.remove();
    errorinfo="Delete succeed!";
    response.sendRedirect("shipin_main.jsp");
    }
    catch (FinderException e)
    {
    errorinfo="No this data:"+shipinfanhao +" !";
    }
    };
    }
    else
    {//get data
        session.setAttribute("clqf",chuli);
        session.setAttribute("spfh",chuli);
        session.setAttribute("spn",chuli);
    HaigPK s1 =new HaigPK(shipinfanhao);
    try
    {
    Haig source1 = home.findByPrimaryKey(s1);
            show[0]=(new Double(source1.getKokurui())).toString();
            show[1]=(new Double(source1.getImo())).toString();
            show[2]=(new Double(source1.getSatou())).toString();
            show[3]=(new Double(source1.getKasi())).toString();
            show[4]=(new Double(source1.getAbura())).toString();
            show[5]=(new Double(source1.getTane())).toString();
            show[6]=(new Double(source1.getMiso())).toString();
            show[7]=(new Double(source1.getDaizu())).toString();
            show[8]=(new Double(source1.getFish())).toString();
            show[9]=(new Double(source1.getFish_s())).toString();
            show[10]=(new Double(source1.getMeat())).toString();
            show[11]=(new Double(source1.getEgg())).toString();
            show[12]=(new Double(source1.getNyuuseihin())).toString();
            show[13]=(new Double(source1.getYasai_midori())).toString();
            show[14]=(new Double(source1.getYasai_sonota())).toString();
            show[15]=(new Double(source1.getFruit())).toString();
            show[16]=(new Double(source1.getKinoko())).toString();
            show[17]=(new Double(source1.getSourui())).toString();
            show[18]=(new Double(source1.getDrink())).toString();
            show[19]=(new Double(source1.getSonota())).toString();
    }
    catch (FinderException e)
    {
    errorinfo="No this data:"+shipinfanhao +" !";
    if (chuli.equals("怴婯"))
    {errorinfo="";}
    } };
    if (request.getParameter("copy")!=null)
    {//copy data
    // errorinfo="click the copy button!";
    paramcopy=request.getParameter("copyid");
    if (paramcopy.length()==0)  { paramcopy=""; }
    if (paramcopy=="")
    {
    //show the all record
    out.println("<script language=\"JavaScript\">");
    out.println("window.open(\"copydata.jsp\",'',\"scrollbars=1,resizable=0,width=800,height=400,left=100,top=100\")");
    out.println("</script>");
    }
    else
    {
    //do the copy work
    HaigPK s4 =new HaigPK(paramcopy);
    try
    {
    Haig source1 = home.findByPrimaryKey(s4);
            show[0]=(new Double(source1.getKokurui())).toString();
            show[1]=(new Double(source1.getImo())).toString();
            show[2]=(new Double(source1.getSatou())).toString();
            show[3]=(new Double(source1.getKasi())).toString();
            show[4]=(new Double(source1.getAbura())).toString();
            show[5]=(new Double(source1.getTane())).toString();
            show[6]=(new Double(source1.getMiso())).toString();
            show[7]=(new Double(source1.getDaizu())).toString();
            show[8]=(new Double(source1.getFish())).toString();
            show[9]=(new Double(source1.getFish_s())).toString();
            show[10]=(new Double(source1.getMeat())).toString();
            show[11]=(new Double(source1.getEgg())).toString();
            show[12]=(new Double(source1.getNyuuseihin())).toString();
            show[13]=(new Double(source1.getYasai_midori())).toString();
            show[14]=(new Double(source1.getYasai_sonota())).toString();
            show[15]=(new Double(source1.getFruit())).toString();
            show[16]=(new Double(source1.getKinoko())).toString();
            show[17]=(new Double(source1.getSourui())).toString();
            show[18]=(new Double(source1.getDrink())).toString();
        show[19]=(new Double(source1.getSonota())).toString();
    errorinfo="You have copy it succeed!Please click the submit button!";
    }
    catch (FinderException e)
    {
    errorinfo="No this data:"+shipinfanhao +" !You can't copy it!";
    // if (chuli.equals("怴婯"))
    // {errorinfo="";}
    }
    } }
    }
    else
    {   
    chuli="feifajinru";
    shipinfanhao="feifajinru";
    shipinname="feifajinru";
    show=new String[20];
    flagin="";
    flagcopy="";
    flagbutton="";
    errorinfo="";
    };if ((chuli.equals("峏怴")) || (chuli.equals("怴婯")) || (chuli.equals("嶍彍")))
    {
    flagbutton="";
    }
    else
    {
    flagbutton="disabled";
    };
    if ((chuli.equals("峏怴")) || (chuli.equals("怴婯")))
    {
    flagin="";
    flagcopy="visible";
    }
    else
    {
    flagin="disabled";
    flagcopy="hidden";
    };
    if ((chuli.equals("怴婯"))&&(request.getParameter("copy")==null))
    {
    for (int i=0;i<20;i++)
    {
    show[i]="";
    }
    }
    else
    {
    };
    //if (((chuli.equals("峏怴"))||chuli.equals("怴婯"))&&(((paramcopy!="")&&(errinfo!=null))||())
    %>
    <body background="images/b50.gif">
    <h2><b>怘昳儅僗僞丂攝崌斾棪</b></h2>
    <center>
    <h4> 乮倄倄倄倄亅俵俵亅俢俢丂尰嵼乯 </h4>
    <br>
    <form action="peihe_bilv.jsp"  method=post name=form1><table border="0" cellspacing="0" cellpadding="1" width="760">
    <tr height=36>
    <td colspan=2>
    <table border=1 cellspacing="0" cellpadding="1" width=40%>
    <tr>
    <td width=40% class="p3">張棟嬫暘</td>
    <td><%=chuli%></td>
    </tr>
    </table>
    </td>
    <td width=34% rowspan=2 valign="bottom">
    <div id="1" style="visibility:<%=flagcopy%>">
    <table border=1 cellspacing="0" cellpadding="1" width=100% height=100%><tr><td valign=bottom>
    仸僐僺乕乮怴婯嶌惉帪偺傒乯<br>
    <table border=1 cellspacing="0" cellpadding="1" width=100%>
    <tr>
    <td width=40% class="p3">怘昳斣崋</td>
    <td width=40%><input type="input" name="copyid" size=10 maxlength=6></td>
    <td><input type="submit" name="copy" value=" 幚 峴 "></td>
    </tr>
    </table>
    </td></tr></table>
    </div>
    </td>
    </tr>
    <tr height=36>
    <td width=33%>
    <table border=1 cellspacing="0" cellpadding="1" width=80%>
    <tr>
    <td width=40% class="p3">怘昳斣崋</td>
    <td><%=shipinfanhao%></td>
    </tr>
    </table>
    </td>
    <td width=33%>
    <table border=1 cellspacing="0" cellpadding="1">
    <tr>
    <td width=40% class="p3">怘丂昳丂柤</td>
    <td><%=shipinname%></td>
    </tr>
    </table>
    </td>
    </tr>
    </table><br><table border="1" cellspacing="0" cellpadding="1" width=760>
      <tr>
        <td class="p3" width=34% colspan=2>
          <p class="p1">嬫暘</p>
        </td>
        <td class="p3" width=16%>
          <p class="p1">攝崌斾棪乮亾乯</p>
        </td>
        <td class="p3" width=34% colspan=2>
          <p class="p1">嬫暘</p>
        </td>
        <td class="p3" width=16%>
          <p class="p1">攝崌斾棪乮亾乯</p>
        </td>
      </tr>
      <tr>
        <td class="p3" colspan=2>
          <p class="p4">崚椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei0" size="10" maxlength="5" <%=flagin%> value=<%=show[0]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">廱捁擏椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei10" size="10" maxlength="5" <%=flagin%> value=<%=show[10]%>>
        </td>
      </tr>
      <tr>
        <td class="p3" colspan=2>
          <p class="p4">偄傕媦傃偱傫暡椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei1" size="10" maxlength="5" <%=flagin%> value=<%=show[1]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">棏椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei11" size="10" maxlength="5" <%=flagin%> value=<%=show[11]%>>
        </td>
      </tr>
      <tr>
        <td class="p3" colspan=2>
          <p class="p4">嵒摐媦傃娒枴椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei2" size="10" maxlength="5" <%=flagin%> value=<%=show[2]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">擕惢昳</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei12" size="10" maxlength="5" <%=flagin%> value=<%=show[12]%>>
        </td>
      </tr>
      <tr>
        <td class="p3" colspan=2>
          <p class="p4">壻巕椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei3" size="10" maxlength="5" <%=flagin%> value=<%=show[3]%>>
        </td>
        <td class="p3" rowspan=2 width=10%>
          <p class="p4">栰嵷</p>
        </td>
    <td class="p3" >
          <p class="p4">椢墿怓栰嵷</p>
    </td>
        <td class="p3" align=center>
          <input type="text" name="ei13" size="10" maxlength="5" <%=flagin%> value=<%=show[13]%>>
        </td>
      </tr>
      <tr>
        <td class="p3" colspan=2>
          <p class="p4">桘帀椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei4" size="10" maxlength="5" <%=flagin%> value=<%=show[4]%>>
        </td>
        <td class="p3">
          <p class="p4">偦偺懠偺栰嵷 </p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei14" size="10" maxlength="5" <%=flagin%> value=<%=show[14]%>>
        </td>
      </tr>
      <tr>
        <td class="p3" colspan=2>
          <p class="p4">庬幚椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei5" size="10" maxlength="5" <%=flagin%> value=<%=show[5]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">壥幚椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei15" size="10" maxlength="5" <%=flagin%> value=<%=show[15]%>>
        </td>
      </tr>
      <tr>
        <td class="p3" rowspan=2 width=10%>
          <p class="p4">摛椶</p>
    </td>
        <td class="p3" >
          <p class="p4">枴慩</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei6" size="10" maxlength="5" <%=flagin%> value=<%=show[6]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">偒偺偙椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei16" size="10" maxlength="5" <%=flagin%> value=<%=show[16]%>>
        </td>
      </tr>
      <tr>
        <td class="p3">
          <p class="p4">戝摛惢昳偦偺懠</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei7" size="10" maxlength="5" <%=flagin%> value=<%=show[7]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">憯椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei17" size="10" maxlength="5" <%=flagin%> value=<%=show[17]%>>
        </td>
      </tr>
      <tr>
        <td class="p3" rowspan=2 width=10%>
          <p class="p4">嫑夘椶</p>
        </td>
        <td class="p3">
          <p class="p4">嫑夘椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei8" size="10" maxlength="5" <%=flagin%> value=<%=show[8]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">歯岲堸椏椶</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei18" size="10" maxlength="5" <%=flagin%> value=<%=show[18]%>>
        </td>
      </tr>
      <tr>
        <td class="p3">
          <p class="p4">乮偆偪彫嫑乯</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei9" size="10" maxlength="5" <%=flagin%> value=<%=show[9]%>>
        </td>
        <td class="p3" colspan=2>
          <p class="p4">偦偺懠</p>
        </td>
        <td class="p3" align=center>
          <input type="text" name="ei19" size="10" maxlength="5" <%=flagin%> value=<%=show[19]%>>
        </td>
      </tr>
    </table><br>
    <table border="0">
      <tr>
        <td>
          <input type="submit" <%=flagbutton%> value=<%out.println("丂"+chuli+"丂");%> name="submit1" onclick="return input(this)">
        </td>
        <td>
          <input type="submit" value="丂廔椆丂" name="back">
        </td>
      </tr>
    </table>
    </form>
    </center>
    <%
    if (errorinfo!="")
    {     
    out.print("<script language=\"javascript\">alert(\""+errorinfo+"\");</script>");
    };
    %>
    </body>
    </html>copydata.jsp<%@page import="java.sql.*,java.util.*" contentType="text/html;charset=Shift-JIS"%>
    <%@page import="cn.com.food.entity.haig.*" %>
    <%@page import="java.util.*" %>
    <%@page import="java.lang.*" %>
    <%@page import="java.sql.Date" %>
    <%@page import="javax.ejb.FinderException" %>
    <html>
    <head>
    <title>copy data</title>
    <style type="text/css">
    h2 {color:maroon;text-decoration:underline;text-align:center;}
    .p1 {text-align:center;}
    .p2 {margin-right:50;text-align:right;}
    .p3 {background-color: #ACDDB6;}
    .p4 {text-align:left;}
    </style>
    <script language="JavaScript"><!--
    function input(ok)
    {
      for(var i=0;i<f1.ss.length;i++)
        if (f1.ss[i].checked)
        {
          document.f1.middle.value=f1.r1[i].value;
          return true;
        };
      alert('You must select one to copy!please select!');    
      return false;
    }
    // --></script>
    </head>
    <%
    String chuli="";
    String shipinfanhao="";
    String shipinname="";
    String[] show=new String[20];
    String flagin="";
    String flagcopy="";
    String flagbutton="";
    String errorinfo="";
    String[] paramin=new String[20];
    String err="";
    String paramcopy="";
    int i=0;
    double[] dataupdate=new double[20];
    chuli=(String) session.getAttribute("clqffrom");
    shipinfanhao=(String) session.getAttribute("spfhfrom");
    shipinname=(String) session.getAttribute("spnfrom");
    Properties props = System.getProperties();
    javax.naming.Context ctx = new javax.naming.InitialContext(props);
    HaigHome home = (HaigHome) ctx.lookup("HaigHome"); if ((request.getParameter("submit1")!=null)||(request.getParameter("back")!=null))
    {
    if (request.getParameter("submit1")!=null)
    {
    //write
    paramcopy=request.getParameter("ss");
    System.out.println(paramcopy);
    HaigPK s4 =new HaigPK(paramcopy);
    Haig source1 = home.findByPrimaryKey(s4);
            show[0]=(new Double(source1.getKokurui())).toString();
            show[1]=(new Double(source1.getImo())).toString();
            show[2]=(new Double(source1.getSatou())).toString();
            show[3]=(new Double(source1.getKasi())).toString();
            show[4]=(new Double(source1.getAbura())).toString();
            show[5]=(new Double(source1.getTane())).toString();
            show[6]=(new Double(source1.getMiso())).toString();
            show[7]=(new Double(source1.getDaizu())).toString();
            show[8]=(new Double(source1.getFish())).toString();
            show[9]=(new Double(source1.getFish_s())).toString();
            show[10]=(new Double(source1.getMeat())).toString();
            show[11]=(new Double(source1.getEgg())).toString();
            show[12]=(new Double(source1.getNyuuseihin())).toString();
            show[13]=(new Double(source1.getYasai_midori())).toString();
            show[14]=(new Double(source1.getYasai_sonota())).toString();
            show[15]=(new Double(source1.getFruit())).toString();
            show[16]=(new Double(source1.getKinoko())).toString();
            show[17]=(new Double(source1.getSourui())).toString();
            show[18]=(new Double(source1.getDrink())).toString();
        show[19]=(new Double(source1.getSonota())).toString();  out.println("<script language=\"JavaScript\">");
    out.println("opener.document.form1.ei0.value=\""+show[0]+"\";");
    out.println("opener.document.form1.ei1.value=\""+show[1]+"\";");
    out.println("opener.document.form1.ei2.value=\""+show[2]+"\";");
    out.println("opener.document.form1.ei3.value=\""+show[3]+"\";");
    out.println("opener.document.form1.ei4.value=\""+show[4]+"\";");
    out.println("opener.document.form1.ei5.value=\""+show[5]+"\";");
    out.println("opener.document.form1.ei6.value=\""+show[6]+"\";");
    out.println("opener.document.form1.ei7.value=\""+show[7]+"\";");
    out.println("opener.document.form1.ei8.value=\""+show[8]+"\";");
    out.println("opener.document.form1.ei9.value=\""+show[9]+"\";");
    out.println("opener.document.form1.ei10.value=\""+show[10]+"\";");
    out.println("opener.document.form1.ei11.value=\""+show[11]+"\";");
    out.println("opener.document.form1.ei12.value=\""+show[12]+"\";");
    out.println("opener.document.form1.ei13.value=\""+show[13]+"\";");
    out.println("opener.document.form1.ei14.value=\""+show[14]+"\";");
    out.println("opener.document.form1.ei15.value=\""+show[15]+"\";");
    out.println("opener.document.form1.ei16.value=\""+show[16]+"\";");
    out.println("opener.document.form1.ei17.value=\""+show[17]+"\";");
    out.println("opener.document.form1.ei18.value=\""+show[18]+"\";");
    out.println("opener.document.form1.ei19.value=\""+show[19]+"\";");
    out.println("</script>");
    };
    out.println("<script language=\"JavaScript\">");
    out.println("window.close()");
    out.println("</script>");
    }
    else
    { //do the copy work
    Enumeration v = home.findAllRecord();
    Haig source1 = null;%>
    <body background="images/b50.gif">
    please select the data and submit.
    <br>
    <form action="copydata.jsp" method=post name=f1>
    <table border="1" cellspacing="0" cellpadding="1">
    <tr>
    <td class="p3">Select</td><td class="p3">怘昳斣崋</td><td class="p3">崚椶</td><td class="p3">偄傕媦傃偱傫暡椶</td><td class="p3">嵒摐媦傃娒枴椶</td><td class="p3">壻巕椶</td><td class="p3">桘帀椶</td><td class="p3">庬幚椶</td><td class="p3">枴慩</td><td class="p3">戝摛惢昳偦偺懠</td><td class="p3">嫑夘椶</td><td class="p3">乮偆偪彫嫑乯</td><td class="p3">廱捁擏椶</td><td class="p3">棏椶</td><td class="p3">擕惢昳</td><td class="p3">椢墿怓栰嵷</td><td class="p3">偦偺懠偺栰嵷</td><td class="p3">壥幚椶</td><td class="p3">偒偺偙椶</td><td class="p3">憯椶</td><td class="p3">歯岲堸椏椶</td><td class="p3">偦偺懠</td>
    </tr>
    <%
    while (v.hasMoreElements())
    {
    //get one airline date
       source1 = (Haig) v.nextElement();
    shipinfanhao=source1.getSyokuhin_no();
        show[0]=(new Double(source1.getKokurui())).toString();
        show[1]=(new Double(source1.getImo())).toString();
        show[2]=(new Double(source1.getSatou())).toString();
        show[3]=(new Double(source1.getKasi())).toString();
            show[4]=(new Double(source1.getAbura())).toString();
            show[5]=(new Double(source1.getTane())).toString();
            show[6]=(new Double(source1.getMiso())).toString();
            show[7]=(new Double(source1.getDaizu())).toString();
            show[8]=(new Double(source1.getFish())).toString();
            show[9]=(new Double(source1.getFish_s())).toString();
            show[10]=(new Double(source1.getMeat())).toString();
            show[11]=(new Double(source1.getEgg())).toString();
            show[12]=(new Double(source1.getNyuuseihin())).toString();
            show[13]=(new Double(source1.getYasai_midori())).toString();
            show[14]=(new Double(source1.getYasai_sonota())).toString();
            show[15]=(new Double(source1.getFruit())).toString();
            show[16]=(new Double(source1.getKinoko())).toString();
            show[17]=(new Double(source1.getSourui())).toString();
            show[18]=(new Double(source1.getDrink())).toString();
        show[19]=(new Double(source1.getSonota())).toString();
    i=i+1;%>
    <tr>
    <td width="100" align="left"><input type=radio name=ss value="<%=shipinfanhao%>"></td>
    <td width="100" align="center"><%=shipinfanhao%></td>
    <td width="100" align="center"><%=show[0]%></td>
    <td width="100" align="center"><%=show[1]%></td>
    <td width="100" align="center"><%=show[2]%></td>
    <td width="100" align="center"><%=show[3]%></td>
    <td width="100" align="center"><%=show[4]%></td>
    <td width="100" align="center"><%=show[5]%></td>
    <td width="100" align="center"><%=show[6]%></td>
    <td width="100" align="center"><%=show[7]%></td>
    <td width="100" align="center"><%=show[8]%></td>
    <td width="100" align="center"><%=show[9]%></td>
    <td width="100" align="center"><%=show[10]%></td>
    <td width="100" align="center"><%=show[11]%></td>
    <td width="100" align="center"><%=show[12]%></td>
    <td width="100" align="center"><%=show[13]%></td>
    <td width="100" align="center"><%=show[14]%></td>
    <td width="100" align="center"><%=show[15]%></td>
    <td width="100" align="center"><%=show[16]%></td>
    <td width="100" align="center"><%=show[17]%></td>
    <td width="100" align="center"><%=show[18]%></td>
    <td width="100" align="center"><%=show[19]%></td>
    </tr>
    <%
    }
    }
    %>
    <form action="copydata.jsp" method=post>
    <table border="0">
      <tr>
        <td>
         <input type="hidden" value="hh" name="middle">
      <input type="submit" value="Copy" name="submit1" onclick="return input(this)">
        </td>
        <td>
          <input type="submit" value="丂廔椆丂" name="back">
        </td>
      </tr>
    </table>
    </form>
    </table>
    </body>