register.jsp

来自「开发工具为myeclipse,数据库为oracle」· JSP 代码 · 共 56 行

JSP
56
字号
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%
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 JSF 'register.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>
  
  <script type="text/javascript">
     function checkPWD(){
        var password= document.getElementById("password");//获取不了,为null
        var rpassword= document.getElementById("rpassword");//获取不了,为null
        if(password==rpassword){
        return true;
        }else{
          return false;
        }
     }
  </script>
  
<body>
	<f:view>
		<h:form onsubmit="return checkPWD()">
		  <h:outputLabel for="userName" value="用户名:" />
		  <h:inputText id="userName" value="#{userBean.username}" required="true" />
		  <h:message for="userName" />
		  <h:outputLabel for="password" value="密码:" />
		  <h:inputText id="password" value="#{userBean.userpwd}" required="true" />
		  <h:message for="password" />
		  <h:outputLabel for="rpassword" value="确认密码:" />
		  <h:inputText id="rpassword"  required="true" />
		  <h:message for="rpassword" />
		  <h:commandButton value="提交" action="#{userBean.register}" />
		</h:form>
	</f:view>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?