Hassan,
This' what the method is -
//To retrieve all bales
public List<Baleent> findAllBales(){
List<Baleent> baleent=null;
try{
baleent=(List<Baleent>)em.createNamedQuery("getAllBales").getResultList();
return baleent;
}catch (Exception ex) {
System.err.println("Can not get all bales");
throw new EJBException(ex);
}
}//end of All bales
Collects data from the DB.
I used to use the jsp for loop to display data till I changed everything into
display tag -
<c:forEach items="${baleent}" var="baleent">
eve
> Date: Sat, 17 Oct 2009 09:40:41 -0700
> From: hassan.schroeder_at_gmail.com
> To: users_at_glassfish.dev.java.net
> Subject: Re: java.util.Vector cannot be cast to entity bean
>
> On Sat, Oct 17, 2009 at 9:17 AM, Eve Pokua <gorgeous65_at_msn.com> wrote:
>
> > I managed to get things working.
> > When I change the useBean scopet to application or requestion-
> >
> > <jsp:useBean id="baleent" scope="session" class="entityJB.Baleent" />
> >
> > But then the data I want to display is a null.
>
> ? That doesn't sound like my idea of "working" :-)
>
> > I am trying to establise why the data is a null. It looks like data is
> > not being forwarded from my servlet to my jsp. IN my servlet I have -
>
> You seem fundamentally confused. Your code below:
>
> > baleent=baleBeanRemote.findAllBales();
> > session.setAttribute("baleent",baleent);
>
> :: is setting a session attribute, not "forwarding" anything.
>
> When the JSP page is passed the request, it needs to retrieve the
> attribute from the session. Changing the JSP to look for a "baleent"
> *request* or *application* attribute will certainly return null unless
> you're setting that somewhere else.
>
> But this is dancing around the original problem. I'll ask again --
> what does baleBeanRemote.findAllBales() return?
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder_at_gmail.com
> twitter: @hassan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
_________________________________________________________________
Download Messenger onto your mobile for free
http://clk.atdmt.com/UKM/go/174426567/direct/01/
--_3e096b24-9788-487b-aa73-c059ad209490_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hassan,<BR>
<BR>
This' what the method is -<BR>
<BR>
//To retrieve all bales<BR> public List<Baleent> findAllBales(){<BR> List<Baleent> baleent=null;<BR>
try{<BR> baleent=(List<Baleent>)em.createNamedQuery("getAllBales").getResultList();<BR>
return baleent;<BR> }catch (Exception ex) {<BR>
System.err.println("Can not get all bales");<BR> throw new EJBException(ex);<BR> }<BR> }//end of All bales<BR><BR>
<BR>
Collects data from the DB.<BR>
<BR>
I used to use the jsp for loop to display data till I changed everything into<BR>
display tag -<BR>
<BR><SPAN lang=EN-GB>
<c:forEach items="${baleent}" var="baleent"> <BR>
<BR>
eve<BR>
</SPAN><BR> <BR>> Date: Sat, 17 Oct 2009 09:40:41 -0700<BR>> From: hassan.schroeder@gmail.com<BR>> To: users@glassfish.dev.java.net<BR>> Subject: Re: java.util.Vector cannot be cast to entity bean<BR>> <BR>> On Sat, Oct 17, 2009 at 9:17 AM, Eve Pokua <gorgeous65@msn.com> wrote:<BR>> <BR>> > I managed to get things working.<BR>> > When I change the useBean scopet to application or requestion-<BR>> ><BR>> > <jsp:useBean id="baleent" scope="session" class="entityJB.Baleent" /><BR>> ><BR>> > But then the data I want to display is a null.<BR>> <BR>> ? That doesn't sound like my idea of "working" :-)<BR>> <BR>> > I am trying to establise why the data is a null. It looks like data is<BR>> > not being forwarded from my servlet to my jsp. IN my servlet I have -<BR>> <BR>> You seem fundamentally confused. Your code below:<BR>> <BR>> > baleent=baleBeanRemote.findAllBales();<BR>> > session.setAttribute("baleent",baleent);<BR>> <BR>> :: is setting a session attribute, not "forwarding" anything.<BR>> <BR>> When the JSP page is passed the request, it needs to retrieve the<BR>> attribute from the session. Changing the JSP to look for a "baleent"<BR>> *request* or *application* attribute will certainly return null unless<BR>> you're setting that somewhere else.<BR>> <BR>> But this is dancing around the original problem. I'll ask again --<BR>> what does baleBeanRemote.findAllBales() return?<BR>> <BR>> -- <BR>> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com<BR>> twitter: @hassan<BR>> <BR>> ---------------------------------------------------------------------<BR>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net<BR>> For additional commands, e-mail: users-help@glassfish.dev.java.net<BR>> <BR> <br /><hr />Download Messenger onto your mobile for free. <a href='
http://clk.atdmt.com/UKM/go/174426567/direct/01/' target='_new'>Learn more.</a></body>
</html>
--_3e096b24-9788-487b-aa73-c059ad209490_--