hi all,
i have bean class,JSP Dynpage and JSP.when i run the portal it shows Error occurs during the rendering of jsp component.....for second JSP...first JSP is running fine...
bean class
===========
public class ClassFirst {
public String name;
public String designation;
public String location;
public void setName(String name) {
this.name=name;
System.out.println(name);
if(name.equals("purush")){
this.designation="pat";
this.location="tco";
} else {
this.designation="not known";
this.location="not known";
}
}
public String getName() {
return name;
}
public String getDesignation() {
return designation;
}
public String getLocation() {
return location;
}
}
JSP Dynpage
=============
package com.cts.purush;
import com.cts.puruh.ClassFirst;
import com.sapportals.htmlb.InputField;
import com.sapportals.htmlb.event.Event;
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.JSPDynPage;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.prt.component.IPortalComponentContext;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
public class DynFirst extends PageProcessorComponent {
public DynPage getPage(){
return new DynFirstDynPage();
}
public static class DynFirstDynPage extends JSPDynPage{
private final static int INITIAL_VALUE=0;
private final static int FINAL_VALUE=1;
private int state=INITIAL_VALUE;
public void doInitialization(){
}
public void doProcessAfterInput() throws PageException {
InputField inf=(InputField)getComponentByName("name");
IPortalComponentRequest request=(IPortalComponentRequest)this.getRequest();
IPortalComponentContext ctxt=request.getComponentContext();
IPortalComponentResponse response=(IPortalComponentResponse)this.getResponse();
ClassFirst myBean=new ClassFirst();
String n=inf.getValueAsDataType().toString();
myBean.setName(n);
state=FINAL_VALUE;
}
public void doProcessBeforeOutput() throws PageException {
IPortalComponentResponse response=(IPortalComponentResponse)this.getResponse();
switch(state) {
case INITIAL_VALUE:
this.setJspName("JspFirst.jsp");
break;
case FINAL_VALUE:
this.setJspName("JspSecond.jsp");
break;
}
}
public void Confirm(Event event)throws PageException {
IPortalComponentResponse response=(IPortalComponentResponse)this.getResponse();
state=FINAL_VALUE;
}
}
}
First JSP
==========
<%@ taglib uri="tagLib" prefix="hbj" %>
<jsp:useBean id="newBean" scope="application" class="com.cts.puruh.ClassFirst" />
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<hbj:inputField
id="name"
type="String"
width="250px"
value=" "
jsObjectNeeded="true">
</hbj:inputField>
<hbj:button
id="send"
text="submit"
tooltip="send"
onClick="Confirm"
width="100px"
disabled="false"
design="EMPHASIZED">
</hbj:button>
</hbj:form>
</hbj:page>
</hbj:content>
Second JSP
===========
<%@ taglib uri="tagLib" prefix="hbj" %>
<jsp:useBean id="newBean" scope="application" class="com.cts.puruh.ClassFirst" />
<hbj:content id="myContext">
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<hbj:textView
id="name"
text="<%=newBean.getName(); %>">
</hbj:textView>
<hbj:textView
id="designation"
text="<%=newBean.getDesignation(); %>">
</hbj:textView>
<hbj:textView
id="location"
text="<%=newBean.getLocation(); %>">
</hbj:textView>
</hbj:form>
</hbj:page>
</hbj:content>