Eclipse+Tomcat+mysql开发第一个Java Web项目

系统设置

  1. Eclipse
  2. Tomcat 8.5
  3. mysql

文件

下图为项目结构目录:

具体代码见下:
1. 欢迎界面
index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*,java.util.*" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title heretitle>
head>
<body>
<p>This is a test! Xing.p>
    Please Login.
    <form action = "indexLogin">
        username:<input type="text" name="aName"><br/>
        password:<input type="text" name="aPassword"><br/>
        <input type="submit">
    form> 
body>
html>
  1. 登录成功界面
    Plan.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title heretitle>
head>
<body>
<% String name = request.getParameter("aName"); %>
<% java.util.Date d = new java.util.Date();%>
    <p>Welcome, <%=name%>! This is your plan.p> <%=d.toString() %>>

body>
html>

参考文献:
1. http://blog.csdn.net/ku360517703/article/details/41896325
2. http://blog.csdn.net/ku360517703/article/details/41907319

你可能感兴趣的:(java,javaee)