Hello Everyone,
I have created a portal application invlving two JSP pages .These JSP pages have HTMLB controls placed on them. my application logic is such that when i click a button on first JSP after entering some value in the input field present on same JSP page, the second JSP page should get displayed with a particular message in a textview present on that 2nd JSP page. The problem i am facing is that when i run the application, first JSP gets displayed then i enter some value in the input field...till here its fine....but after entering a vlaue when i click the button the second JSP is not getting displayed ...it shows again 1st JSP with no value in input field. Can anyone help me with the nature of this problem & what steps can be taken to resolve it.
I am pasting the code of the application below.
Component code
package com.lti.portal;
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 SampleJSPDYNComp extends PageProcessorComponent {
public DynPage getPage(){
return new SampleJSPDYNCompDynPage();
}
public static class SampleJSPDYNCompDynPage extends JSPDynPage{
public int State= 4;
public String Value;
public void doInitialization(){
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentResponse response=(IPortalComponentResponse)this.getResponse();
IPortalComponentContext myContext=request.getComponentContext();
IPortalComponentProfile myProfile=myContext.getProfile();
}
public void doProcessAfterInput() throws PageException {
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentResponse response=(IPortalComponentResponse)this.getResponse();
IPortalComponentContext myContext=request.getComponentContext();
IPortalComponentProfile myProfile=myContext.getProfile();
InputField myInputField =(InputField)this.getComponentByName("user_name_input");
if(myInputField!=null)
{
response.write("ABC");
State=5;
this.Value=myInputField.getValue().toString();
}
}
public void doProcessBeforeOutput() throws PageException {
if(State==4)
{
this.setJspName("SampleJSPFile.jsp");
}
else
{
this.setJspName("SecondJSP.jsp");
}
}
public void onDisplayButtonClicked(Event event)
{
State=5;
}
}
}
First jsp code
<%@ taglib uri= "tagLib" prefix="hbj" %>
<hbj:content
id="myContext">
<hbj:page
title="PageTitle">
<hbj:form
id="myFormId">
<hbj:label
id=name_lable
text="Enter your name"
design="LABEL"
required="TRUE"
labelFor="user_name_input"
/>
<hbj:inputField
id="user_name_input"
type="STRING"
design="STANDARD"
width="250"
maxlength="30"
/>
<hbj:button
id="Display_Button"
text="Display"
tooltip="Display name"
onClick="onDisplayButtonClicked"
width="100"
design="EMPHASIZED">
<%
myFormId.setDefaultButton(Display_Button);
%>
</hbj:button>
</hbj:form>
</hbj:page>
</hbj:content>
second JSP
<%@ taglib uri= "tagLib" prefix="hbj" %>
<hbj:content
id="myContext" >
<hbj:page
title="PageTitle">
<hbj:form
id="myFormId" >
<hbj:textView
id="Welcome_message"
design="HEADER1">
<%
welcome_message.setText("Hello"+Value);
%>
</hbj:textView>
</hbj:form>
</hbj:page>
</hbj:content>
Portalapp.xml
<application>
<application-config>
<property name="SharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="SampleJSPDYNComp">
<component-config>
<property name="ClassName" value="com.lti.portal.SampleJSPDYNComp"/>
<property name="ComponentType" value="jspnative"/>
<property name="JSP" value="pagelet/SampleJSPFile.jsp"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
</components>
<services/>
</application>