Multiple Session Beans ? Losing One Bean ?

Hi,

I'm trying to make a multiple page input form where the user clicks on a next button to get to each different page and enter the cooresponding information to that page.

I have a JSP page acting as the controller for this currently here's what that code looks like:

Controller.jsp --

<%@ include file="top.jsp"%>

<jsp:useBean id="bean" class="BeanClass" scope="session"/>

<%

if(request.getParameter("page1")!=null) { /* this is the submit button name */ %>

<jsp:useBean id="inputBean" class="InputBean1">

<jsp:setProperty name="inputBean" property="*"/>

</jsp:useBean>

<% bean.setInputBean1(inputBean); %>

<jsp:forward page="page1.jsp"/>

<% }

else if(request.getParameter("page2")!=null) { /* this is the submit button name */%>

<jsp:useBean id="inputBean" class="InputBean2">

<jsp:setProperty name="inputBean" property="*"/>

</jsp:useBean>

<% bean.setInputBean2(inputBean); %>

<jsp:forward page="page2.jsp"/>

<% }

else %>

<jsp:forward page="page.jsp"/>

<% } %>

- Page1.jsp --

<%@include file="top.jsp"%>

<jsp:useBean id="bean" class="BeanClass" scope="session"/>

<% // This should list all the beans in the BeanClass for the user to look over

InputBean [] ib = bean.getInputBean();

for(int i=0;i<ib.length;i++) {

%>

<tr><td><%ib.getName()%></td></tr>

<%

}

%>

Page2.jsp is very similar to Page1.jsp

In the top.jsp I have a Bean in the session scope that holds the user_id value that already works, however I can't seem to get this BeanClass bean to hold information is there something wrong I'm doing in the approach to the problem or is it more just a little thing I'm missing like the propery="*" isn't working correctly.

The BeanClass creates a Vector of the InputBean's that it recieves and the returns them as an array or an array of zero if none have been entered. This gives me the ability to add multilple InputBean's to the BeanClass and then let the user edit them later. However when I run it , the information doesn't seem to be storing in the session correctly.

I believe this code is very close to mine, please try to ignore obvious syntax mistakes if there are any

Any Help?

[2514 byte] By [bryanwclark] at [2007-9-26 2:24:53]
# 1
Is your browser setup to accept cookies? In order to keep a session, a SessionID needs to be send from the client on each request (either through cookie or URL rewriting).Raphael Parree
RaphaelP at 2007-6-29 9:35:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi

What i understood from your problem is your button in

the controller jsp file is not calling the another jsp.

when ever page was not being called first we have to verify our

application(project) log file.

1.If servlet not found then it will display file not found

exception.

2.If this is the case then you should goto your jsp file1 and

then see how your calling your anotherjsp. All the requirements for

calling the jsp must be fulfilled

3. If you pass all the parameters correctly then you should goto

jsp2and see how it is receiving data from jsp1

and displaying the page.

4.If this is also correct then you should see how your tracking

your session. there might be problem with your session. when

session was being closed or if there is anyother problem with

session the application may fail.

5.If this is also correct then you should see any other objectsyou are activating are there with null values.

6.If this is also correct then we can conclude that the problem might be with your appln server or webserver. first you should see in your appln server's or webserver's logfile(if exists). I hope these are the quite most possible reasons for any error

which was thrown when jsp was not being called.

you should see the error number in the browser,if it displays

404 page not found error then it is clearly with the path and files.

7)Please check with your browser whether it is accepting cookies or not.

Regards,

TirumalaRao.

Developer Technical support,

Sun Microsystems,India.

rao_indts at 2007-6-29 9:35:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

> Hi

>

> What i understood from your problem is your button in

> the controller jsp file is not calling the another

> jsp.

--

the controller.jsp page succesfully forwards to the other pages, however in the other pages the InputBean's are not appear. It is like a new session is being created and I lose the current BeanClass session.I thought it was because the properties weren't being set to the InputBeans when the page was submitted back to the controller, however it should still loop through the empty InputBean's when I'm viewing page1 and page2

My browser is accepting cookies, and I can verify because the UserBean is working correctly, this bean keeps track of the user_id value as the use the site.

bryanwclark at 2007-6-29 9:35:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...