第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

bean jsp:getProperty獲取布爾類型問題

我按照老師的敲了一遍,在是否接受條款那里無(wú)論選不選都是false,找不出原因就下載了源碼,復(fù)制粘貼一遍,但結(jié)果還是一樣,,求大神解答

正在回答

5 回答

?if(request.getParameterValues("isAccpet")!=null)
????????????{
?isAccept?=?request.getParameter("isAccept");

第一個(gè)"isAccept"單詞拼寫有誤

0 回復(fù) 有任何疑惑可以回復(fù)我~

我也是一樣的問題,解決了嗎

0 回復(fù) 有任何疑惑可以回復(fù)我~
<%@?page?language="java"?import="java.util.*,java.text.*"?contentType="text/html;?charset=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?'userinfo.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">
	-->
????<style?type="text/css">
	?.title{
		?width:?30%;	
		?background-color:?#CCC;
		?font-weight:?bold;
	?}
	?.content{
	?????width:70%;
	?????background-color:?#CBCFE5;
	?}
	?
???</style>??
??</head>
??
??<body>
????<h1>用戶信息</h1>
????<hr>
????<center>
?????<jsp:useBean??id="regUser"?class="entity.Users"?scope="session"/>???
?????<table?width="600"?cellpadding="0"?cellspacing="0"?border="1">
????????<tr>
??????????<td?class="title">用戶名:</td>
??????????<td?class="content">&nbsp;<jsp:getProperty?name="regUser"?property="username"/></td>
????????</tr>
????????<tr>
??????????<td?class="title">密碼:</td>
??????????<td?class="content">&nbsp;<jsp:getProperty?name="regUser"?property="mypassword"/></td>
????????</tr>
????????<tr>
??????????<td?class="title">性別:</td>
??????????<td?class="content">&nbsp;<jsp:getProperty?name="regUser"?property="gender"/></td>
????????</tr>
????????<tr>
??????????<td?class="title">E-mail:</td>
??????????<td?class="content">&nbsp;<jsp:getProperty?name="regUser"?property="email"/></td>
????????</tr>
????????<tr>
??????????<td?class="title">出生日期:</td>
??????????<td?class="content">&nbsp;
????????????<%?
???????????????SimpleDateFormat?sdf?=?new?SimpleDateFormat("yyyy年MM月dd日");
???????????????String?date?=?sdf.format(regUser.getBirthday());
???????????????
????????????%>
?????????????<%=date%>
??????????</td>
????????</tr>
????????<tr>
??????????<td?class="title">愛好:</td>
??????????<td?class="content">&nbsp;
????????????<%?
???????????????String[]?favorites?=?regUser.getFavorites();
???????????????for(String?f:favorites)
???????????????{
????????????%>
????????????????<%=f%>?&nbsp;&nbsp;
????????????<%?
???????????????}
????????????%>
??????????</td>
????????</tr>
????????<tr>
??????????<td?class="title">自我介紹:</td>
??????????<td?class="content">&nbsp;<jsp:getProperty?name="regUser"?property="introduce"/></td>
????????</tr>
????????<tr>
??????????<td?class="title">是否介紹協(xié)議:</td>
??????????<td?class="content">&nbsp;<jsp:getProperty?name="regUser"?property="flag"/></td>
????????</tr>
?????</table>
????</center>
??</body>
</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~
package?servlet;

import?java.io.IOException;
import?java.io.PrintWriter;
import?java.text.SimpleDateFormat;
import?java.util.Date;

import?javax.servlet.ServletException;
import?javax.servlet.http.HttpServlet;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;

import?entity.Users;

public?class?RegServlet?extends?HttpServlet?{

	/**
	?*?Constructor?of?the?object.
	?*/
	public?RegServlet()?{
		super();
	}

	/**
	?*?Destruction?of?the?servlet.?<br>
	?*/
	public?void?destroy()?{
		super.destroy();?//?Just?puts?"destroy"?string?in?log
		//?Put?your?code?here
	}

	/**
	?*?The?doGet?method?of?the?servlet.?<br>
	?*
	?*?This?method?is?called?when?a?form?has?its?tag?value?method?equals?to?get.
	?*?
	?*?@param?request?the?request?send?by?the?client?to?the?server
	?*?@param?response?the?response?send?by?the?server?to?the?client
	?*?@throws?ServletException?if?an?error?occurred
	?*?@throws?IOException?if?an?error?occurred
	?*/
	public?void?doGet(HttpServletRequest?request,?HttpServletResponse?response)
			throws?ServletException,?IOException?{

		doPost(request,response);
	}

	/**
	?*?The?doPost?method?of?the?servlet.?<br>
	?*
	?*?This?method?is?called?when?a?form?has?its?tag?value?method?equals?to?post.
	?*?
	?*?@param?request?the?request?send?by?the?client?to?the?server
	?*?@param?response?the?response?send?by?the?server?to?the?client
	?*?@throws?ServletException?if?an?error?occurred
	?*?@throws?IOException?if?an?error?occurred
	?*/
	public?void?doPost(HttpServletRequest?request,?HttpServletResponse?response)
			throws?ServletException,?IOException?{

		request.setCharacterEncoding("utf-8");
		
		Users?u?=?new?Users();
		String?username,mypassword,gender,email,introduce,isAccept;
		Date?birthday;
		String[]?favorites;
		
		
		SimpleDateFormat?sdf?=?new?SimpleDateFormat("yyyy-MM-dd");
		try
		{
			username?=?request.getParameter("username");
			mypassword?=?request.getParameter("mypassword");
			gender?=?request.getParameter("gender");
			email?=?request.getParameter("email");
			introduce?=?request.getParameter("introduce");
			birthday?=?sdf.parse(request.getParameter("birthday"));
			if(request.getParameterValues("isAccpet")!=null)
			{
			??isAccept?=?request.getParameter("isAccept");
			}
			else
			{
			??isAccept?=?"false";
			}
			//用來獲取多個(gè)復(fù)選按鈕的值
			favorites?=?request.getParameterValues("favorite");
			u.setUsername(username);
			u.setMypassword(mypassword);
			u.setGender(gender);
			u.setEmail(email);
			u.setFavorites(favorites);
			u.setIntroduce(introduce);
			if(isAccept.equals("true"))
			{
				u.setFlag(true);
			}
			else
			{
				u.setFlag(false);
			}
			u.setBirthday(birthday);
			
			//把注冊(cè)成功的用戶對(duì)象保存在session中
			request.getSession().setAttribute("regUser",?u);
			//跳轉(zhuǎn)到注冊(cè)成功頁(yè)面
			request.getRequestDispatcher("../userinfo.jsp").forward(request,response);
		}
		catch(Exception?ex)
		{
			ex.printStackTrace();
		}
		
		
	}

	/**
	?*?Initialization?of?the?servlet.?<br>
	?*
	?*?@throws?ServletException?if?an?error?occurs
	?*/
	public?void?init()?throws?ServletException?{
		//?Put?your?code?here
	}

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

把你代碼貼上來看看

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

weibo_熱心市民吳子航_0 提問者

主要代碼如下
2016-03-23 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

bean jsp:getProperty獲取布爾類型問題

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)