java web程序
Posted 为PG1打call
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java web程序相关的知识,希望对你有一定的参考价值。
MyJSP.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
</head>
<body>
<form action="a1.jsp" method="post">
用户名:<input type="text" name="yonghuming"><br>
密码:<input type="password" name="mima"><br>
<input type="submit" value="提 交">
</form>
</body>
</html>
a1.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
</head>
<body>
<%String xingming=request.getParameter("yonghuming");
String xuehao=request.getParameter("mima");
if(xingming.equals("huangzesen")&&xuehao.equals("3152052051501")){
%>
<jsp:forward page="success.jsp"/>
<%}else{%>
<jsp:forward page="fail.jsp"/>
<%}%>
</body>
</html>
success.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
</head>
<body>
<%
String ming=request.getParameter("yonghuming");
String hao=request.getParameter("mima");
%>
登陆成功<br>
您输入的信息为:<br>
用户名:<%=ming%><br>
密码:<%=hao%><br>
</body>
</html>
fail.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
</head>
<body>
<a href="MyJsp.jsp">登陆失败 请重新输入</a>
</body>
</html>
以上是关于java web程序的主要内容,如果未能解决你的问题,请参考以下文章