我正在开发医院管理系统。在这里,我写了一些代码如下
<tr>
<td><input type="radio" name="reqid" onclick="editRecord(<%=resultset1.getString(1)%>)" style="width:20px; text-align: left;" /></td>
<TD colspan="10" style=" text-align: center" ><%= resultset1.getString(2)%> </TD>
<TD colspan="10" style=" text-align: center" ><%= resultset1.getString(3)%></TD>
<TD colspan="10" style=" text-align: center" ><%= resultset1.getString(4)%></TD>
<TD colspan="10" style=" text-align: center" ><%= resultset1.getString(5)%></TD>
<TD colspan="10" style=" text-align: center" ><a href="pathome.jsp"><button type="button">View</button></TD>
</tr>
显示以下详细信息
patientid PatientName DOB Gender
PAT39539 xyz 12/03/1993 male View
PAT45131 zyx 12/03/1993 male View
直到这个工作正常,但实际上我遇到了一些冲突问题,例如当我点击 PAT39539 上的查看按钮时,它显示了包含该患者的确切详细信息。但是当我点击与 PAT45131 相关的查看按钮时,它也显示以前的患者详细信息,这些记录与 PAT39539 相关。我想获取 PAT45131 患者详细信息?我怎么能做到这一点?任何人都有任何想法请帮助我
修改
我的pathome.jsp代码
<div class="article">
<%
String email=(String)session.getAttribute("email");
PreparedStatement pst = con.prepareStatement("select patientid, DOB, gender, phone, address from patient where email='"+email+"'");
ResultSet rst = pst.executeQuery();
%>
<% while(rst.next()){%>
<table width="600" align="center">
<tr></tr>
<tr></tr>
<h1>Personal Details</h1>
<tr><td>Patient ID</td><td><%=rst.getString(1)%></td></tr>
<tr><td>D.O.B</td><td><%=rst.getString(2)%></td></tr>
<tr><td>Gender</td><td><%=rst.getString(3)%></td></tr>
<tr><td>Phone</td><td><%=rst.getString(4)%></td></tr>
<tr><td>Address</td><td><%=rst.getString(5)%></td></tr>
<%}%>
</table>
</div>
</li>
<li>
<div class="article">
<p>Please enter n/a if you dont know the details</p>
<form action="measurements.jsp" action="post">
<table>
<tr><td>Weight</td><td><input type="text" name="weight" pattern="[0-9]*" maxLength="7"/></td>
<td>Height</td><td><input type="text" name="height"pattern="[0-9]*" maxLength="5"/></td></tr>
<tr><td>Blood Pressure</td><td><input type="text" name="bp"pattern="[0-9]*" maxLength="3"/></td></tr>
<tr><td>Sugar Level Before Fasting</td><td><input type="text" name="sugarb4" pattern="[0-9]*" maxLength="5"/></td>
<td>Sugar Level After Fasting</td><td><input type="text" name="sugaraftr" pattern="[0-9]*" maxLength="7"/></td></tr>
<tr><td>Eye Power Low Vision</td><td><input type="text" name="eyelow" pattern="[0-9]*" maxLength="7"/></td>
<td>Eye Power High Vision</td><td><input type="text" name="eyehigh"pattern="[0-9]*" maxLength="7"/></td></tr>
<tr><td>Cholesterol</td><td><input type="text" name="chol" pattern="[0-9]*" maxLength="7"/></td></tr>
<tr><td></td><td></td><td><input type="submit" value="Save"/></td></tr>
</table>
</form>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
答案 0 :(得分:3)
<TD colspan="10" style=" text-align: center" ><a href="pathome.jsp?patientId=<%=resultset1.getString(2)%>"><button type="button">View</button></TD>
patientId 是 pathome.jsp 上可以访问的参数 使用 request.get参数(&#34; patientId&#34;);
<%
String patientId=request.getParameter("patientId"):
PreparedStatement pst = con.prepareStatement("select patientid, DOB, gender, phone, address from patient where patientId='"+patientId+"'"); ResultSet rst = pst.executeQuery(); %>
我希望它会起作用