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?

