Hi,
Thank you for your reply. 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.
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 -
baleent=baleBeanRemote.findAllBales();
System.out.println(baleent);
HttpSession session = request.getSession();
session.setAttribute("baleent",baleent);
//Choose which JSP for presentation
RequestDispatcher dispatcher = getServletContext()
.getRequestDispatcher("/Viewdisplayold.jsp");
//forward data to the DiscountItemsj.jsp to present
//it to user
dispatcher.forward(request, response);
}catch(Exception ex){
System.err.println("Can not access DB");
}
SO shouldn't the useBean above pickt it up in the Viewdisplay.jsp?
What I'm I doing wrong?
eve
> Date: Sat, 17 Oct 2009 08:41:07 -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 Fri, Oct 16, 2009 at 1:22 PM, Eve Pokua <gorgeous65_at_msn.com> wrote:
>
> > try{
> > //call the allbales method
> > baleent=baleBeanRemote.findAllBales();
>
> Wouldn't it be more readable/self-documenting if that was "bales" or
> "allBales" or something? Just sayin'...
>
> > <jsp:useBean id="baleent" scope="session" class="entityJB.Baleent" />
>
> > java.lang.ClassCastException: java.util.Vector cannot be cast to
> > entityJB.Baleent
>
> Yep, so what does `baleBeanRemote.findAllBales()` return? Pretty
> obviously -- if it's meant to return *bales* plural, it's very likely to be
> a collection object of some kind. Like, say, a Vector ...
>
> FWIW,
> --
> 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/
--_708b9103-2480-49e3-814e-ae66068b2fbe_
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'>
Hi,<BR>
<BR>
Thank you for your reply. 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>
<BR>
But then the data I want to display is a null.<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>
<BR>
<BR> baleent=baleBeanRemote.findAllBales();<BR> System.out.println(baleent);<BR> HttpSession session = request.getSession();<BR> session.setAttribute("baleent",baleent);<BR> <BR> //Choose which JSP for presentation<BR> RequestDispatcher dispatcher = getServletContext()<BR> .getRequestDispatcher("/Viewdisplayold.jsp");<BR> <BR> //forward data to the DiscountItemsj.jsp to present<BR> //it to user<BR> dispatcher.forward(request, response);<BR> <BR> <BR> }catch(Exception ex){<BR> System.err.println("Can not access DB");<BR> }<BR>
<BR>
SO shouldn't the useBean above pickt it up in the Viewdisplay.jsp?<BR>
<BR>
What I'm I doing wrong?<BR>
<BR>
eve<BR> <BR>> Date: Sat, 17 Oct 2009 08:41:07 -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 Fri, Oct 16, 2009 at 1:22 PM, Eve Pokua <gorgeous65@msn.com> wrote:<BR>> <BR>> > try{<BR>> > //call the allbales method<BR>> > baleent=baleBeanRemote.findAllBales();<BR>> <BR>> Wouldn't it be more readable/self-documenting if that was "bales" or<BR>> "allBales" or something? Just sayin'...<BR>> <BR>> > <jsp:useBean id="baleent" scope="session" class="entityJB.Baleent" /><BR>> <BR>> > java.lang.ClassCastException: java.util.Vector cannot be cast to<BR>> > entityJB.Baleent<BR>> <BR>> Yep, so what does `baleBeanRemote.findAllBales()` return? Pretty<BR>> obviously -- if it's meant to return *bales* plural, it's very likely to be<BR>> a collection object of some kind. Like, say, a Vector ...<BR>> <BR>> FWIW,<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>
--_708b9103-2480-49e3-814e-ae66068b2fbe_--