Hi,
I have one JSPDynpage and two JSPs. The first JSPs is a form that takes in a number of values. Upon clicking the button in the form, I have a bean that sets these form values in the doProcessAfterInput method. I have system.out.println's in a number of places and can see that these values are being set. However in the 2nd JSP, when I use the bean methods to get the values, they are all null. I've tried storing the beans in the portal's Context, Session and Profile. Why doesn't the 2nd JSP have access to the correct scope of the bean???
JSPDynpage code:
package com.waveset.spml.password;
import com.waveset.spml.password.idmSpmlBean;
import com.sapportals.htmlb.*;
//import com.sapportals.htmlb.enum.*;
import com.sapportals.htmlb.event.*;
import com.sapportals.htmlb.page.*;
import com.sapportals.portal.htmlb.page.*;
import com.sapportals.portal.prt.component.*;
public class ChangePassword extends PageProcessorComponent {
public DynPage getPage() {
return new ChangePasswordDynPage();
}
public static class ChangePasswordDynPage extends JSPDynPage {
private final static int INITIAL_STATE = 0;
private final static int CHANGE_PASS_STATE = 1;
private int state = INITIAL_STATE;
private String idm_url = null;
private String idm_uid = null;
private String old_password = null;
private String new_password = null;
private String confirm_new_password = null;
private idmSpmlBean idmSpmlBean = null;
public ChangePasswordDynPage() {
}
public void doInitialization() {
System.out.println("In doInitialization()");
IPortalComponentRequest request =
(IPortalComponentRequest) this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
IPortalComponentProfile myProfile = myContext.getProfile();
IPortalComponentSession componentSession =
request.getComponentSession();
Object o = componentSession.getValue("idmSpmlBean");
if (o == null || !(o instanceof idmSpmlBean)) {
idmSpmlBean = new idmSpmlBean();
componentSession.putValue("idmSpmlBean", idmSpmlBean);
myContext.putValue("idmSpmlBean", idmSpmlBean);
componentSession.putValue("idmSpmlBean", idmSpmlBean);
} else {
idmSpmlBean = (idmSpmlBean) o;
}
state = INITIAL_STATE;
}
public void ButtonClicked(Event event) throws PageException {
System.out.println("In ButtonClicked() ");
state = CHANGE_PASS_STATE;
System.out.println(
"onButtonClicked changed state to CHANGE_PASS_STATE");
}
public void doProcessAfterInput() throws PageException {
System.out.println("In doProcessAfterInput");
IPortalComponentRequest request =
(IPortalComponentRequest) this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
IPortalComponentProfile myProfile = myContext.getProfile();
IPortalComponentSession componentSession =
request.getComponentSession();
//idmSpmlBean myBean = (idmSpmlBean) myContext.getValue("idmSpmlBean");
idmSpmlBean myBean =
(idmSpmlBean) componentSession.getValue("idmSpmlBean");
InputField idm_url_input =
(InputField) getComponentByName("idm_url_input");
if (idm_url_input != null) {
this.idm_url = idm_url_input.getValueAsDataType().toString();
myBean.setIdmUrl(idm_url);
}
InputField idm_uid_input =
(InputField) getComponentByName("idm_uid_input");
if (idm_uid_input != null) {
this.idm_uid = idm_uid_input.getValueAsDataType().toString();
myBean.setIdmUid(idm_uid);
}
InputField new_password_input =
(InputField) getComponentByName("new_password_input");
if (new_password_input != null) {
this.new_password =
idm_uid_input.getValueAsDataType().toString();
myBean.setNewPassword(new_password);
}
InputField old_password_input =
(InputField) getComponentByName("old_password_input");
if (old_password_input != null) {
this.old_password =
old_password_input.getValueAsDataType().toString();
myBean.setOldPassword(old_password);
}
InputField confirm_new_password_input =
(InputField) getComponentByName("confirm_new_password");
if (confirm_new_password_input != null) {
this.confirm_new_password =
confirm_new_password_input.getValueAsDataType().toString();
myBean.setConfirmNewPassword(confirm_new_password);
}
}
public void doProcessBeforeOutput() throws PageException {
System.out.println("In doProcessBeforeOutput()");
if (state == INITIAL_STATE) {
this.setJspName("changePassword.jsp");
} else {
this.setJspName("passwordChange.jsp");
}
}
}
}
The first JSP is just a form, but here is the 2nd JSP:
<%@ page language="java" %>
<%@ taglib uri= "tagLib" prefix="hbj" %>
<jsp:useBean id="idmspmlBean" scope="session" class="com.waveset.spml.password.idmSpmlBean" />
<hbj:content id="myContext2" >
<hbj:page title="PageTitle2">
<hbj:form id="myFormId2" >
<hbj:textView
id="message1"
design="HEADER1" >
<% message1.setText("uid = " + idmspmlBean.getIdmUid());
%>
</hbj:textView>
<p>
<p>
<hbj:textView
id="message2"
design="HEADER1" >
<% message2.setText("url = " + idmspmlBean.getIdmUrl());
%>
</hbj:textView>
<p>
<p>
<hbj:textView
id="message3"
design="HEADER1" >
<% message3.setText("old password = " + idmspmlBean.getOldPassword());
%>
</hbj:textView>
<p>
<p>
<hbj:textView
id="message4"
design="HEADER1" >
<% message4.setText("New Password = " + idmspmlBean.getNewPassword());
%>
</hbj:textView>
<p>
<p>
</hbj:form>
</hbj:page>
</hbj:content>
All of these values print out null.