Pass ArrayList to jsp and display first index of resultset?

Is it possible for me to pass an ArrayList to a jsp, and display the each resultset stored in the ArrayList by the ArrayList index?
The code below gets passed two paramaters. An invorg, and item. It then creates resultset based upon the Object and puts the results into an ArrayList.
The resultset returned varies, but the largest resultset that I have received back has not been bigger thatn 10 resultset rows, and the largest number of columns has been 27 columns.
I would then like to pass the whole ArrayList to the jsp and display the contents for each row based on the index it is on.
Is this possible?
public class RunReportAction extends MTDAction
    ArrayList results;   
    public RunReportAction()
    public boolean execute(HttpServletRequest _req, HttpServletResponse _res) throws ServletException, IOException
        String item = _req.getParameter("itemsToAdd");
        String invorg = _req.getParameter("invorg");
        try
            if (rep_type.equals("Vendor"))
                runVendorReport(item, invorg);
            else if (rep_type.equals("Purchase Order"))
                runPOReport(item, invorg);
            else if (rep_type.equals("Inventory"))
                runInventoryReport(item, invorg);
            else if (rep_type.equals("Item Usage"))
                runWhereUsedReport(item, invorg);
            else if (rep_type.equals("Cost/Purchasing"))
                runCostReport(item, invorg);
            else if (rep_type.equals("Planning"))
                runPlanningReport(item, invorg);
        catch (Exception e)
            setView("SSMErrorPage.jsp");
            model = e;
        model = results;
        view = "SSM_Reports";
        return true;
    boolean runInventoryReport(String item, String invorg) throws MTDException
        try
            CallableStatement cs = conn.prepareCall("{call CTI_SSM_PKG.get_inventory_report(?,?,?)}");
            cs.registerOutParameter(3, OracleTypes.CURSOR);
            cs.setObject(2, item, Types.VARCHAR);
            cs.setObject(1, invorg, Types.VARCHAR);
            cs.execute();
            ResultSet rs = (ResultSet)cs.getObject(3);
            while (rs.next())
                InventoryObj inventory = new InventoryObj();
                inventory.setInvOrg(rs.getString(1));
                inventory.setItem(rs.getString(2));
                inventory.setItemDescription(rs.getString(3));
                inventory.setInvFlag(rs.getString(4));
                inventory.setStockEnabled(rs.getString(5));
                inventory.setTransactable(rs.getString(6));
                inventory.setRevQtyControl(rs.getString(7));
                inventory.setReservable(rs.getString(8));
                inventory.setCheckShortage(rs.getString(9));
                inventory.setLotControl(rs.getString(10));
                inventory.setShelfLife(rs.getString(11));
                inventory.setLotStartPrefix(rs.getString(12));
                inventory.setLotStartNumber(rs.getString(13));
                inventory.setLotCycleCount(rs.getString(14));
                inventory.setPosMeasureError(rs.getString(15));
                inventory.setNegMeasureError(rs.getString(16));
                inventory.setSerialGeneration(rs.getString(17));
                inventory.setSerialNumbStart(rs.getString(18));
                inventory.setSerialPrefixStart(rs.getString(19));
                inventory.setLotStatus(rs.getString(20));
                inventory.setSerialStatus(rs.getString(21));
                inventory.setLotSplit(rs.getString(22));
                inventory.setLotMerge(rs.getString(23));
                inventory.setLocatorControl(rs.getString(24));
                inventory.setToday(rs.getString(25));               
                results.add(inventory); 
                System.out.println(results);
        catch (SQLException e)
            throw (new MTDException("Failed to run report in database.", e));
        //model = results;
        //setView("SSM_Reports.jsp");
        return true;
}jsp code:<%@ page import="java.util.*"%>
<%@ page import="ssmmtd2.InventoryObj"%>
<html>
<head>
<title> SSM 2 Inventory Report </title>
<style>
          A {text-decoration:none;color:black;}
          A:Hover {color:Blue}
</style>
</head>
<%
  ArrayList inventory;
  if (request.getAttribute("model") != null)
    if ((request.getAttribute("model").getClass().getName()).equals("java.util.ArrayList"))
      inventory = (ArrayList)request.getAttribute("model");     
      if (inventory != null && inventory.size() > 0)
      %>
    <body  bgcolor="#FFFFFF">
      <table border = "1" width="755" cellpadding="0" cellspacing = "0">
      <tr>
        <td colspan="3" width="755" align="center">
          <p align="center"><big><b><font color="#000080">Inventory Report</font></b></big>
        </td>
      </tr>
      </table>
      <table border="1" width="755">
        <tr>
          <td width="100%">
            <form>
              <table>
            <%
              Iterator i = inventory.iterator();
              while (i.hasNext())
                InventoryObj invObj = (InventoryObj)i.next();
            %>
              <TR>
                <TD><B>ITEM:</B>
                  <align="left" valign="center"><%=invObj.getItem()%>
                <td><B>DESCRIPTION:</B>
                  <align="left" valign="center"><%=invObj.getItemDescription()%>
              <TR>
              </TR>
              <TR>
              </TR>
              <TR>
              </TR>
                <td><B>ORGANIZATION:</B>
                  <align="left" valign="center"><%=invObj.getInvOrg()%>
                </TD>
                <TD>
                  <B>CURRENT DATE:</B>
                    <align="left" valign="center"><%=invObj.getToday()%></TD>
                </TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                <TR>
                  <TD><B>INVENTORY ITEM</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getInvFlag()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>STOCK ENABLED</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getStockEnabled()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>TRANSACTABLE</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getTransactable()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>REVISION QTY CONTROL</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getRevQtyControl()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>RESERVABLE TYPE</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getReservable()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>CHECK SHORTAGES</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getCheckShortage()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>LOT CONTROL</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotControl()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>SHELF LIFE DAYS</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getShelfLife()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>STARTING LOT PREFIX</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotStartPrefix()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>STARTING LOT NUMBER</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotStartNumber()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>CYCLE COUNT</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotCycleCount()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>POSITIVE MEASUREMENT ERROR</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getPosMeasureError()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>NEGATIVE MEASUREMENT ERROR</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getNegMeasureError()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>SERIAL GENERATION</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialGeneration()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>STARTING SERIAL NUMBER</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialNumbStart()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>STARTING SERIAL PREFIX</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialPrefixStart()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>LOT STATUS</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotStatus()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>SERIAL STATUS</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getSerialStatus()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>LOT SPLIT</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotSplit()%>
                  </TD></TR>
                <TR>
                  <TD><B>LOT MERGE</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLotMerge()%>
                  </TD>
                </TR>
                <TR>
                  <TD><B>LOCATOR CONTROL</B>
                  <TD align="left" valign="center"><b>:</B>  <%=invObj.getLocatorControl()%>
                  </TD>
                </TR>
            <%} %>
              </table>
            <input type="hidden" name="SearchValue">
            <BR>
            <img src="images/close11.bmp" style="cuinvObjor:hand" onmouseover='this.src="images/close12.bmp"' onmouseout='this.src="images/close11.bmp"' onClick="window.close()">     
            <img src="images/print1.bmp" style="cuinvObjor:hand" onmouseover='this.src="images/print2.bmp"' onmouseout='this.src="images/print1.bmp"' onClick='this.src="images/print3.bmp"; window.print()' >
            </form>
          </td>
        </tr>
      </table>
    </body>
<%
%>
</html>

Your arraylist object should be a list of inventory bean objects and then, If you are using struts, you could use logic:iterate tags.. or something equivalent.. you could use forEach in jstl..

Similar Messages

  • How to pass arraylist of object from action class to jsp and display in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name
    thanks a lot

    Double post:
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • Passing values between jsp and php

    hi there, is it possible to pass values between jsp and
    php? i really need to find out the way if there is
    any. thanks in advance
    -azali-

    Yes, there are a few ways to do this.
    1) Think about using Cookies.
    2) Maybe use a Redirect passing the values in the Query string.
    3) Retain the data in a repository in the back end.
    4) Using Hidden fields within your pages.
    I am sure you can use these Idea's for a base to develop other methods on how to pass values back and forth from JSP -> PHP and vice versa.
    -Richard Burton

  • How to send object arraylist from servlet to jsp and display using jstl

    Hi All....
    I have a simple application and problem with it.
    Once user logged in to system the user will redirect to LoginServlet.java controller.
    Then in LoginServlet I want to redirect user to another page called book_details.jsp.
    this is my login servlet.
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              PrintWriter out = response.getWriter();
              ArrayList<BankAccountDTO> account_list = new ArrayList();
              ResultSet resultSet = null;
              LowFairAirDB airDB = null;
              try{
                   airDB = new LowFairAirDB();
                   String query = "SELECT account_id, type, description, balance, credit_line, begin_balance, begin_balance_time_stamp FROM bank_account";
                   airDB.sqlSelect(query);
                   resultSet = airDB.getResultSet();
                   while(resultSet.next()){
                        account_list.add(new BankAccountDTO(resultSet.getInt(1),
                                                                     resultSet.getInt(4),
                                                                     resultSet.getInt(5),
                                                                     resultSet.getInt(6),
                                                                     resultSet.getString(2),
                                                                     resultSet.getString(3),
                                                                     resultSet.getString(7)));
              }catch(Exception ex){
              }finally{
                   try{resultSet.close();}catch(Exception ex){}
                   airDB.sqlClose();
         }I set bank account values to BankAccountDTO.java objects and add them to the arrayList.
    Next I want to send this objects arrayList to books_details.jsp and wanna display each objects values using JSTL.
    I still finding a way to go through this.
    1. Can anyone say how can I do it?
    2. Is there any other method to do the same thing without using JSTL?
    thanks in advance,
    Dil.

    Naishe wrote:
    In your servlet,
    request.setAttribute("account_list", account_list);
    requestDispatcher.findForward("/your/display/jsp");
    Good. I would only follow the Java naming conventions. E.g. accountList or accounts instead of the ugly PHP/C conventions.
    In the JSP,
    lst = (List< BankAccountDTO >)request.setAttribute("account_list");
    for(BankAccountDTO b: lst){
    populate your HTML tags or whatever
    Wrong. 1) You need getAttribute() and 2) you should not use scriptlets. Use JSTL c:forEach, e.g.<table>
        <c:forEach items="${accounts}" var="account">
            <tr>
                <td>${account.id}</td>
                <td>${account.type}</td>
                <td>${account.description}</td>
            </tr>
        </c:forEach>
    </table>To the topicstarter: for future JSP/JSTL related questions please use JSP/JSTL forum.
    Here it is: [http://forums.sun.com/forum.jspa?forumID=45].

  • Passing parameters between JSP and Servlet

    The scenario is as follows:
    There is a JSP page that sends a string as a hidden parameter to a servlet:
    <input type="hidden" name=<%= Book.NAME %> value=<%= book.getName() %> >
    In the servlet there is a print statement that checks the parameter value:
    System.out.println("Book name: "+request.getParameter(Book.NAME));
    The problem is as follows: if the name of the book consists of more than one word
    such as "Servlets and JSP", the print statement will print only Servlet.
    If the JSP page passes a string directly as shown here:
    <input type="hidden" name="Test" value="Test String" >
    The servlet will print the complete string: Test String
    The same problem appears if the string is passed between two JSP pages.
    Any help is greatly appreciated.
    Regards,
    Basil Mahdi

    You might want to try
    <input type="hidden" name="<%= Book.NAME %>" value="<%=URLEncode.encode(book.getName(), "UTF-8")%>" >This will take care of any wierd un-url friendly charcters that might appear in the book titles such as the ' or " which may be the problem.

  • Servlet passing values to JSP and ClasscastException

    I am using weblogic 5.1 to run my Servlets.
              I want to know when I forward from a servlet to a JSP how do I pass
              values especially Java Objects (Sometimes Objects of User written Java
              classes).
              Uptil now I have been putting all values in the session from where the
              JSP picks them up, but somehow I have a feeling that this is not the
              right way.
              In a code I am putting a Java Object (It contains two attributes of
              Java.util.Vector type) in the session so that the JSP to which I am
              forwarding it to can use it I have put my class in the ServletClasses.
              Intertestingly it runs well till the contents of the Vector are changed.
              As the contents of the vector are changed, it throws ClassCastException
              The StackTrace is as follows:
              java.lang.ClassCastException
              at
              jsp_servlet._select_95_account_95_profile._jspService(_select_95_account_95_pro
              file.java, Compiled Code)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java, Compiled
              Code)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
              C
              ompiled Code)
              at
              weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
              ava:143)
              at
              com.logistics.optistopasp.servlet.AccountSelectServlet.doPost(AccountSelectServ
              let.java, Compiled Code)
              at
              com.logistics.optistopasp.servlet.AccountSelectServlet.doGet(AccountSelectServl
              et.java:35)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
              C
              ompiled Code)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
              ava, Compiled Code)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
              ava, Compiled Code)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextMan
              ager.java, Compiled Code)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,
              Compile
              d Code)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
              Compiled Code
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
              Compiled Code)
              Can anybody please Help!!!!.
              Thanks
              Pankaj
              

    Only can confirm your finding - the jsp is using a different class loader to the servlet that originally instantiated the object. There's the rub. I haven't figured out yet how to fix that. I can get the classloader but don't know how to get the runtime to use that class loader to perform cast.
              

  • Passing values between JSP and Bean

    I am trying to validate a date entered by the user on a form. I need to do an "alert" when the user enters a date outside of the valid range depending on a value entered in a drop down.
    Am doing this in checkform function. Here is what I want to do:
    1. Send the the value from the drop down and the date to bean to do the calculations. Call the EJB function from checkform.
    2. Get a string values back into the jsp from the bean
    3. Blow an error to the user to enter a valid date.
    Any help in this case would be greatly appreciated.
    Thanks.

    I only see some design requirements.
    What's the exact coding question? Where are you stucking while coding those requirements accordingly?

  • Passing Arrylist from action class to jsp and parsing in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name

    Double post.
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • ALV - need to sum values of internal table and display in ALV

    I have data in internal table as:
    Material     date     sum1     sum2
    Mat_A     19990101     4     4
    Mat_A     20080501     3     0
    Mat_A     20080601     2     0
    Mat_B     19990101     2     0
    Mat_B     20080601     5     5
    Required output is :
    Material     qty1     qty2     19990101     20080501     20080601
    Mat_A     432     4     4     3     2
    Mat_B     2+5     5     2           5
    Thinking of using ALV to pass the internal table and display as classical report (and also to save as excel spreadsheet).
    Counting your help on the following questions:
    1) How to accomplish the sum in ALV report? Can ALV FM do that or one has to use ABAP to compute the sum from the given internal table?
    2) Mat_A can have more date values. Here it got 3 distinct date values 19990101, 20080601, 20080501. If it has say 5 date values, how to create the ALV date columns (from 3 to 5 date columns) dynamically?
    Thanks for the help.

    for the sum inalv we use generally..
    it_fieldcat-do_sum = 1.
    check this examples...
    http://www.****************/Tutorials/ALV/Subtotals/text.htm
    *& Report  ZTEST_ALV_PERC_13317
    REPORT  ztest_alv_perc_13317.
    TYPE-POOLS: slis.
    DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
          wa_fieldcat TYPE slis_fieldcat_alv,
          it_events TYPE slis_t_event,
          wa_events TYPE slis_alv_event,
          it_sort TYPE slis_t_sortinfo_alv,
          wa_sort TYPE slis_sortinfo_alv,
          l_layout TYPE slis_layout_alv.
    TYPES: BEGIN OF ty_itab,
            field1(10),
            qty1 TYPE i,
            qty2 TYPE i,
            qty3 TYPE i,
            dummy TYPE c,
          END OF ty_itab.
    DATA: itab TYPE STANDARD TABLE OF ty_itab WITH  HEADER LINE,
    itab1 TYPE ty_itab.
    START-OF-SELECTION.
      itab-field1 = 'FIRST'.
      itab-qty1 = 2.
      itab-qty2 = 1.
      itab-qty3 = 5.
      itab-dummy = 10.
      APPEND itab.
      itab-field1 = 'FIRST'.
      itab-qty1 = 2.
      itab-qty2 = 1.
      itab-qty3 = 5.
      itab-dummy = 10.
      APPEND itab.
      itab-field1 = 'FIRST'.
      itab-qty1 = 2.
      itab-qty2 = 1.
      itab-qty3 = 5.
      itab-dummy = 10.
      APPEND itab.
      wa_fieldcat-col_pos = 1.
      wa_fieldcat-fieldname = 'FIELD1'.
      wa_fieldcat-tabname = 'ITAB'.
      APPEND wa_fieldcat TO it_fieldcat.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-fieldname = 'QTY1'.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-do_sum = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      wa_fieldcat-col_pos = 3.
      wa_fieldcat-fieldname = 'QTY2'.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-do_sum = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      wa_fieldcat-col_pos = 4.
      wa_fieldcat-fieldname = 'QTY3'.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-do_sum = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      wa_fieldcat-col_pos = 5.
      wa_fieldcat-fieldname = 'DUMMY'.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-do_sum = 'X'.
      wa_fieldcat-no_out = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
       CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = it_events
        EXCEPTIONS
          list_type_wrong = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program           = sy-repid
         it_fieldcat                    = it_fieldcat
        TABLES
          t_outtab                       = itab
    EXCEPTIONS
       program_error                  = 1
       OTHERS                         = 2
      IF sy-subrc <> 0.
      ENDIF.

  • How to communicate between Flex and JSP and show the result in an Iframe

    Hi all
    I am trying to send some data from flex to one HTTPService and trying to show the same response jsp in an Iframe. But unfortunately i am unable to get the responce Jsp's url to set as a source for iframe.
    let me explain you clearly...I have a mxml where i am having a text box and a button in the left panel and in the right panel i am having an Iframe to display jsp. So once user enters some value in the text box and clicks button then HTTPservice's send method will be called with text box's content as an arguement. So i can fetch that value from request object in jsp and display the value in jsp. So the problem here is i want display that result jsp in my Iframe. I know that , we need that result jsp URL to display in Iframe . But as i am sending POST request to HTTPservice, i am not able to get the result jsp's URL in flex side.
    So i need help desperately from great minds.So anyone of you can give me some suggestions!!!!
    Regards

    Hi all can some one please give a solution ...Any suggestions would be greatly appreciated

  • Timeperiod between onClickButton and Display

    Hi,
    I was programming an iView which did quite a lot of data acquisition in the backend. When the data collection was fast I did not have any problems displaying the results.
    As soon as the data collection took longer (more than two minutes) I had problems displaying the results in the portal. Not only was the result a blank screen, but also the portal was not running anymore due to JavaScript errors.
    To trace the error I programmed a small "JSPDynPage"-iView with only one button which did (almost) nothing but cycle through several for-loops [see code below]. The result was still the same: blank page.
    So does anybody know how I can accomplish this task? Is there a way to return to the JSP and display some temporary results and then when my data collection is done display the rest?
    Thanks for any help,
    Holger.
    public void onTest(Event event) throws PageException {
         myLogger.info("[onTest] - Start");
         StringBuffer longTmpString = new StringBuffer();
         for (int i=0;i<100;i++) {
              longTmpString.append("Test\n");
              if (i % 10==0) {
                   myLogger.info("[onTest] - i="+i);
              for (int j=0;j<100000000;j++) {
                   String nix = "";
         myLogger.info("[onTest] - Set Bean");
         myBean.setResults(longTmpString.toString());
         myLogger.info("[onTest] - End");

    Hi Holger,
    for service implementation / usage see within EP: Java Development - Documentation - Services - Concept - Portal Service Implementation Guide.
    For more questions about handling the situation you described see also this thread form message bar and loading icon
    For awarding points for so nice people as Dagfinn and me, press the yellow star button at the top right of the reply you liked.
    Hope it helps
    Detlev

  • How to retrieve records from a database and display it in a jsp page.Help!!

    Hello everyone ! im very new to this forum.Please help me to solve my problem
    First i ll explain what is my requirement or needed.
    Actually in my web page i have text box to enter start date and end date
    and one list box to select the month .If user select or enter the dates in text box
    accordingly the data from ms access database has to display in a jsp page.
    Im using jsp and beans.
    I tried returning ResultSet from bean but i get nothing display in my web page
    instead it goes to error page (ErrorPage.jsp) which i handle in the jsp.
    I tried many things but nothing work out please help me to attain a perfect
    solution. I tried with my bean individually to check whether the result set has
    values but i got NullPointerException . But the values which i passed or
    available in the database.
    I dint get any reply for my last post please reply atleast to this.
    i get the date in the jsp page is by this way
    int Year=Integer.parseInt(request.getParameter("year"));
    int Month=Integer.parseInt(request.getParameter("month"));
    int Day=Integer.parseInt(request.getParameter("day"));
    String startdate=Day+"/"+Month+"/"+Year;
    int Year1=Integer.parseInt(request.getParameter("year1"));
    int Month1=Integer.parseInt(request.getParameter("month1"));
    int Day1=Integer.parseInt(request.getParameter("day1"));
    String enddate=Day1+"/"+Month1+"/"+Year1;But this to check my bean whether it return any result!
    public void databaseConnection(String MTName,String startDate,String endDate)
    try
             java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
            java.sql.Date sqlFromDate=new java.sql.Date(fromDate.getTime());
            java.sql.Date sqlTillDate=new java.sql.Date(tillDate.getTime());
              String query1="select MTName,Date,MTLineCount from Main where MTName='"+MTName+"'  and Date between '"+sqlFromDate+"' and '"+sqlTillDate+"' " ;
            System.out.println(query1);
              Class.forName(driver);
             DriverManager.getConnection(url);
             preparedStatement=connection.prepareStatement(query1);
             preparedStatement.setString(1,"MTName");
              preparedStatement.setDate(2,sqlFromDate);
              preparedStatement.setDate(3,sqlTillDate);
              resultSet=preparedStatement.executeQuery();           
               while(resultSet.next())
                        System.out.println(resultSet.getString(1));
                        System.out.println(resultSet.getDate(2));
                        System.out.println(resultSet.getInt(3));
            catch (Exception e)
             e.printStackTrace();
    I Passed value from my main method is like thisl
    databaseConnection("prasu","1/12/2005","31/12/2005");Please provide solutions or provide some sample codes!
    Help!
    Thanks in advance for replies

    Thanks for ur reply Mr.Rajasekhar
    I tried as u said,
    i tried without converting to sql date ,but still i din't get any results
    java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
              String query1="select MTName,Date,MTLineCount from linecountdetails where mtname='"+MTName+"'  and Date >='"+fromDate+"' and Date <='"+tillDate+"' " ;
            System.out.println(query1);
    //From main method
    databaseConnection("prasu","1/12/2005","31/12/2005");I got the output as
    ---------- java ----------
    select MTName,Date,MTLineCount from linecountdetails where mtname='prasu'  and Date >='Thu Dec 01 00:00:00 GMT+05:30 2005' and Date <='Sat Dec 31 00:00:00 GMT+05:30 2005'
    java.lang.NullPointerException
    null
    null
    java.lang.NullPointerException
    Output completed (4 sec consumed) - Normal TerminationThanks
    Prasanna.B

  • Pass arraylist from one JSP to another

    Hi all,
    I have a jsp in which i have a table with a list a of users. When we select some users and click on the deactivate link all these user information must be passed to another jsp which is a confirmation page to delete the users.
    In my first userlist jsp i have the code
    <h:commandLink styleClass="bold" value="Deactivate User" action="delete" actionListener="#{userlistcontroller.deleteaction}" ></h:commandLink>faces-config.xml
        <navigation-rule>
        <from-view-id>/userlist.jsp</from-view-id>
        <navigation-case>
          <from-outcome>delete</from-outcome>
          <to-view-id>/deactivateusers.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>In my backing bean action method i populate the list of users that need to be deacivated in an array list
       String userAction;
       List<Integer> selectedUserIDList;
       public void deleteaction(ActionEvent event){
           userAction = "delete";
           selectedUserIDList = new ArrayList<Integer>();
           for (CompanyAdminUser user : userList) {
                 try {
                    boolean val = selectedIds.get(user.getID()).booleanValue();
               if(val){
                    selectedUserIDList.add(user.getID());
                 } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
      }can someone help me how to pass this selectedUserIDList (arraylist ) and the userAction="Delete" to deacviate users jsp.
    Thank you
    Edited by: twisai on Mar 10, 2010 9:02 AM

    You can easily pass the 2 variables you mentioned using <f:param> inside your <h:commandLink>.
    <h:commandLink styleClass="bold" value="Deactivate User" action="delete" actionListener="#{userlistcontroller.deleteaction}" >
    <f:param name="userAction" value="delete" />
    <f:param name="userIDList" value="#{userlistcontroller.selectedUserIDList}" />
    </h:commandLink>

  • Passing vectors into JSP from Servlet and passing data back to Servlet

    I have been building an MVC application.
    It has a controller which instantiates classes and evokes methods to
    populate vectors. These vectors are then passed into a JSP. This part of the application works fine.
    What I am having trouble with is a new JSP I have designed; this will
    display the data that is actioned by the FORM action. This is actioned
    based on the Search criteria entered by the user. Based on this a further vector is populated and brought back to the JSP as a vector
    and this is rendered via the TABLE tag. Again this works fine.
    Against each of the rows displayed, I have a print checkbox which can be checked by the user. On checking the records they want to print, they should then hint a Print button which should go back to the Servlet and print the data. THIS IS WHERE I HAVE THE PROBLEM. On going
    back to the servlet the checkbox values are not displayed, rather
    the values that initially populate the JSP. How do I get these new values back into the vector and hence accessible from the Servlet.
    Any help with be very much appreciated.
    Chris

    Thanks for this.
    Just to clarify I am not using Struts.
    What I am having difficulties with is the fact that:
    I can't get the checked values back to the Servlet - they keep the values they have in the bean - so as part of instantiating the bean class I set the value of the item to 'off'. The user will then check
    the checkbox which should presumbably set the value to 'on'. This isn't happening because the setter method of the bean is not evoked again
    because I don't come into this JSP again - the Servlet has finished here
    and now needs to print the records. It can't do this because as
    far as it is concerned nothing has changed since it last passed through
    the vector to the JSP.
    Even when I do the following:
    Enumeration paramNames = request.getParameterNames();
    String param = null;
    while (paramNames.hasMoreElements())
    param=(String)paramNames.nextElement();
    System.out.println("parameter " + param + " is " +
    request.getParameter(param));
    what comes back is the valus of 'off' as opposed to 'on'.
    The other thing is that 'request.getParameterNames()' only works
    with the first record in the vector, i.e. it doesn't fetch any other
    records that are rendered in the <TABLE> tag.
    In desperation is there anybody out there who can help me.
    Thanks
    Chris
    I am going to assume you are using a MVC framework
    like Struts or very similar (I am assuming that from
    the language you are using).
    When the servlet passes the vector back to the JSP
    page and you render the HTML that is passed back the
    client your Vector is gone. The Vector is not
    available at the HTML level that is being viewed at
    the browser.
    When the user selects the checkboxes and submits the
    page (by clicking the print button) the controller
    servlet (called ActionServlet in Struts, yours maybe
    called something else) forwards the request to the
    appropriate JavaBean and Servlet to process the
    request. Either the JavaBean has to recreate the
    Vector (not recommended) or the processing Servlet can
    (better). You can do this by recreating the Vector
    from scratch for the HttpRequest parameters or, at the
    time of the initial request, saving Vector to a
    session and then updating with the data you get back
    from the client (again from the HttpRequest
    parameters).
    Either way you have to work with
    HttpRequest.getParameter().

  • How to get the query values from the url in a servlet and pass them to jsp

    ok..this is the situation...
    all applications are routed through a login page...
    so if we have a url like www.abc.com/appA/login?param1=A&param2=B , the query string must be passed onto a servlet(which is invoked before the login page is displayed)..the servlet must process the query string and then should pass all those values(as hidden values) to the login jsp..then user enters username and pswd, then there should be another servlet which takes all the hidden values of jsp and also username and pswd, authenticates the user and sends the control back to that particular application along with the hidden values...
    so i need help on how to parse the query string from the original url in the servlet, pass it out to jsp, and then pass it back to the servlet and back to the original application...damnn...any help would be greatly appreciated...thanks

    ok..this is the situation...Sounds like you have a bad design on your hands.
    You're going to send passwords in a GET request as clear text? Nice security there.
    Why not start with basic security and work your way up?
    %

Maybe you are looking for

  • The excise invoice is  generatiing with inconsistant effect.

    Dear All, in my client i m having the excise invoice generation with the billing document at single step. but some there is ome in consistancy in this. some times when we do it in single process the excise invoice is not getting generated. it means i

  • MAB and Active directory check

    Hi I have ISE 1.2 I would like to know if it is possible to configure AD check for MAB user I have some user that are authenticated by MAB But I need to add another check for those user, ISE should check the Active directory group user widows session

  • Problem in business service

    hai, i have created a simple idoc to file application. i have got a problem in technical routing and the error category is "outbinding", error ID id "CO_TXT_OUTBINDING_NOT_FOUND" the sender service is not one which i 've created.  it is displaying th

  • Data retrieval from failed ibook hard drive

    my ibook G4's hard drive failed after about 18 months, which is ridiculous in itself. they tell me i have to send it off somewhere for data retrieval. WHERE is a good place to do this? i need the data.

  • Are extensions in the Safari gallery safe?

    Hi, I'm not a huge extension person, but there are a few in the Safari gallery on Apple's site that interest me, but they are from small developers.  I know the galler is similar to the app store (in terms of needing apple's approval) but I wanted to