jsp学习笔记(15)

for(int i=0;i<type.size();i++){
		typeRow = (ArrayList)type.get(i);
		%>
		<li><ahref="/OnlineShop/servlet/SearchServlet?types=
			<%=typeRow.get(0)%>"><%=typeRow.get(1) %></a></li>
		<%} }%>
	left.jsp代码如下:
	<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
	<%@page import="java.util.ArrayList"%>
	<body>
	<jsp:include flush="true" page="/servlet/ListServlet"/>
	<div id="content_left">
		<div class="content_left_section">
		<h1>用户登入</h1>
			<form method="post" action="/OnlineShop/servlet/UserLoginServlet" 
			name="form1" onSubmit="return mylogin()">
			<table width="200" border="0">
			<tr>
				<td width="50">用户名</td>
				<td width="134"><input name="name" type="text" size="15" />
				&nbsp;</td>
			</tr>
			<tr>
				<td height="26">密 码</td>
				<td><input name="pwd" type="password" size="15" />&nbsp;</td>
			</tr>
			<tr>
               <td height="49">&nbsp;</td>
               <td><input type="submit" value="登入" class="mybutton" />
               &nbsp; <input name="" type="button" value="注册" class="mybutton"  
				onclick="JqueryDialog.Open('用户注册', '/OnlineShop/user/register.jsp', 600, 
610);" /></td>
			</tr>
			<tr>
				<td height="25"  colspan="2">
				<%
					ArrayList isLogin1 = (ArrayList)session.getAttribute("login");
					String loginError = (String)request.getAttribute("loginError");
					if(isLogin1==null &&loginError==null){
				%>
				<p ><font color="red">用户未登入,无账号请先注册!</font></p>
				<%}else if(isLogin1!=null &&loginError==null){ 
					String userName = (String)isLogin1.get(3);
				%>
				<p><font color="red"><%=userName %>,您已登入!</font></p>
				<%}else if(isLogin1==null&&"error".equals(loginError)){ %>
					<p ><font color="red">用户名或密码错误!</font></p>
				<%} %>
				</td>
			</tr>
			</table>
			</form>
		</div>
		<div class="content_left_section">
		<h1>图书分类</h1>
		<ul>
         <%
         	ArrayList type = (ArrayList)request.getAttribute("type");
         	ArrayList typeRow = null;
         	if(type!=null){
         		for(int i=0;i<type.size();i++){
         			typeRow = (ArrayList)type.get(i);
         %>
          <li><ahref="/OnlineShop/servlet/SearchServlet?types=
			<%=typeRow.get(0)%>"><%=typeRow.get(1) %></a></li>
			<%} }%>
		</ul>
		</div>
		<div class="content_left_section">
        <h1>销售榜</h1>
         <ul>
         <%
         	ArrayList rank = (ArrayList)request.getAttribute("xiaosou");
         	ArrayList rankRow = null;
         	if(rank!=null){
         		for(int i=0;i<rank.size();i++){
         			rankRow = (ArrayList)rank.get(i);
         %>
          <li><ahref="/OnlineShop/servlet/BookinfServlet?bookId=
			<%=rankRow.get(0)%>"><%=rankRow.get(1) %></a></li>
          <%} }%>
        </ul>
      </div>
      <div class="content_left_section"> <a href="javascript:void(0)"><img 
		style="border:0;width:88px;height:31px" src="http://www.w3.org/Icons/valid-xhtml10" 
		alt="" width="88" height="31" vspace="8" border="0" /></a> <a href=
		"javascript:void(0)"><img style="border:0;width:88px;height:31px"  src=
		"http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="" vspace="8" border="0" 
		/></a> </div>
    </div>
  </body>

你可能感兴趣的:(java,jsp)