How use bean of array with tag "jsp:useBean"??

hi,all
a bean of array put request with a servlet and forward a jsp page,this jsp use "jsp:useBean" of tag get the bean of array.
how do for jsp:useBean of tag??
thx.....

You can't use an array directly in a jsppage. first u have to write the line <useBean /> through which you can access youtr class
<jsp:useBean id="email" class="Pack.Email" scope="session" />
after writing this line you have your class in your hand, you can think of "email" as it is a class object of Email class which is a Bean...
declare a private array in the Bean and then made method getArray() which will return an array ... then you can use your array in jsp....
an example of using a class variable in JSp is given below
public String[] getArray() // note method must be public
return array;
now in your jsp page you have to use that class with
<jsp:useBean id="email" class="Pack.Email" scope="session" />
and cnow you can use array like this....
<%
String[] array=email.getArray();
for (int i=0; i< array.length;i++ )
out.println(array]);
%>
Does it solve your problem now ?

Similar Messages

  • UIX/JSP - How to use the UIX Controller with UIX/JSP

    After reading the UIX Developers Guide I am under the impression that I could use the UIX Controller with UIX/JSP pages. Is this correct and are there any available examples?
    Bill G...

    It's correct, but I'm afraid we don't have much (read as "any")
    documentation on how to do that - besides reading through the
    gobs of Javadoc and guessing how to put it together.
    Half of the problem is solved by registering JspPageDescriptions
    on a PageBroker (e.g., UIXPageBroker) to tell the UIX Controller
    to use a JSP to render a particular page, instead of a UIX XML
    document.
    The other half is getting the JSP to send requests back to
    the UIX Controller. Depending on how you've chosen to name
    your pages, create either a DefaultPageEncoder or ExtensionPageEncoder
    inside your JSP, and use that to create destination URLs.

  • How to build a array with high sampling rates 1K

    Hi All:
    Now I am trying to develop a project with CRio.
    But I am not sure how to build a array with high sampling rates signal, like >1K. (Sigle-point data)
    Before, I would like to use "Build Arrary" and "Shift Register" to build a arrary, but I found it is not working for high sampling rates.
    Is there anyother good way to build a data arrary for high sampling rates??
    Thanks
    Attachments:
    Building_Array_high_rates.JPG ‏120 KB

    Can't give a sample of the FPGA right now but here is a sample bit of RT code I recently used. I am acquiring data at 51,200 samples every second. I put the data in a FIFO on the FPGA side, then I read from that FIFO on the RT side and insert the data into a pre-initialized array using "Replace Array subset" NOT "Insert into array". I keep a count of the data I have read/inserted, and once I am at 51,200 samples, I know I have 1 full second of data. At this point, I add it to a queue which sends it to another loop to be processed. Also, I don't use the new index terminal in my subVI because I know I am always adding 6400 elements so I can just multiply my counter by 6400, but if you use the method described further down below , you will want to use the "new index" to return a value because you may not always read the same number of elements using that method.
    The reason I use a timeout of 0 and a wait until next ms multiple is because if you use a timeout wired to the FIFO read node, it spins a loop in the background that polls for data, which rails your processor. Depending on what type of acquisition you are doing, you can also use the method of reading 0 elements, then using the "elements remaining" variable, to wire up another node as is shown below. This was not an option for me because of my programs architecture and needing chunks of 1 second data. Had I used this method it would have overcomplicated things if I read more elements then I had available in my 51,200 buffer.
    Let me knwo if you have more qeustions
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    RT.PNG ‏36 KB
    FIFO read.PNG ‏4 KB

  • How to populate an array with random text files.

    I am making a Jeopardy program. I have my program set up so that it retrieves 5 random text files. I just want to know how I populate one array with all the lines from the text files my program is retrieving.

    You can read a textfile line by line and add each line to an ArrayList. An ArrayList is very much like an array only that it's "open ended". You can start adding lines without first knowing how many you're going to get. If you still want an ordinary "static" array when you're finished reading lines you can easily get one from the ArrayList and then drop the ArrayList.

  • How to create 2D array with 3 rows and unlimit column?

    how to create 2D array with 3 rows and unlimit column?

    Here are images of what I described in my previous post
    Message Edited by JoeLabView on 11-14-2007 07:56 AM
    Attachments:
    2D-array_code.PNG ‏7 KB
    2D-array_values.PNG ‏13 KB

  • How to compare 2 arrays with different operator options using parameters in Teststand

    Pls let me know how to compare 2 arrays using different operators like <= or >= or ==......

     I am using TS 2010. FYI
    ex:
    Array XX [ A_Temp,
                   B_Temp,
                   C_Oil Pressure,
                   D_Oilpressure,
    Note : A_Temp, B_Temp,C_Oil Pressure,D_Oilpressure all these parameters will be getting  numerical values (dynamically) from the simulink models and also in future I may need to add parameters to this array.
    Array YY [A_Temp_1,
                   B_Temp_2,
                   C_Oil Pressure_3,
                   D_Oilpressure_4,
    Note : A_Temp_1, B_Temp_2,C_Oil Pressure_3,D_Oilpressure_4 all these parameters will be getting  numerical values (dynamically) from the simulink models
    So my question :
    I would like to verify A_Temp >= A_Temp_1
                                B_Temp >= B_Temp_2
                                C_Oil Pressure  >= C_Oil Pressure_3  etc

  • How to build a array with collected data

    Hi,
    I have collected data from serial port with VISA. Now I want to build a array with 100 date points. Should I connect VISA Read with Build Array directly? How to do it?
    PS: All of them are in a While Structure.
    Thank you!

    An inefficient way to create the array is to use the build array and a shift register as shown below. It's more effecient in terms of memory management to create the array and then use the replace array subset as shown in the other image. Of course, if you don't need the array inside the loop, just wire the value out of the while loop and on the exit tunnel, right click and select 'Enable Indexing'.
    Message Edited by Dennis Knutson on 07-03-2007 10:25 PM
    Message Edited by Dennis Knutson on 07-03-2007 10:26 PM
    Attachments:
    Crude Build Array.PNG ‏4 KB
    Better Build Array.PNG ‏6 KB

  • How to create a array with variables dimensions?

    I try to create a array like that:
    Object[][] data;
    data = new Object[] [];
    But that's doesn't work!
    Apparently I must specify the dimension of my array
    So I have done like that :
    Object[][] data;
    data = new Object[3] [3];
    And that work!
    But the problem is when I need to add extra elements to my array.
    If I write :
    data[4][1] = "123";
    I have the error message :
    java.lang.ArrayIndexOutOfBoundsException
    So, how can I defined a array with variables dimensions OR how can I add a dimension to a array?

    if you have:
    Object[][] data;
    data = new Object[3] [3];you end yo getting ArrayIndexOutOfBoundException if you try to point to some other Indexes. You can increase the size by doing new:
    Object[][] data;
    data = new Object[4] [3];and then copy the old Arrays to this one... this is heavy.
    Other thing to consider then is using some other datastructure, such as Vector, which grows along you add elements to it.
    P_trg

  • Need help with the jsp:useBean tag

    Dear Fellow Java/JSP developers:
    I am trying to use the <jsp:useBean> tag in a jsp that displays the values from a javaBean that gets populated by another class.
    <%@ page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ page import = "java.util.ArrayList"%>
    <%@ page import = "java.util.Iterator"%>
    <%@ page import = "salattimes.CalendarParse" %>
    <%@ page import = "salattimes.Salat" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            <jsp:useBean id="test" scope="session" class="calendar.Time" />
            <% CalendarParse sTime = new CalendarParse();
                Time mytime = sTime.runExample();%>
            <%=mytime.getA() %>
            <%=mytime.getB() %>
            <%=mytime.getC() %>
            <%=mytime.getD() %>
            <%=mytime.getE() %>
        </body>
    </html>However, up to now, I am only able to display the values on my JSP page using the scriptlet
    <% CalendarParse sTime = new CalendarParse();
                Time mytime = sTime.runExample();%> to declare and create the object (the method call sTime.runExample(); populates the fields in the Java Bean), and the expressions:
    <%=mytime.getA() %>
             <%=mytime.getB() %>
             <%=mytime.getC() %>
             <%=mytime.getD() %>
             <%=mytime.getE() %>to present the values on the screen. What I would like to do is assign the object that I create to a javaBean reference declared in a <jsp:useBean> tag as follows:
    <jsp:useBean id="test" scope="session" class="calendar.Time" />
            <% CalendarParse sTime = new CalendarParse();
                test = sTime.runExample();%>and then present the values stored in the bean to the JSP page as follows:
    <jsp:getProperty name="test" property="a" />
            <jsp:getProperty name="test" property="b" />
            <jsp:getProperty name="test" property="c" />
            <jsp:getProperty name="test" property="d" />
            <jsp:getProperty name="test" property="e" />
            <jsp:getProperty name="test" property="f" />Is this possible? When I try the above, I get "null" as my output on the screen. When I try the first approach listed above, I get the values I am looking for. Is there a way to accomplish this using the <jsp:useBean> approach?
    Thanks to all those who reply.
    Sincerely;
    Fayyaz

    The code:
    <jsp:useBean id="calendar" class="calendar.CalendarParse" scope="session"/>
    <c:set var="time" value="${calendar.time}"/>Would be roughly equivalant to:
    calendar.CalendarParse calendar = new calendar.CalendarParse();
    Object time = calendar.getTime();I assumed that the CalendarParse object was in the calendar package because that was were your Time class was (when you used <jsp:useBean id="test" scope="session" class="calendar.Time" />"), but when I look back at your original post I see I was wrong and the use of calendar as both the incorrect package and the variable name was confusing. To make the code more similar to your original post the code should have read:
    <jsp:useBean id="sTime" class="salattimes.CalendarParse"/>
    <c:set var="myTime" value="${sTime.time}" scope="session"/>
    ${myTime.a}
    ${myTime.b}
    ${myTime.c}
    etc...Here is an explanation of the parts:
             /* name of the variable */  /* fully qualified class name, package.className */
    <jsp:useBean id="sTime"           class="salattimes.CalendarParse"/>
      /* name of the new object from bean */  /* source of object, variable.property */    /* Scope of new object */
    <c:set var="myTime"              value="${sTime.time}"             scope="session"/>
    /* data to display variable.property */
    ${myTime.a}Where a 'property' in a bean is defined as a method in the form of getProperty(). So the 'time' property is getTime() and the 'a' property is getA().

  • How to fill an array with random numbers

    Can anybody tell me how I can fill an array with thousand random numbers between 0 and 10000?

    import java.util.Random;
    class random
         static int[] bull(int size) {
              int[] numbers = new int[size];
              Random select = new Random();
              for(int i=0;i<numbers.length;i++) {
    harris:
    for(;;) {
    int trelos=select.nextInt(10000);
    numbers=trelos;
                        for(int j=0;j<i;j++) {
    if(trelos==numbers[j])
    continue harris;
    numbers[i]=trelos;
    break;
    return numbers;
    /*This method fills an array with numbers and there is no possibility two numbers to be the
         same*/
    /*The following method is a simpler method,but it is possible two numbers to be the same*/
    static int[] bull2(int size) {
         int[] numbers = new int[size];
    Random select = new Random();
    for(int i=0;i<numbers.length;i++)
              numbers[i]=select.nextInt(9);
              return numbers;
         public static void main(String[] args) {
    int[] nikos = random.bull(10);
    int[] nikos2 = random.bull2(10);
    for(int i=0;i<nikos.length;i++)
    System.out.println(nikos[i]);
    for(int i=0;i<nikos2.length;i++)
    System.out.println(nikos2[i]);

  • How to traverse an array with a for-loop in this certain way...

    so I need to traverse an array starting from the first element, then from the last element, then the second element, then the second last element, then third element and so on... in a for loop
    how would that look in code?
    Any help would be appreciated, thanks!
    Edited by: inspiredone on Apr 4, 2008 6:34 AM

    Wow, that's a really clever and elegant way to do it promethuzz. I actually came up with something already before I read your post so yeah don't worry about me copying or anything. Mine is not as elegant/efficient and I definitely like yours a lot more but I will just share it anyway...it looks pretty similar to the second algorithm The_Matrix has provided. I figured this out from thinking how quicksort compares its pivot with the two indexes...
        int front=0;
        int back = a.length - 1;
        int counter =0;
        boolean switchflag = true;
        while(front<=back)
          System.out.println(a[counter]);
          if(switchflag)
            counter = back;
            front++;
            switchflag = false;
          else
            counter = front;
            back--;
            switchflag = true;
        } Anyways, thanks a lot for you guys help, promethuzz, The_Matrix, and newark.
    Edited by: inspiredone on Apr 4, 2008 11:25 AM
    Edited by: inspiredone on Apr 4, 2008 11:27 AM

  • How to initialize the array with object?

    Here is type I have.
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_TYPE AS OBJECT
    BU_AP VARCHAR2(5),
    VOUCHER VARCHAR2(10),
    V_LINE INTEGER,
    USERID VARCHAR2(20),
    COMMENT_DTTM DATE,
    COMMENT VARCHAR2(254)
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_COLL AS VARRAY(1000) OF SYSADM.AP_COMMENT_TYPE;
    Then I created a procedure to grab some data.
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher
    AND voucher_line_num = voucher_comment (i).v_line;
    BEGIN
    voucher_comment (1) := ap_comment_type (' ', ' ', 0, ' ', '', ' ');
    --voucher_comment (1) := ap_comment_type (null, null, null, null, null,null);
    IF voucher_comment (i).v_line = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;
    But when I tried to test the procedure, got error: ORA-06531: Reference to uninitialized collection. Does anyone have experience of handling array with object?
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL;
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 1, 'KEHE', O_voucher_comment);
    end;

    Thanks for that. I changed it a little bit, but when i ran this script, got ORA-06532: Subscript outside of limit.
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL := sysadm.ap_comment_coll(null);
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 0, 'KEHE', O_voucher_comment);
    end;
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in
    AND voucher_line_num = v_line_in;
    BEGIN
    --voucher_comment() := SYSADM.ap_comment_type (NULL, NULL, NULL, NULL, NULL, NULL);
    --' ', ' ', 0, ' ', '', ' ' sysadm.ap_comment_coll
    voucher_comment := sysadm.ap_comment_coll(null);
    IF v_line_in = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              if i > 1
              then
                   voucher_comment.EXTEND;
              end if;
    voucher_comment (i) := ap_comment_type (v_bu_in,
    v_voucher_in, v_line_num, v_userid,
    TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS'), v_comments );
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.extend(6);
    voucher_comment (i) := ap_comment_type (v_bu_in, v_voucher_in, v_line_num, v_userid, TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS' ), 'DD-MON-YYYY HH24:MI:SS'), v_comments);
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;

  • How to encrypt byte array with out padding using RSA in Java?

    I've modulus and public exponent as byte[] array, so I'm trying to convert into BigIntegers and then create public key and then Cipher. Here is the example code:
    With this I'm always getting different encrypted bytes, is it because of padding. I dont want to use any padding so what parameter I need to pass along with RSA? I've modulus byte[] array size 64 bytes. I believe I'll get 64 encrypted bytes. I've content size of 32 bytes to be encrypted.
    --------code begin ---------------------------
    BigInteger bexponent = new BigInteger(pubExpo);
    BigInteger bmodulus = new BigInteger(modulus);
    KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(bmodulus, bexponent);
    RSAPublicKey pubKey = (RSAPublicKey)keyFactory.generatePublic(pubKeySpec);
    Cipher c = Cipher.getInstance("RSA");
    c.init(Cipher.ENCRYPT_MODE, pubKey);
    return c.doFinal(content);
    --------code end---------------------------

    With this I'm always getting different encrypted
    bytes, is it because of padding. Yes, if you're using PKCS1Padding (which is the default in SunJCE if you don't specify it). Have a look at the PKCS1 spec if you haven't seen it already.
    http://www.rsasecurity.com/rsalabs/pkcs
    Section 7.2.1 talks about type 2 padding, which uses random bytes as the PS string.
    I dont want to use
    any padding so what parameter I need to pass along
    with RSA? NOPADDING. You should be able to find this out by look at the "Supported Paddings" parameter in your provider's database. Which of course, means you'll need to supply the right number of bytes to the Cipher.

  • How to make an array with ActiveX Excel using Excel_RangeSetValue2?

    Hello,
    I want to make an array on Excel. For that, I'm using two functions : Excel_WorksheetGetRange and Excel_RangeSetValue2.
    I write the array on Excel file but only the first case of the array is copied.
    Here, a part of my program :
    char * DataToWrite = {"A", "B", "C", "D"}
    char cCell[10];
    VARIANT             vCell, Data;
    ExcelObj_Worksheet hWorksheet;
    ExcelObj_Range      hRange;
      CA_VariantSetCString (&vCell,cCell);        //cCell = A1:A4
      Excel_WorksheetGetRange (hWorksheet, NULL, vCell, CA_DEFAULT_VAL, &hRange);
      CA_VariantSetCString (&Data,DataToWrite );
      Excel_RangeSetValue2 (hRange, NULL, Data);
    Here what I obtain when I'm compiling on Excel file :
    A
    A
    A
    A
    Solved!
    Go to Solution.

    You should use other instructions to fill the range of cells:
    strcpy (msg, "A1:A4");
    CA_VariantSetCString (&MyVariant, msg);
    Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyVariant, CA_DEFAULT_VAL, &ExcelRangeHandle);
    Excel_RangeActivate (ExcelRangeHandle, NULL, NULL);
    // Create a SafeArray from array of data
    CA_VariantSet2DArray (&MyVariant, CAVT_CSTRING, righe, 1, array);
    // Transfer data to Excel range
    Excel_SetProperty (ExcelRangeHandle, NULL, Excel_RangeValue2, CAVT_VARIANT, MyVariant);
    ClearObjHandle (ExcelRangeHandle);
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Can a Servlet be used for Storing Objects with both JSP and JSF used on it?

    Hi,
    Pages I have:
    SearchEmployee.jsp
    This page has a search engine that search out the Employee. This Employee Object will be stored inside a Servlet(controller) for future references by other pages. I used JSP, html tags for forms, and request.getParameter() to built this search engine.
    Problem:
    I have a JSF Form that wants to DISPLAY the employee which I have found in my Search Engine. How can I get the JSF's value="#{Controller.employeeObj.name}" to get the value from the object?
    This seems logical as my JSF form is just retrieving the stored object in the Controller. I currently cant seem to output it

    The servlet shouldn't be used to store ANY data, let alone data to be accessed by other sevlets. Put the object into the Session object.

Maybe you are looking for