[jboss-user] [EJB 3.0] - display data

weiming do-not-reply at jboss.com
Wed Dec 13 00:06:28 EST 2006


Hi, I have a problem with displaying data on jsp page. It is similar to the TrailBlazers and did work before by the way. Wish anyone give me some helps, thanks.

The method in javabean is:

	public Collection getUser(){
		String oql = "select u from UserCredentialsEntity u";
		
		return em.createQuery(oql).getResultList();
	}

The code in jsp page is:

<%
Collection people = aUser.getUser();
   for(Iterator iter = people.iterator(); iter.hasNext();){
	   UserCredentialsEntity user  = (UserCredentialsEntity)iter.next();
%>
   Username: <%=user.getUsername() %>
<% 	   
   }
%>

The error message is:
org.apache.jasper.JasperException: Exception in JSP: /test.jsp:29

26: <%
27: Collection people = aUser.getUser();
28:    for(Iterator iter = people.iterator(); iter.hasNext();){
29: 	   UserCredentialsEntity user  = (UserCredentialsEntity)iter.next();
30: %>
31:    Username: <%=user.getUsername() %>
32: <% 	   


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

java.lang.ClassCastException: com.SurveyMaker.ejb.entity.UserCredentialsEntity
	org.apache.jsp.test_jsp._jspService(test_jsp.java:76)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993242#3993242

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993242



More information about the jboss-user mailing list