myeclipse上建了一个web progect
然后又建了一个index.html
一个test.jsp
index.html的代码是:
<html>
<head>
<title>index</title>
</head>
<body>
<form action = "test.jsp" method = "get" name ="form1">
用户名:<input type = "text" name = "username"/><br>
密 码:<input type = "password" name = "userpass"/><br>
<input type = "submit" value = "提交"/>
<input type = "reset" value = "重置"/>
</form>
</body>
</html>
test.jsp的代码是:
<%@ page language="java" import="java.util.*,java.text.*" contentType="test/html; charset=gbk"%>
<html>
<head>
<title>test</title>
</head>
<body>
你输入的用户名是:<%=request.getParameter("username") %><br>
你输入的密码是:<%=request.getParameter("userpass") %><br>
你好! <br>
今天是
<%
Date now =new Date();
SimpleDateFormat formater = new SimpleDateFormat("yyyy/MM/dd/");
String strCurrentTime = formater.format(now);
out.println(strCurrentTime);
%>
</body>
</html>
我想从index.html跳转到test.jsp上
可是出现两个问题:
1 我用http://localhost:8080/Y2JAVAEE/index.html 不能登入(tomcat我启动的了)
2.我直接双击index.html这个文件可以显示内容,跳转到test.jsp上,不能输出<%=request.getParameter("username") %>和<%=request.getParameter("userpass") %> 这两个部分,我以为是没有传递数据过来,就添加了下面的一段显示时间的代码,结果还是不能显示。
有没有哪个大大知道这是什么原因?
然后又建了一个index.html
一个test.jsp
index.html的代码是:
<html>
<head>
<title>index</title>
</head>
<body>
<form action = "test.jsp" method = "get" name ="form1">
用户名:<input type = "text" name = "username"/><br>
密 码:<input type = "password" name = "userpass"/><br>
<input type = "submit" value = "提交"/>
<input type = "reset" value = "重置"/>
</form>
</body>
</html>
test.jsp的代码是:
<%@ page language="java" import="java.util.*,java.text.*" contentType="test/html; charset=gbk"%>
<html>
<head>
<title>test</title>
</head>
<body>
你输入的用户名是:<%=request.getParameter("username") %><br>
你输入的密码是:<%=request.getParameter("userpass") %><br>
你好! <br>
今天是
<%
Date now =new Date();
SimpleDateFormat formater = new SimpleDateFormat("yyyy/MM/dd/");
String strCurrentTime = formater.format(now);
out.println(strCurrentTime);
%>
</body>
</html>
我想从index.html跳转到test.jsp上
可是出现两个问题:
1 我用http://localhost:8080/Y2JAVAEE/index.html 不能登入(tomcat我启动的了)
2.我直接双击index.html这个文件可以显示内容,跳转到test.jsp上,不能输出<%=request.getParameter("username") %>和<%=request.getParameter("userpass") %> 这两个部分,我以为是没有传递数据过来,就添加了下面的一段显示时间的代码,结果还是不能显示。
有没有哪个大大知道这是什么原因?