01/10/2018, 08:24

Lỗi trong web java (DAO;BO;controller;BEAN)

mình mới học mà ko hiểu lắm về ĐẠO;BỘ;controller;BEAN, giúp với
…lỗi

code java.file trangchu.jsp

<%@page import="Model.Bean.LoaiBean"%>
<%@page import="Model.Bean.SachBean"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<table width='1000' align='center'>
<tr>
<td colspan="3" align="right">
<%@include file='TieuDe.jsp' %>
</td>
</tr>
<tr>
<td colspan="3">
<%@include file='Menu.jsp' %>
</td>
</tr> 
11
<tr>
<td valign="top" width='200'>
<table>
<%
ArrayList<LoaiBean> dsloai=(ArrayList<LoaiBean>) 
request.getAttribute("lstLoai");%>
<%for(LoaiBean l: dsloai){ %>
<tr>
<td>
<a href='SachServelet?ml=<%=l.getMaloai()%>'> 
<%=l.getTenloai()%>
</a>
</td>
</tr>
<%} %>
</table>
</td>
<td>
<%ArrayList<SachBean> ds;
if(request.getAttribute("lstSach")!=null){
ds=(ArrayList<SachBean>)request.getAttribute("lstSach");
}else
if(request.getAttribute("lstma")!=null){
ds=(ArrayList<SachBean>)request.getAttribute("lstma");
}else
ds=(ArrayList<SachBean>)request.getAttribute("lsttk");
%>
<table>
<%int n= ds.size();
for(int i=0;i<n;i++){%>
<tr>
<td>
<img src='<%=ds.get(i).getAnh()%>'><br>
<%=ds.get(i).getTensach()%><br>
<%=ds.get(i).getTacgia()%><br>
<%=ds.get(i).getGia()%>
<a href="Mua?ms=<%=ds.get(i).getMasach()%> 
&ts= <%=ds.get(i).getTensach()%>&gia= 
<%=ds.get(i).getGia()%>">
Dat mua
</a>
</td>
<td>
<%i++;
if(i<n){%>
<img src='<%=ds.get(i).getAnh()%>'><br>
<%=ds.get(i).getTensach()%><br> 
<%=ds.get(i).getTacgia()%><br>
<%=ds.get(i).getGia()%>
<a href="Mua?ms=<%=ds.get(i).getMasach()%> 
&ts=<%=ds.get(i).getTensach()%>&gia= 
<%=ds.get(i).getGia()%>">
Dat mua
</a>
</td>
<%} %>
</tr>
<%} %>
</table>
</td>
<td valign='top'>
<%@include file='Phai.jsp' %>
</td>
</tr>
</table>
</body>
</html>
Nhox Namby viết 10:36 ngày 01/10/2018
<%@page import="Model.Bean.LoaiBean"%> <%@page import="Model.Bean.SachBean"%> <%@page import="java.util.ArrayList"%> <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> Insert title here 11
<%@include file='TieuDe.jsp' %>
<%@include file='Menu.jsp' %>
<% ArrayList dsloai=(ArrayList) request.getAttribute("lstLoai");%> <%for(LoaiBean l: dsloai){ %> <%} %>
<%=l.getTenloai()%>
<%ArrayList ds; if(request.getAttribute("lstSach")!=null){ ds=(ArrayList)request.getAttribute("lstSach"); }else if(request.getAttribute("lstma")!=null){ ds=(ArrayList)request.getAttribute("lstma"); }else ds=(ArrayList)request.getAttribute("lsttk"); %> <%int n= ds.size(); for(int i=0;i <%} %> <%} %>

<%=ds.get(i).getTensach()%>
<%=ds.get(i).getTacgia()%>
<%=ds.get(i).getGia()%> Dat mua
<%i++; if(i
<%=ds.get(i).getTensach()%>
<%=ds.get(i).getTacgia()%>
<%=ds.get(i).getGia()%> Dat mua
<%@include file='Phai.jsp' %>
Đỗ Trung Quân viết 10:25 ngày 01/10/2018

Sửa lại post với code có format markdown nhé em.

Nhox Namby viết 10:34 ngày 01/10/2018

e vẩn ko hĩu…sua form hã ah

Bài liên quan
0