gpt4 book ai didi

html - 无法在 jsp 中获取准确的用户详细信息

转载 作者:太空宇宙 更新时间:2023-11-03 11:35:55 25 4
gpt4 key购买 nike

我正在开发医院管理系统。在这里我写了一些代码如下

                            <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 上的view 按钮时,它显示了包含该患者的确切详细信息。但是当我点击与 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>

最佳答案

<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 parameter("patientId");

<%
String patientId=request.getParameter("patientId"):
PreparedStatement pst = con.prepareStatement("select patientid, DOB, gender, phone, address from patient where patientId='"+patientId+"'"); ResultSet rst = pst.executeQuery(); %>

希望能成功

关于html - 无法在 jsp 中获取准确的用户详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46127102/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com