gpt4 book ai didi

java - java servlet输出时如何定位out.println()?

转载 作者:太空宇宙 更新时间:2023-11-04 12:31:41 24 4
gpt4 key购买 nike

enter image description here

大家好,请看一下上面的屏幕设计链接。在顶部你可以看到它写着“未找到员工!”这是故意这样做的,并且是输入未找到的员工 ID 的结果,如下面的 servlet 所示。但是,我想知道如何定位它?或者有没有更简单的方法向用户输出反馈?正如您所看到的,该消息显示在顶部,从而破坏了我的 CSS。有没有更好的方法来输出此消息?或者也许定位 out.println?

ViewEmployeeInfo.java:

out.println("Employee Not Found!"); 
RequestDispatcher qs = request.getRequestDispatcher("ViewEmployee.html");
qs.include(request, response);

ViewEmployee.html:

<!DOCTYPE html> 
<html>
<head>
<meta charset = "UTF-8">
<link rel = "stylesheet" type = "text/css" href = "main.css">
<link rel = "stylesheet" type = "text/css" href = "sidebar.css">
<title>Update Employee Information</title>
<style>
table { border-collapse: collapse; width: 50%; } th, td { text-align: left; padding: 8px; } tr:nth-child(even){background-color: #f2f2f2}
tr:hover {background-color: #e2f4ff;}
</style>
</head>

<body>

<ul>
<li><a href="PersonalInfoOutput">View Personal Information</a></li>
<li><a href="ExpenseClaim.html">View Expense Claims</a></li>
<li><a href=asdasd>View Payslips</a></li>
<li><a href="changePassAdmin.html" >Change Password</a></li>
<li><a href ="manageEmployee.html" class=active>Maintain Employee Information</a></li>
<li><a href=asdasdasd>Maintain Tax Information</a></li>
<li><a href=asdasd>Maintain Payroll Items</a></li>
<li><a href="TimeSheet.html">Maintain Timesheet</a></li>
<li><a href="EmployeeExpense.html">Maintain Employee Expenses</a></li>
<li><a href=asda>Run Payroll</a></li>
<li><a href=asdasds>Generate Reports</a></li>

</ul>

<div style=margin-left:25%;padding:1px;>
</div>

<div id="container">
<h1>View Employee Information</h1>
<form action ="ViewEmployeeInfo" method = "post">

<table border ="1">

<tr>
<td>Employee ID Search:</td>
<td><input type = "search" name = "employee_id" pattern="[0-9]{4}" title="4 digit number: e.g. 1234" maxlength="4" required> <input type ="submit" value="Search">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>

最佳答案

您可以通过添加标签来使用CSS进行修改

out.println("<div id="info">Employee Not Found!</div>");

关于java - java servlet输出时如何定位out.println()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37802835/

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