мой DAO
public class bookRequestStatusDAO {
public static List<Book> getbookRequest()
{
Session session=null;
try
{
List booklist=new ArrayList();
session = HibernateUtil.getSession();
System.out.println(" Session :: "+session);
Query query=session.createSQLQuery("{call SP_bookRequestTable()}");
booklist=query.list();
System.out.println("in dao getrequest----"+booklist.size());
if(booklist!=null)
return booklist;
else
return new ArrayList();
}
catch(Exception e)
{
System.out.println("Exception in BookREqueststatus::"+e);
return null;
}
finally
{
session.close();
}
}
мой класс действий Struts
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
System.out.println(" exce -----");
BookrequeststatusForm bookrequeststatusForm=(BookrequeststatusForm)form;
List<Book> convertlist=new ArrayList<Book>();
convertlist=bookRequestStatusDAO.getbookRequest();
System.out.println("list in Action::" +convertlist.size() );
request.setAttribute("bookDeatils",convertlist );
System.out.print("request in Action::"+request.getAttribute("bookDeatils"));
return mapping.findForward(Constants.ACTION_FORWARD_SUCCESS);
}
}
и в моем jsp
<link rel="stylesheet" href="/REC_BookBank/css/bookRequestStatus.css">
<%
List<Book>list=new ArrayList<Book>();
if(request.getAttribute("bookDeatils")!=null)
{
list = (ArrayList)request.getAttribute("bookDeatils");
System.out.println("inside loop List --- "+list.size());
for(Book book : list)
{
out.println("<tr><td>"+book.getId()+"</td></tr>");
}
}
System.out.println(" List --- "+list.size());
%>
мой Book.java
import java.io.Serializable;
/**
*
* @author Administrator
*/
public class Book implements Serializable {
private String id;
private String subject;
private String title;
private String author;
private String publication;
private String edition;
private String status;
private String mode;
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getEdition() {
return edition;
}
public void setEdition(String edition) {
this.edition = edition;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getPublication() {
return publication;
}
public void setPublication(String publication) {
this.publication = publication;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
в коте Консул
exce -----
Session :: SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
Hibernate: {call SP_bookRequestTable()}
in dao getrequest----1
list in Action::1
request in Action::[[Ljava.lang.Object;@14ef239]inside loop List --- 1
Исключение HTTP Status 500 -
тип Сообщение об исключении
сообщение
описание Серверобнаружена внутренняя ошибка (), которая помешала ему выполнить этот запрос.
исключение в
org.apache.jasper.JasperException: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.rec.bookbank.persitencejavafile.Book
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.rec.bookbank.persitencejavafile.Book
org.apache.jsp.jsp.bookRequestStatus_jsp._jspService(bookRequestStatus_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
Мне нужно напечатать значение здесь, но оно показывает исключение ClassCastException
.