Hi,all I have a screen web page a.jsp with a submit button, I used a javabean in a.jsp with name say "bean1", the submit button will bring to another web page b.jsp, in b.jsp I need to access the data in "bean1" , how to do that ? by javabean's "scope" attribute ? Thanks a lot for the help, sample codes welcome.
Yes, you use the scope attribute. It depends on how you wanna use the bean; Within a session , application, request or page... I've got a simple example but is too long to paste it here. drop me an email and i'll send it to you email@example.com cheers
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Joined: Nov 27, 2001
BTW, check page 44 jsp specification 1.2 It explains when you should use them.
Does the bean really need to implement serializable ? I thought all you needed to do was use the bean in the session scope.
Joined: Apr 10, 2001
Anthony, instead of <% HelloBean helloBean = (HelloBean)session.getAttribute("helloBean"); %> in your b.jsp I still use <jsp:useBean id="helloBean" scope="session" class="HelloBean"> in b.jsp it give me the same helloBean created in a.jsp as for the "Serializable", I never used in my bean defination, any benefit by implementing this ?
Joined: Mar 22, 2002
Hi Sylvia, Some servers set a maximum number of sessions to be held in memory before older sessions are swapped out to a storage provider. They keep track of sessions that have not been used recently and use a session persistence mechanism to serialize the session data to storage (a file or database). If a session was swapped out and requested again, it is read back into memory and used. This setting keeps the amount of memory used by sessions in check. If the session data is not serializable, this server-dependent persistence mechanism may throw an error. -anthony [ March 25, 2002: Message edited by: Anthony Villanueva ]
subject: how to access same javabean in previous web page?