JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Web Design 版  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 多個Form的submit問題
redhobor





發文: 20
積分: 0
於 2005-04-01 00:45 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page language="java" import="csproject.MarkManage, csproject.StudentManage, csproject.ModuleManage, java.sql.*, java.lang.*, java.lang.String, java.sql.ResultSet, javax.servlet.*"%>
<jsp:useBean id="rstStruct" class="csproject.ResultStructBean" scope="request">
<jsp:setProperty name="rstStruct" property="*"/>
</jsp:useBean>
<jsp:useBean id="student" class="csproject.StudentBean" scope="request">
<jsp:setProperty name="student" property="*"/>
</jsp:useBean>
<jsp:useBean id="rstExam" class="csproject.ResultExmBean" scope="request">
<jsp:setProperty name="rstExam" property="*"/>
</jsp:useBean>
<html>
<%
  String mdl_id = request.getParameter("mdl_id");
  String mdl_name = (String) request.getParameter("mdl_name");
  String std_id = "";
  String std_surname = "";
  String std_forename = "";
  StudentManage studentManage = new StudentManage();
  MarkManage markManage = new MarkManage();
  rstStruct = markManage.getModuleStruct(mdl_id);
  int countexam = rstStruct.countExam();
  rstExam = null;
  String rst_exmid = "";
  double rst_exmfirst = -1;
  boolean rst_exmhasresit = false;
  double rst_exmresit = -1;
  double rst_exmresult = -1;
%>
</script><style type="text/css">
  <!--
    .style5 {font-size: 10px}
    .style8 {font-size: 12px}
  -->
</style>
<table width="100%" border="0">
  <tr>
    <td height="69" colspan="3">
      <center>
      <form action="">
        <h2><%=mdl_id + " " + mdl_name%>        </h2>
        <table width="100%" border="0">
          <tr bgcolor="#CCCCCC">
            <td width="15%">Student ID</td>
            <td width="15%">Student Name</td>
            <td width="50%">Exam Results</td>
            <td width="10%">Confirm</td>
            <td width="10%">Reset</td>
          </tr>
          <tr>
          <%
            ResultSet rs_student = (ResultSet) studentManage.getAllStudents();
            //Check if any student exists
            //If there has no student information stored in database
            if (rs_student.wasNull()) {
              out.print("<tr>No Information!</tr>");
            }
            //If there has student informaiton stored in database, then displays exam information for each student.
            else {
              while (rs_student.next()) {
                out.print("<tr>");
                out.print("<form name=\"frmMark\" method=\"post\" action=\"inputexamservlet\">");
                std_id = rs_student.getString("std_id");
                std_surname = rs_student.getString("std_surname");
                std_forename = rs_student.getString("std_forename");
                out.print("<td>" + std_id + "</td>");
                out.print("<td>" + std_forename + " " + std_surname + "</td>");
                out.print("<input type=\"hidden\" name=\"mdl_id\" value=\"" + mdl_id + "\">");
                out.print("<input type=\"hidden\" name=\"std_id\" value=\"" + std_id + "\">");
                out.print("<input type=\"hidden\" name=\"std_name\" value=\"" + std_forename + " " + std_surname + "\">");
                out.print("<input type=\"hidden\" name=\"countexam\" value=\"" + countexam + "\">");
                out.print("<td>");
                out.print("<table>");
                out.print("<tr bgcolor=\"#CCCCCC\">");
                out.print("<td width=\"20%\">Exam ID</td>");
                out.print("<td width=\"20%\">First Result</td>");
                out.print("<td width=\"20%\">Has Resit?</td>");
                out.print("<td width=\"20%\">Resit Result</td>");
                out.print("<td width=\"20%\">Final Result</td>");
                out.print("</tr>");
                //Display every exam
                for (int i = 1; i <= countexam; i++) {
                  rst_exmid = Integer.toString(i);
                  out.print("<tr>");
                  out.print("<td>" + rst_exmid + "</td>");
                  out.print("<input type=\"hidden\" name=\"rst_exmid\" value=\"" + rst_exmid + "\">");
                  rstExam = markManage.getResultExm(mdl_id, std_id, rst_exmid);
                  //If this student has had results of exams
                  if (rstExam != null) {
                    rst_exmfirst = rstExam.getRst_exmfirst();
                    rst_exmhasresit = rstExam.getRst_exmhasresit();
                    rst_exmresit = rstExam.getRst_exmresit();
                    rst_exmresult = rstExam.getRst_exmresult();
                    if (rst_exmfirst != -1) {
                      out.print("<td><input type=\"text\" name=\"rst_exmfirst\" size=\"5\" value=\"" + rst_exmfirst + "\"></td>");
                    }
                    else {
                      out.print("<td><input type=\"text\" name=\"rst_exmfirst\" size=\"5\" value=\"NE\"></td>");
                    }
                    out.print("<td><select name=\"rst_exmhasresit\" size=\"1\">");
                    if (rst_exmhasresit) {
                      out.print("<option selected value=\"true\">Yes</option>");
                      out.print("<option value=\"false\">No</option>");
                    }
                    else {
                      out.print("<option value=\"true\">Yes</option>");
                      out.print("<option selected value=\"false\">No</option>");
                    }
                    out.print("</select></td>");
                    if (rst_exmresit != -1) {
                      out.print("<td><input type=\"text\" name=\"rst_exmresit\" size=\"5\" value=\"" + rst_exmresit + "\"></td>");
                    }
                    else {
                      out.print("<td><input type=\"text\" name=\"rst_exmresit\" size=\"5\" value=\"NE\"></td>");
                    }
                    if (rst_exmresult != -1) {
                      out.print("<td><input type=\"text\" name=\"rst_exmresult\" size=\"5\" value=\"" + rst_exmresult + "\"></td>");
                    }
                    else {
                      out.print("<td><input type=\"text\" name=\"rst_exmresult\" size=\"5\" value=\"NE\"></td>");
                    }
                  }
                  //If this student has no results of exams
                  else {
                    out.print("<td><input type=\"text\" name=\"rst_exmfirst\" size=\"5\" value=\"NE\"></td>");
                    out.print("<td><select name=\"rst_exmhasresit\" size=\"1\">");
                    out.print("<option value=\"true\">Yes</option>");
                    out.print("<option selected value=\"false\">No</option>");
                    out.print("</select></td>");
                    out.print("<td><input type=\"text\" name=\"rst_exmresit\" size=\"5\" value=\"NE\"></td>");
                    out.print("<td><input type=\"text\" name=\"rst_exmresult\" size=\"5\" value=\"NE\"></td>");
                  }
                  out.print("</tr>");
                }
                out.print("</table>");
                out.print("</td>");
                out.print("<td><input type=\"submit\" name=\"Submit\" value=\"Confirm\"></td>");
                out.print("<td><input type=\"reset\" name=\"Reset\" value=\"Reset\"></td>");
                out.print("</tr>");
              }
            }
          %>
          </tr>
        </table>
      </form>
    </td>
  </tr>
</table>

我想給每個學生生成一個FORM,submit相對應的數據。
網頁可以正常顯示,但按下“Submit”後網頁就跳出了,數據也沒有post出去。


reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
4214 多個Form的submit問題 redhobor 7537 2005-04-01 00:45
3305 Re:多個Form的submit問題 Jill_Yeh 145 2005-04-01 01:06
3391 Re:多個Form的submit問題 redhobor 44 2005-04-01 01:43
3517 Re:多個Form的submit問題 redhobor 7763 2005-04-02 12:53
3399 Re:多個Form的submit問題 abgne 59 2005-04-02 13:56
3201 Re:多個Form的submit問題 redhobor 966 2005-04-02 14:30
3246 Re:多個Form的submit問題 abgne 375 2005-04-02 16:57
» JWorld@TW »  Web Design 版

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8