创建一个简单的模拟登陆功能的网页,没有用数据库技术,只是简单的学习jsp语法首先创建一个登陆页面<%@ page language = "java" import="java.util.*" pageEncoding="ut ...
创建一个简单的模拟登陆功能的网页,没有用数据库技术,只是简单的学习jsp语法
首先创建一个登陆页面
<%@ page language = "java" import="java.util.*" pageEncoding="utf-8" %><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <form action = "judge.jsp"> name<input type = "text" name = "name"> password<input type = "password" name = "password"> <input type = "submit" value = "提交"> </form> </body></html>
<%@ page language = "java" pageEncoding="utf-8" %><html> <head> <title>forward 动作</title> </head> <body> <jsp:useBean id="tb" scope = "request" class ="bean.testbean"></jsp:useBean> <jsp:setProperty property="*" name="tb"/> <%-- <%@include file = "jisuan.jsp" %> --%> <% String name = tb.getName(); String password = tb.getPassword(); if(name.equals("cheng")&&password.equals("song")){ %> <jsp:forward page="success.jsp"></jsp:forward> <% }else{ %> <jsp:forward page="fail.jsp"></jsp:forward> <% } %> </body></html>
原标题:JSP动作学习一
关键词:JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。