Skip to Content
0
Former Member
Apr 14, 2005 at 10:16 PM

getting data into a bean / sharing a bean with JSPs

159 Views

Hi there,

I am using SAP NetWeaver Developer Studio 2.0.9 to develop a special iView (I do not have a PDK on my portal). This iView should present data in a tabular form, so I used HTMLB in a JSP to define a TableView.

Then I made a bean (simple Java class) that has a TableViewModel as a private member with according getter and setter methods

The Developer Studio wizard generated a JSPDynPage with a doProcessBeforeOutput() method that looked like this:

public void doProcessBeforeOutput() throws PageException {
  //Form myForm = this.getForm(); // get the form from DynPage
  RackDataBean myTableViewBean = new RackDataBean();
  ((IPortalComponentRequest)getRequest()).getServletRequest().
    setAttribute("myTableViewBean", myTableViewBean);
  // fill bean with data here
  this.setJspName("RackDataJSP.jsp");

But how? My data does not come from an R/3 system or anything. It needs to be pushed in from the outside. The data does not have to be persistent, it is just for a little demo. So my idea was to probably have a JSP (maybe another one) taking it's request parameters and putting it into the bean. With a forced refresh of the iView the data should show up.

As a test, I tried to append this to the doProcessBeforeOutput() method:

  String event = ((IPortalComponentRequest)getRequest()).
    getServletRequest().getParameter("event");
  String date = ((IPortalComponentRequest)getRequest()).
    getServletRequest().getParameter("date");
  String time = ((IPortalComponentRequest)getRequest()).
    getServletRequest().getParameter("time");
  String sever = ((IPortalComponentRequest)getRequest()).
    getServletRequest().getParameter("severity");
  String[][] str = {{event, date, time, severity}};
  myTableViewBean.setModel(
    new DefaultTableViewModel(str, RackDataBean.colnames));

But it does not work. The iView works fine and I see my table view with the right columns, but no data in it, so the JSP at least seems to be correct. What would be the right way to do this?

Thanks,

Ingmar

Message was edited by: Ingmar Frank