编写三个JSp页面:main.jsp
时间: 2024-05-16 07:14:20 浏览: 84
main.jsp
好的,下面是一个简单的 main.jsp 页面示例:
```jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Main Page</title>
</head>
<body>
<h1>Welcome to my website</h1>
<p>This is the main page of my website.</p>
<ul>
<li><a href="about.jsp">About Us</a></li>
<li><a href="products.jsp">Products</a></li>
<li><a href="contact.jsp">Contact Us</a></li>
</ul>
</body>
</html>
```
此页面主要是为了展示网站的主要内容,包括欢迎语、简要介绍和指向其他页面的链接。其中,`<ul>` 标签创建带有链接的无序列表。
下面是 about.jsp 页面示例:
```jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>About Us</title>
</head>
<body>
<h1>About Us</h1>
<p>We are a small company dedicated to providing high-quality products and services to our customers.</p>
<p>Our team is comprised of experienced professionals who are passionate about what they do.</p>
<p>If you have any questions or would like to learn more about our company, please don't hesitate to contact us.</p>
<a href="contact.jsp">Contact Us</a>
</body>
</html>
```
此页面主要是为了展示关于公司的信息和团队的介绍。其中,`<a>` 标签创建到联系我们页面的链接。
下面是 contact.jsp 页面示例:
```jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Contact Us</title>
</head>
<body>
<h1>Contact Us</h1>
<p>If you have any questions or would like to learn more about our company, please don't hesitate to contact us.</p>
<form action="submit.jsp" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" rows="5" cols="40" required></textarea><br>
<input type="submit" value="Send">
</form>
</body>
</html>
```
此页面主要是为了展示联系我们的表单。其中,`<form>` 标签创建一个表单,`<label>` 标签将表单元素和其标签相关联,`<input>` 标签创建文本框和电子邮件输入框,`<textarea>` 标签创建多行文本框,`<input type="submit">` 标签创建一个提交按钮。在这个例子中,表单将通过 POST 方法提交到 submit.jsp 页面。
阅读全文