Quantcast
Viewing all articles
Browse latest Browse all 3876

Getting Null Value in JSP DYN PAGE Component


Hi experts,

I created a JSP DYN Page component, i have JSP Page as Vin.JSP and JSPDYNPage Class as VinDyn.class and im using a bean VinBean , i have a simple task of exchanging value between jspdynpage class and jsp using bean class in session scope.

 

 

In the VinBean class , i have a string variable called as name. Im setting value to this in my JSPDYNPage class , doInitilization method and trying to access the same in my JSP page but getting value as null, please help me out and my JSP page code is here..

 

***************************************************JSP PAGE*****************************************************

 

<jsp:useBean id="myBean" scope="session" class="com.*****.VinBean" />

<hbj:content id="myContext" >

  <hbj:page title="PageTitle">

   <hbj:form id="myFormId" >

<html>

<body>

<p>Value-><%=myBean.getName()%></p>

</body>

</html>

   </hbj:form>

  </hbj:page>

</hbj:content>

 

 

 

 

 

***********************************************************JSP PAGE***********************************************************

 

 

 

 

*************************************JSP DYN PAGE CLASS CODE ****************************************************************

package com.********;

import com.sap.tc.logging.FileLog;
import com.sap.tc.logging.Location;
import com.sap.tc.logging.Severity;
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 VinDyn extends PageProcessorComponent
{
  public static String logFileURL = "VinDyn_Log.txt";
 
  private static Location myLoc =  Location.getLocation("com.*******.LogonModule");
      static {
       myLoc.setEffectiveSeverity(Severity.DEBUG);
       myLoc.removeLogs();
       myLoc.addLog(new FileLog(logFileURL));
      }
 
 
 
 
 
 
    public DynPage getPage()
    {
      return new VinDynDynPage();
    }
 
    public static class VinDynDynPage extends JSPDynPage
    {
   
      private VinBean myBean = null;
   
      public void doInitialization()
      {
      
     myLoc.infoT("In doInitialization Method");
        IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
        Object o = componentSession.getValue("myBean");
        if(o==null || !(o instanceof VinBean))
        {
          myBean = new VinBean();
          componentSession.putValue("myBean",myBean);
        } else
        {
            myBean = (VinBean) o;
        }
       
       
        myBean.setName("Govardan");
       
        
        // fill your bean with data here...
      }
 
      public void doProcessAfterInput() throws PageException
      {
    myLoc.infoT("In doProcessAfterInput Method");
   
      }
 
      public void doProcessBeforeOutput() throws PageException
       {
    myLoc.infoT("In doProcessBeforeOutput Method");
          this.setJspName("Vin.jsp");
       }
    }
}

 

 

*********************************************************************JSP DYN PAGE********************************************************

 

 

Please help me to sort out the issue.

when jsp is getting displayed im getting

 

-Value->null


Viewing all articles
Browse latest Browse all 3876

Trending Articles