500 Servlet Exception
E:\jspweb\WEB-INF\classes\ShopCartForm.java:11: invalid method declaration;
return type required
public Book(){}
^
1 error
首页 和个别页 出现这个错误
说方法没有声明??
附首页:
<%@ page contentType="text/html;charset=GBK" language="java" %>
<%@ page import = "BookStore.*" %>
<%@ page import = "java.util.*" %>
<%
Vector catList = (Vector)session.getAttribute(Constants.BOOK_CAT_LIST_KEY);
Vector bookList = (Vector)session.getAttribute(Constants.BOOK_LIST_KEY);
Book book = null;
BookCat bookCat = null;
SearchStatus schSta = (SearchStatus)session.getAttribute(Constants.BOOK_SEARCH_STATUS_KEY);
%><HTML>
<HEAD><TITLE>书籍查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="images/new.css" type="text/css" rel=stylesheet>
</HEAD>
<BODY bgcolor="#7387B8">
<div align="center">
<img border="0" src="images/ruanjian.jpg" width="770" height="154" ></div>
<TABLE cellSpacing=0 cellPadding=0 width="788" border=0>
<TR vAlign=top bgColor=#cbd7f3>
<TD align=middle width=170 bgColor=#7387B8>
<br><br>
<TABLE cellSpacing=0 cellPadding=0 width="90%" align=center border=0>
<TR> <TD bgcolor="#FFFFFF">
<%if(catList != null ){ for(int i = 0;i < catList.size();i++)
{
bookCat = (BookCat)catList.get(i);
%>
<a href="bookSearch.do?bookCatId=<%=bookCat.getId()%>&mode=1"><font color="#000000"><%=bookCat.getName()%></font></a><br>
<%
}
}
%>
</TD> </TR>
</TABLE>
</TD>
<TD bgColor=#7387B8>
<br>
<TABLE cellSpacing=0 cellPadding=0 width="90%" align=center border=0 bgColor=#ffffff>
<TR><TD>
<FORM action="bookSearch.do" method=post>
<DIV align=center><font size=2>请输入关键字:<font>
<INPUT type=hidden name=mode value="2">
<INPUT class=button2 size=12 name=key>
<SELECT class=button1 name=field>
<OPTION value=1 selected>书名</OPTION>
<OPTION value=2>作者</OPTION> </SELECT>
<INPUT type=submit value=搜索 name=Submit>
<BR><BR></DIV></FORM>
</TD></TR>
<TR><TD width="50%" height=20> 课程信息总目录:</TD></TR>
<TR><TD align=right width="48%" height=10>共查到 <%=schSta.getBookCount()%>条记录,显示第<%=schSta.getPageId()+1%>页/总<%=schSta.getPageCount()%>页</TD></TR>
<TR><TD>
<table class="txt" cellSpacing="1" cellPadding="1" width="515" align="center" bgColor="#005b4b" border="0">
<tr bgColor="#bad4a5">
<td vAlign="top" width="197" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">书名</font></b></td>
<td vAlign="top" width="39" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">定价</font></b></td>
<td vAlign="top" width="41" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">会员价</font></b></td>
<td vAlign="top" width="112" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">作者</font></b></td>
<td vAlign="top" width="42" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">详细</font></b></td>
</tr>
<%if(bookList != null ){ for(int i = 0;i < bookList.size();i++)
{
book = (Book)bookList.get(i);
%> <tr bgColor="#ffffff">
<td width="197" bgColor="#ffffff"><%=book.getName()%></td>
<td width="39" bgColor="#ffffff">¥<%=book.getPrice()%></td>
<td width="41" bgColor="#ffffff">¥<%=book.getSalePrice()%></td>
<td width="112"><%=book.getAuthor()%></td>
<td vAlign="center" width="42">
<a href="bookDetail.do?bookId=<%=book.getId()%>">
<img src="images/view.gif" border="0" width="25" height="25"></a></td>
<%
} %>
</tr>
<%}
%>
</table>
<p> <TR height=24>
<TD align=right>| <font color="#999999">
<a href="bookPage.do?pageId=<%=0%>">首页</a></font> | <font color="#999999">
<a href="bookPage.do?pageId=<%=schSta.getPageId()-1%>">上页</a></font> | <a href="bookPage.do?pageId=<%=schSta.getPageId()+1%>">下页</a> </TD>
</TR>
<br></TD></TR>
</TABLE>
<br>
</TD>
</TR>
</TABLE>
</body>
</html>
E:\jspweb\WEB-INF\classes\ShopCartForm.java:11: invalid method declaration;
return type required
public Book(){}
^
1 error
首页 和个别页 出现这个错误
说方法没有声明??
附首页:
<%@ page contentType="text/html;charset=GBK" language="java" %>
<%@ page import = "BookStore.*" %>
<%@ page import = "java.util.*" %>
<%
Vector catList = (Vector)session.getAttribute(Constants.BOOK_CAT_LIST_KEY);
Vector bookList = (Vector)session.getAttribute(Constants.BOOK_LIST_KEY);
Book book = null;
BookCat bookCat = null;
SearchStatus schSta = (SearchStatus)session.getAttribute(Constants.BOOK_SEARCH_STATUS_KEY);
%><HTML>
<HEAD><TITLE>书籍查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="images/new.css" type="text/css" rel=stylesheet>
</HEAD>
<BODY bgcolor="#7387B8">
<div align="center">
<img border="0" src="images/ruanjian.jpg" width="770" height="154" ></div>
<TABLE cellSpacing=0 cellPadding=0 width="788" border=0>
<TR vAlign=top bgColor=#cbd7f3>
<TD align=middle width=170 bgColor=#7387B8>
<br><br>
<TABLE cellSpacing=0 cellPadding=0 width="90%" align=center border=0>
<TR> <TD bgcolor="#FFFFFF">
<%if(catList != null ){ for(int i = 0;i < catList.size();i++)
{
bookCat = (BookCat)catList.get(i);
%>
<a href="bookSearch.do?bookCatId=<%=bookCat.getId()%>&mode=1"><font color="#000000"><%=bookCat.getName()%></font></a><br>
<%
}
}
%>
</TD> </TR>
</TABLE>
</TD>
<TD bgColor=#7387B8>
<br>
<TABLE cellSpacing=0 cellPadding=0 width="90%" align=center border=0 bgColor=#ffffff>
<TR><TD>
<FORM action="bookSearch.do" method=post>
<DIV align=center><font size=2>请输入关键字:<font>
<INPUT type=hidden name=mode value="2">
<INPUT class=button2 size=12 name=key>
<SELECT class=button1 name=field>
<OPTION value=1 selected>书名</OPTION>
<OPTION value=2>作者</OPTION> </SELECT>
<INPUT type=submit value=搜索 name=Submit>
<BR><BR></DIV></FORM>
</TD></TR>
<TR><TD width="50%" height=20> 课程信息总目录:</TD></TR>
<TR><TD align=right width="48%" height=10>共查到 <%=schSta.getBookCount()%>条记录,显示第<%=schSta.getPageId()+1%>页/总<%=schSta.getPageCount()%>页</TD></TR>
<TR><TD>
<table class="txt" cellSpacing="1" cellPadding="1" width="515" align="center" bgColor="#005b4b" border="0">
<tr bgColor="#bad4a5">
<td vAlign="top" width="197" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">书名</font></b></td>
<td vAlign="top" width="39" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">定价</font></b></td>
<td vAlign="top" width="41" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">会员价</font></b></td>
<td vAlign="top" width="112" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">作者</font></b></td>
<td vAlign="top" width="42" bgcolor="#0099CC" align="center"><b>
<font color="#FFFFFF">详细</font></b></td>
</tr>
<%if(bookList != null ){ for(int i = 0;i < bookList.size();i++)
{
book = (Book)bookList.get(i);
%> <tr bgColor="#ffffff">
<td width="197" bgColor="#ffffff"><%=book.getName()%></td>
<td width="39" bgColor="#ffffff">¥<%=book.getPrice()%></td>
<td width="41" bgColor="#ffffff">¥<%=book.getSalePrice()%></td>
<td width="112"><%=book.getAuthor()%></td>
<td vAlign="center" width="42">
<a href="bookDetail.do?bookId=<%=book.getId()%>">
<img src="images/view.gif" border="0" width="25" height="25"></a></td>
<%
} %>
</tr>
<%}
%>
</table>
<p> <TR height=24>
<TD align=right>| <font color="#999999">
<a href="bookPage.do?pageId=<%=0%>">首页</a></font> | <font color="#999999">
<a href="bookPage.do?pageId=<%=schSta.getPageId()-1%>">上页</a></font> | <a href="bookPage.do?pageId=<%=schSta.getPageId()+1%>">下页</a> </TD>
</TR>
<br></TD></TR>
</TABLE>
<br>
</TD>
</TR>
</TABLE>
</body>
</html>
解决方案 »
- 小弟正在做java开发,连接数据库时这段程序报错,不知道怎么解决,求高人指点,十分感谢
- jta_jotm 事务超时设置
- ===========JSP页面传出字符型变量问题=============
- 请问jfreechart中格式化时间轴为24小时后,怎么样才能让1日23时后显示2日24时啊???
- 求使用了struts和hibernate结构的petstore下载地址!!
- 一个关于数据库连接释放的问题
- js实现自定义弹出框问题
- java web 仿百度文库出现乱码问题
- Servlet怎么学习阿。怎样才算学好了。
- 我用的tomcat web server!测试已经通过!但是为什么这个jsp+bean老是报这个错误!我真的没有办法了!你出手吧!大虾
- 主页内容全部通过<%@ include file="XXX.jsp" %>来填充,不知好不好?
- 一个JSP连接mysql错误!
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="images/style.css">
</head>
</head>
<body BGCOLOR="#FFFFFF" leftmargin="0" topmargin="0">
<div align="center">
<center>
<table width="763" border="0" cellpadding="0" cellspacing="0" bgcolor="#336699" height="25" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td height="25"> </td>
</tr>
</table>
</center>
</div>
<table width="763" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td valign="top">
<br><br>
<table border="0" width="90%">
<form method="post" name="LoginForm" action="login.do">
<tr>
<TD>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD>
<IMG src="images/book_002.gif" width="161" height="97"></TD>
<TD align=middle width=400
background=images/book_004.gif>
<IMG
src="H:\Struts交稿\bookstore\images\spacer(1).gif" width="1" height="1"> </TD>
<TD>
<IMG src="images/book_003.gif" width="142" height="97">
</TD></TR></TBODY></TABLE></TD>
</tr>
<tr>
<td width="100%">
</td>
</tr>
<tr>
<td>
<table border="0" width="100%" align="center">
<tr>
<td width="100%" colspan="4" class="small">如果您已注册,请输入您的用户名和密码,订单的完成需要您的信息资料!</td>
</tr>
<tr>
<td align="right"><b>用户名:</b></td>
<td><input type="text" name="username" size="15"></td>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right"><b>密 码:</b></td>
<td><input type="password" name="password" size="15"></td>
<td colspan="2"> </td>
</tr>
<tr>
<td align="right" colspan="3">
<td>
<a href="javascript:login()" alt="Check out order">
<input type="image" src="images/book_012.gif" align="middle" border="0" alt="用户登录" id="image1" name="image1" width="69" height="23"></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" class="small">订单的生成需要您的资料,否则无法为您服务,若您是第一次购物,请您先<a href="userRegister.jsp"><font color="#ff0000">注册</font></a>!</td>
</tr>
<tr>
<td align="center">
<a href="userRegister.jsp" alt="Check out order">
<img src="images/book_013.gif" align="middle" border="0" alt="新用户注册" width="69" height="23"></a>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<table width="763" border="0" align="center">
<tr>
<td>
<hr size=1 width=90%>
</td>
</tr>
<tr>
<td height="20">
<div align="center"></div>
</td>
</tr>
</table></body>
</html>这个页面访问正常
最简单的办法...