為什么我做部分匹配的時候還是全部都匹配到了。。
<%@ 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>login</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>
? ? <hl>setProperty</hl>
? ? <hr>
? ? <jsp:useBean id="Buser" class="com.po.Users" scope="page"/>
? ? <!-- 根據(jù)表單提交的內容自動匹配 -->
? ? <!--<jsp:setProperty property="*" name="Buser"/> -->
? ? ? <!-- 根據(jù)表單匹配部分屬性 -->
? ? <jsp:setProperty property="password" name="Buser"/>
? ? ? ? ? ? 用戶名:<%=Buser.getUsername() %><br>
? ? ? ? ? ? 密碼:<%=Buser.getPassword() %><br>
? ?
??
? ??
? ??
? </body>
</html>
我明明注釋掉了啊,為什么還是全部匹配到了
2015-01-28
?<%-- <jsp:setProperty property="*" name="Buser"/> --%>?
用這種方式注釋JSP代碼
2015-01-28
這種是html或xml的注釋方式,表示瀏覽器不顯示該內容,但對于服務器來說不是,就是說,如果里面有jsp的指令,還是會被服務器端解析。
2014-12-16
<jsp:useBean /> 獲取到user對象。
<%=user.getUsername() %> 對象getter方法獲得對應的屬性。
這沒什么問題。
如果不設置對應屬性<jsp:setProperty />, 那么<jsp:getProperty /> 獲得屬性的時候才會沒有值。
2014-12-15
還是說必須要<% %>這樣注釋?