|
In a servlet you set attributes which are your objects. You can attach these objects to different scopes depending on their need. So you may have objects that are just for the current request, you would create them in the servet like request.setAttribute("myData", data), then send out the jsp page. In the jsp page the tag would look like <jsp:useBean id="myData" class="com.my.data" scope="request" />. It now looks for the data in the request object and disappears when you submit the form, if you put scope as session it would not find it. You may want to keep data for the entire sesssion, such as name. Then in the servlet you would say session.setAttribute("lastName", lName"), the in the jsp page you would say <jsp:useBean id="lastName" class="com.lang.String" scope="session" /> , now this data is always available throughout the entire session. Barry
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.