虽然是小学期的代码,但是只有一部分,主要是想自存一下Java web的界面代码以及界面传值
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>太阳系星球信息录入系统</title>
<style>
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
width: 100%;
overflow: hidden;
margin: 0;
padding: 0;
background: url(image/background.jpg) no-repeat 0px 0px;
background-repeat: no-repeat;
background-size: 100% 100%;
-moz-background-size: 100% 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
#Login {
width: 37%;
display: flex;
justify-content: center;
align-items: center;
height: 300px;
background-color: rgb(208, 244, 250);
box-shadow: 7px 7px 17px rgba(52, 56, 66, 0.5);
border-radius: 5px;
}
input {
margin-left: 15px;
border-radius: 5px;
border-style: hidden;
height: 30px;
width: 140px;
background-color: rgba(216, 191, 216, 0.5);
outline: none;
color: #020226;
padding-left: 10px;
}
.button {
border-color: #010417;
background-color: rgba(100, 149, 237, .7);
color: #030b2a;
border-style: hidden;
border-radius: 5px;
width: 100px;
height: 31px;
font-size: 16px;
}
</style>
</head>
<body background="background.jpg" style="background-repeat:no-repeat;background-size:100% 100%;background-attachment:fixed;">
<div id="Login">
<form action="landServlet" method="post">
<h1 style="text-align: center;color: rgba(3,11,37,0.86);font-family: 华文楷体">登录</h1>
<p>
<img src="image/Username.png" style="height: 30px">
<input id="per_id" name="per_id" type="text" autofocus required>
</p>
<p>
<img src="image/Password.png" style="height: 30px">
<input id="per_password" name="per_password" type="password" required>
</p>
<div style="text-align: center;margin-top: 30px;">
<input type="hidden" name="method" value="land"/>
<input type="submit" class="button" value="进入">
<a href="register.jsp"><input type="button" class="button" value="注册"></a>
</div>
</form>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"标签:star,color,小学,100%,height,background,border From: https://www.cnblogs.com/yansans/p/17557905.html
pageEncoding="UTF-8"%>
<%@ page import ="java.sql.*"%>
<%@ page import="DBUtil.DBUtil" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>太阳系星球系系统</title>
<style>
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
width: 100%;
overflow: hidden;
margin: 0;
padding: 0;
background: url(image/background.jpg) no-repeat 0px 0px;
background-repeat: no-repeat;
background-size: 100% 100%;
-moz-background-size: 100% 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
#contain {
width: 55%;
display: flex;
justify-content: center;
height: 800px;
background-color: rgb(230, 245, 244);
box-shadow: 7px 7px 17px rgba(52, 56, 66, 0.5);
border-radius: 5px;
}
.sexDiv>input,
.hobby>input {
width: 30px;
height: 17px;
}
input,
select {
margin-left: 15px;
border-radius: 5px;
border-style: hidden;
height: 30px;
width: 140px;
background-color: rgba(216, 191, 216, 0.5);
outline: none;
color: #010423;
padding-left: 10px;
}
.button {
border-color: #6ad9e7;
background-color: rgba(100, 149, 237, .7);
color: #01051c;
border-style: hidden;
border-radius: 5px;
width: 100px;
height: 31px;
font-size: 16px;
}
.introduce>textarea {
background-color: rgba(216, 191, 216, 0.5);
border-style: hidden;
outline: none;
border-radius: 5px;
}
b {
margin-left: 50px;
color: #61ffff;
font-size: 10px;
font-weight: initial;
}
</style>
</head>
<body>
<div id="contain">
<form action="starServlet" method="post">
<h1 style="text-align: center;color: #020825;font-family: 华文楷体">太阳系星球信息管理系统</h1><br>
<p style="text-align: center;">
请输入要查询的星球名称:<input id="star_name" name="star_name" type="text" autofocus required>
<input type="hidden" name="method" value="find">
<input type="submit" name="find" class="button" value="查询">
<input type="reset" class="button" value="重置">
<a href="add.jsp">添加星球信息</a>
</p><br>
<div style="width:100%;height:10px;float:left; position:relative; display: table-cell;vertical-align: middle; background-color: rgb(50,45,54) "></div>
<br>
<table style="text-align: center;" border="1" width="100%" align="center" cellspacing="0" cellpadding="15" >
<tr>
<th> 星球中文名 </th>
<th> 星球外文名 </th>
<th> 星球质量 </th>
<th> 星球直径 </th>
<th> 表面温度 </th>
<th> 自转周期 </th>
<th> 其他 </th>
</tr>
<%
request.setCharacterEncoding("UTF-8");
String star_name = request.getParameter("star_name");
String star_id = "";
Connection conn = DBUtil.getConnection();
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from tb_star");
while (rs.next()) {
star_id = rs.getString("star_id");
out.println("<td>" + rs.getString("star_name") + "</td>");
out.println("<td>" + rs.getString("star_names") + "</td>");
out.println("<td>" + rs.getString("star_quality") + "</td>");
out.println("<td>" + rs.getString("star_diameter") + "</td>");
out.println("<td>" + rs.getString("star_temperature") + "</td>");
out.println("<td>" + rs.getString("star_time") + "</td>");
out.println("<td><a href='starServlet?star_id=" + star_id + "&method=change_find'>修改</a> "
+ " <a href='starServlet?star_id=" + star_id + "&method=delete'>删除</a></td></tr>");
}
rs.close();
st.close();
conn.close();
%>
</table>
</form>
</div>
</body>
</html>