HI All,
Im building a JSPDynpage that calls a RFC and renders data on a JSP. When I deploy my PAR on the portal server and run my application, it throws the following error.
Caused by: com.sapportals.portal.prt.servlets_jsp.server.compiler.CompilingException: /usr/sap/PSA/JC40/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/WEB-INF/portal/portalapps/NewJcoTest/work/pagelet/_sapportalsjsp_JcoJsp.java:201: *non-static method getBukrs() cannot be referenced from a static context* * tv03.setText(class44bean.getBukrs()); * ^ 1 error
This is my JSP :
<%@ taglib uri="tagLib" prefix="hbj" %> <%@ page import="com.sapportals.htmlb.*" %> <%@ page import="com.sapportals.htmlb.enum.*" %> <%@ page import="com.xxx.class44bean" %> <%@ page import="com.sapportals.htmlb.htmlcontainer.*"%> <%@ page import="com.sapportals.portal.prt.resource.IResource" %> <jsp:useBean id="myBean" scope="session" class="com.xxx.class44bean" /> <hbj:content id="myContext"> <hbj:page title="PageTitle"> <hbj:form id="myFormId"> <% FormLayout f01 = new FormLayout(); myFormId.addComponent(f01); f01.setWidth("600px"); f01.setDebugMode(false); FormLayoutRow row01 = f01.addRow(); row01.setPaddingTop("10px"); row01.setPaddingBottom("5px"); TextView tv01 = new TextView ("tv01"); tv01.setEncode(false); tv01.setText("<font size=\"+1\"><b>Cmmon Man....</b></font>"); TextView tv02 = new TextView ("tv02"); tv02.setEncode(false); tv02.setText("<font size=\"+1\"><b>Now Show up</b></font>"); TextView tv03 = new TextView ("tv03"); tv03.setEncode(false); tv03.setText(class44bean.getBukrs()); TextView tv04 = new TextView ("tv04"); tv04.setEncode(false); tv04.setText("<font size=\"+1\"><b>Now Show up</b></font>"); FormLayoutCell cell01 = f01.addComponent(1,1, tv01); cell01.setHorizontalAlignment(CellHAlign.LEFT); cell01.setPaddingLeft("5px"); FormLayoutCell cell02 = f01.addComponent(1,2, tv02); cell02.setHorizontalAlignment(CellHAlign.RIGHT); cell02.setPaddingLeft("5px"); %> this is a test </hbj:form> </hbj:page> </hbj:content>
This is my Bean
package com.xxx; import com.sapportals.htmlb.table.DefaultTableViewModel; import java.io.Serializable; public class class44bean implements Serializable { public DefaultTableViewModel model; public String fieldName; public String fieldValue; public String bukrs; public String belnr; public String gjahr; public String blart; public String bldat; public DefaultTableViewModel getModel() { return model; } public void setModel(DefaultTableViewModel model) { //this.model = model; } /** * @return */ public String getFieldName() { return fieldName; } /** * @return */ public String getFieldValue() { return fieldValue; } /** * @param string */ public void setFieldName(String string) { fieldName = string; } /** * @param string */ public void setFieldValue(String string) { fieldValue = string; } /** * @return */ public String getBelnr() { return belnr; } /** * @return */ public String getBlart() { return blart; } /** * @return */ public String getBldat() { return bldat; } /** * @return */ public String getBukrs() { return bukrs; } /** * @return */ public String getGjahr() { return gjahr; } /** * @param string */ public void setBelnr(String string) { belnr = string; } /** * @param string */ public void setBlart(String string) { blart = string; } /** * @param string */ public void setBldat(String string) { bldat = string; } /** * @param string */ public void setBukrs(String string) { bukrs = string; } /** * @param string */ public void setGjahr(String string) { gjahr = string; } }
Now in my bean if I make my variable BUKRS and the method getBukrs() as STATIC the error goes off. But thats not the way it should be done.
Any Ideas ?