Retaining of values in JSP while using JSTL

Dear All,
I have an application using the struts framework, wherein I am facing a problem.
Here goes the problem " In my JSP's I have multiselect, the JSTL tags works fine when all the server side validations are done. But I get a problem when an error(server side validation error) occurs, I have to retain all the multiple values selected in the Multiselect box.
Can anyone suggest me best way to retain the multiple values.
E.g. My multiselect populates 5 values
A
B
C
D
E
As a end user I select "B, C,E", and a server side validation error occurs I have to keep the values "B, C, E" selected in the above list of 5 values using JSTL
Thanking you in anticipation.
regards,
Mohan.

Dear Friend,
The control I am placing(multi select) has the data type in the form as String[],
The validation error(server side) I was talking about is: I have 5 fields in JSP, in one of the 5 fields I have a title, which is unique in the database, if the end user enters an already existing title, then all the values previously (entered, selected) for rest of the controls should be retained and an error message from application resources is populated about the title duplication.
Here I will show the entered values in text box and also the multi-selects, so using JSTL, I want a way out to retain the previously selected values....
In my JSP for the control I say <input type="select" property="propertyname" multiple="true">
of struts...
Thank you
Mohan.

Similar Messages

  • Posting huge data on to JSP page using JSTL tags

    Hi,
    I have one application where I have to post huge data (approximately 2000 rows of data) into JSP page. I am using JSTL tags and running on Tomcat 5.
    It is taking almost 20 to 25 seconds to load the entire page.
    Is it the optimal time to load or it could be improved?
    Please let me know.
    Thanks,
    --Subbu.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Evnafets,
    Thank you for the response.
    Here are the tasks I am doing to display the data on JSP.
    0. We are running on Tomcat 5 and the memory size is 1024MB (1GB).
    1. Getting the data - I am not performing any database queries. The data is stored in the static cache memory. So the server side response is so quick - less than a milli second.
    2. Using Java beans to pass data to the presentation layer (JSP).
    3. 10 'if' conditions and 2 'for' loops and 2 'choose' statements are being used in the JSP page while displaying the data.
    4. Along with the above, there are 4 javascript files are being used.
    5. The jsp file size after rendering the data, is aprox. 160 kb
    Hope this information helps you to understand the problem.
    Thanks,
    --Subbu.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Dropdown values are missing while using the function module KCD_EXCEL_OLE_TO_INT_CONVERT

    Hi all,
    when i am trying to upload the excel template by using the function module " KCD_EXCEL_OLE_TO_INT_CONVERT" to an internal table some field values are missing.
    i am using the function module " KCD_EXCEL_OLE_TO_INT_CONVERT"  and i am uploading an excel template and downloading that excel data into an internal table but some field values are missing while uploading the excel template and i found that the field which contains the drop down list values those values are missing.
    And also when i am uploading the excel template by using the function module" KCD_EXCEL_OLE_TO_INT_CONVERT"  when i am coming out of this function module one pop up is coming. how can i avoid this popup, can any one please provide me the solution thanks in advance.
    FYI...it is showing the below popup screen ..
    Thanks,
    Koushik

    hi Feiyun,
    below is the code(highlighted in bold)and after coming out of the function module i am getting popup and also the drop down values are missing.
    DATA: ls_control         TYPE zsfi_fiupload_control,
             ls_header          TYPE zsfi_fiupload_header_v13,
             ls_item            TYPE zsfi_fiupload_item_v13,
             ls_trailer         TYPE zsfi_fiupload_control,
             l_line_count       LIKE zsfi_fiupload_control-rec_count,
             l_current_curr     TYPE kcde_cells-value,
             l_current_postdate TYPE kcde_cells-value,
             l_current_compcode TYPE kcde_cells-value,
             l_currentrow       TYPE kcde_cells-row,
             l_filename         LIKE rlgrap-filename.
       DATA: BEGIN OF lt_intern OCCURS 0.
               INCLUDE STRUCTURE  kcde_cells.
       DATA: END OF lt_intern.
       DATA: BEGIN OF lt_items OCCURS 0,
               a TYPE kcde_cells-value,
               b TYPE kcde_cells-value,
               c TYPE kcde_cells-value,
               d TYPE kcde_cells-value,
               e TYPE kcde_cells-value,
               f TYPE kcde_cells-value,
               g TYPE kcde_cells-value,
               h TYPE kcde_cells-value,
               i TYPE kcde_cells-value,
               j TYPE kcde_cells-value,
               k TYPE kcde_cells-value,
               l TYPE kcde_cells-value,
               m TYPE kcde_cells-value,
               n TYPE kcde_cells-value,
               o TYPE kcde_cells-value,
               p TYPE kcde_cells-value,
               q TYPE kcde_cells-value,
               r TYPE kcde_cells-value,
               s TYPE kcde_cells-value,
               t TYPE kcde_cells-value,
               u TYPE kcde_cells-value,
               v TYPE kcde_cells-value,
               w TYPE kcde_cells-value,
               x TYPE kcde_cells-value,
               y TYPE kcde_cells-value,
               z TYPE kcde_cells-value,
               aa TYPE kcde_cells-value,
               ab TYPE kcde_cells-value,
               ac TYPE kcde_cells-value,
               ad TYPE kcde_cells-value,
               ae TYPE kcde_cells-value,
               af TYPE kcde_cells-value,
               ag TYPE kcde_cells-value,
               ah TYPE kcde_cells-value,
               ai TYPE kcde_cells-value,
               AJ TYPE KCDE_CELLS-VALUE,
               AK TYPE KCDE_CELLS-VALUE,
               END OF lt_items.
       l_filename = p_flpath.
    * the file must be an xls file, not xlsx or comma seperated
       IF p_flpath NS '.xls' AND p_flpath NS '.XLS'.
         MESSAGE i261(zfi).
         g_error = 'X'.
         EXIT.
       ENDIF.
    * upload excel file to a generic table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = l_filename
           i_begin_col             = 1
           i_begin_row             = 1
           i_end_col               = 150
           i_end_row               = 65000
         TABLES
           intern                  = lt_intern
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    * validate that the format is in the restatement format
    *  this is the only template to have the ledger group in cell G-2
    **  READ TABLE lt_intern WITH KEY row = '0002' col = '0007'.
    **  IF sy-subrc <> 0 OR lt_intern-value IS INITIAL.
    **    MESSAGE i260(zfi).
    **    g_error = 'X'.
    **    EXIT.
    **  ENDIF.
    * create control record values
       ls_control-rec_type = 'C'.
       ls_control-global_id = 'GLU-03000'.
       ls_control-local_id = ''.
       ls_control-rec_count = ''.
       CONCATENATE sy-datum sy-uzeit INTO ls_control-date.
       ls_control-version = '12'.
       ls_control-email = ''.
       ls_control-eor = 'X'.
       ls_trailer = ls_control.
    * open output file and add the control record
       OPEN DATASET p_unixfilename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
       TRANSFER ls_control TO p_unixfilename.
    * create header record values, will be transfered to file in the item loop
       ls_header-rec_type = 'H'.
       READ TABLE lt_intern WITH KEY row = '0017' col = '0003'.
       IF sy-subrc = 0.
         ls_header-header_txt = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH key row = '0020' col = '0002'.
       IF sy-subrc = 0.
         ls_header-comp_code = lt_intern-value.
       ENDIF.
    ************doc date
       READ TABLE lt_intern WITH KEY row = '0011' col = '0003'.
       IF sy-subrc = 0.
         ls_header-pstng_date = lt_intern-value.
       ENDIF.
    ************posting date
         ls_header-doc_date = sy-datum.
       READ TABLE lt_intern WITH KEY row = '0009' col = '0003'.
       IF sy-subrc = 0.
         ls_header-doc_type = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH KEY row = '0014' col = '0003'.
       IF sy-subrc = 0.
         ls_header-ref_doc_no = lt_intern-value.
       ENDIF.
    ************currency moved to line items
         READ TABLE lt_intern WITH KEY row = '0020' col = '0001'.
       IF sy-subrc = 0.
       ls_header-currency = lt_intern-value.
       ENDIF.
       ls_header-trans_date = ''.
       READ TABLE lt_intern WITH KEY row = '0010' col = '0003'.
       IF sy-subrc = 0.
         ls_header-period = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH KEY row = '0006' col = '0003'.
       IF sy-subrc = 0.
         ls_header-reason_rev = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH KEY row = '0007' col = '0003'.
       IF sy-subrc = 0.
         ls_header-rev_date = lt_intern-value.
       ENDIF.
    *  READ TABLE lt_intern WITH KEY row = '0002' col = '0007'.
    *  IF sy-subrc = 0.
         ls_header-ledger_grp = ''.
    *  ENDIF.
    *  READ TABLE lt_intern WITH KEY row = '0013' col = '0013'.
    *  IF sy-subrc = 0.
         ls_header-exch_rate = ''.
    *  ENDIF.
       READ TABLE lt_intern WITH KEY row = '0008' col = '0003'.
       IF sy-subrc = 0.
         ls_header-calc_tax = lt_intern-value.
       ENDIF.
       ls_header-eor = 'X'.
    * loop at the line items and append them to a table with multiple columns
       LOOP AT lt_intern WHERE row GE 20.
         IF l_currentrow <> lt_intern-row AND l_currentrow IS NOT INITIAL.
           APPEND lt_items.
           CLEAR lt_items.
         ENDIF.
         l_currentrow = lt_intern-row.
         CASE lt_intern-col.
           WHEN '0001'. lt_items-a = lt_intern-value.
           WHEN '0002'. lt_items-b = lt_intern-value.
           WHEN '0003'. lt_items-c = lt_intern-value.
           WHEN '0004'. lt_items-d = lt_intern-value.
           WHEN '0005'. lt_items-e = lt_intern-value.
           WHEN '0006'. lt_items-f = lt_intern-value.
           WHEN '0007'. lt_items-g = lt_intern-value.
           WHEN '0008'. lt_items-h = lt_intern-value.
           WHEN '0009'. lt_items-i = lt_intern-value.
           WHEN '0010'. lt_items-j = lt_intern-value.
           WHEN '0011'. lt_items-k = lt_intern-value.
           WHEN '0012'. lt_items-l = lt_intern-value.
           WHEN '0013'. lt_items-m = lt_intern-value.
           WHEN '0014'. lt_items-n = lt_intern-value.
           WHEN '0015'. lt_items-o = lt_intern-value.
           WHEN '0016'. lt_items-p = lt_intern-value.
           WHEN '0017'. lt_items-q = lt_intern-value.
           WHEN '0018'. lt_items-r = lt_intern-value.
           WHEN '0019'. lt_items-s = lt_intern-value.
           WHEN '0020'. lt_items-t = lt_intern-value.
           WHEN '0021'. lt_items-u = lt_intern-value.
           WHEN '0022'. lt_items-v = lt_intern-value.
           WHEN '0023'. lt_items-w = lt_intern-value.
           WHEN '0024'. lt_items-x = lt_intern-value.
           WHEN '0025'. lt_items-y = lt_intern-value.
           WHEN '0026'. lt_items-z = lt_intern-value.
           WHEN '0027'. lt_items-aa = lt_intern-value.
           WHEN '0028'. lt_items-ab = lt_intern-value.
           WHEN '0029'. lt_items-ac = lt_intern-value.
           WHEN '0030'. lt_items-ad = lt_intern-value.
           WHEN '0031'. lt_items-ae = lt_intern-value.
           WHEN '0032'. lt_items-af = lt_intern-value.
           WHEN '0033'. lt_items-ag = lt_intern-value.
           WHEN '0034'. lt_items-ah = lt_intern-value.
           WHEN '0035'. lt_items-ai = lt_intern-value.
           when '0036'. lt_items-aj = lt_intern-value.
           when '0037'. lt_items-ak = lt_intern-value.
         ENDCASE.
       ENDLOOP.
       APPEND lt_items.
    * sort rows by the post date, comp code, curr.
    *  SORT lt_items BY ah a ai.
    * loop at the items, creating a header record if the comp code, curr. or post date changes
       LOOP AT lt_items.
         ls_item-rec_type = 'I'.
         ls_item-post_key = lt_items-c.   "lt_items-b.
         IF lt_items-c GE '20' AND lt_items-c LE '39'.
           ls_item-vendor_no = lt_items-d.
         ELSEIF lt_items-c GE '0' AND lt_items-c LE '19'.
           ls_item-customer = lt_items-d.
         ELSEIF lt_items-c EQ '70' AND lt_items-c EQ '75'.
           ls_item-asset = lt_items-d.
         ELSE.
           ls_item-gl_account = lt_items-d.
         ENDIF.
         ls_item-asset_type = lt_items-m. "lt_items-l.
         ls_item-trans_type = lt_items-n. "lt_items-m.
         ls_item-print_flag = ''.
         ls_item-item_text = lt_items-j. "lt_items-i.
         ls_item-comp_code = lt_items-b. "lt_items-a.
         ls_item-bus_area = ''.
         ls_item-alloc_nmbr = lt_items-l. "lt_items-k.
         ls_item-tax_code = lt_items-q. "lt_items-p.
         ls_item-taxjurcode = lt_items-r. "lt_items-q.
         ls_item-profit_ctr = lt_items-g. "lt_items-f.
         ls_item-costcenter = lt_items-h. "lt_items-g.
         ls_item-orderid = lt_items-ac. "lt_items-ab.
         ls_item-wbs = lt_items-i. "lt_items-h.
         ls_item-trade_id = lt_items-o. "lt_items-n.
         ls_item-part_prctr = lt_items-p. "lt_items-o.
         ls_item-material = lt_items-t. "lt_items-s.
         ls_item-salesorg = lt_items-aa. "lt_items-z.
         ls_item-distr_chan = lt_items-ab. "lt_items-aa.
         ls_item-pmnttrms = ''.
         ls_item-pmtmthd = ''.
         ls_item-pmtmthsupl = ''.
         ls_item-alt_payee = ''.
         REPLACE ALL OCCURRENCES OF '(' IN lt_items-e WITH ''.
         REPLACE ALL OCCURRENCES OF ')' IN lt_items-e WITH ''.
         ls_item-amt_doccur = lt_items-e. "lt_items-d
         REPLACE ALL OCCURRENCES OF '(' IN lt_items-f WITH ''.
         REPLACE ALL OCCURRENCES OF ')' IN lt_items-f WITH ''.
         ls_item-loc_amt = lt_items-f. "lt_items-e
         ls_item-loc  = lt_items-k. "lt_items-j.
         ls_item-sas_revtype = lt_items-s. "lt_items-r.
         ls_item-rev_type = lt_items-u. "lt_items-t.
         ls_item-rev_chnl = lt_items-v. "lt_items-u.
         ls_item-bill_to = lt_items-x. "lt_items-w.
         ls_item-payer = lt_items-z. "lt_items-y.
         ls_item-ship_to = lt_items-y.
         ls_item-tax_amnt = lt_items-x.
         ls_item-func_area = ''.
         ls_item-expend_date = lt_items-ae. "lt_items-ad.
         ls_item-wtax_code = lt_items-af. "lt_items-ae.
         ls_item-wtax_base = lt_items-ag. "lt_items-af.
         ls_item-wtax_amount = lt_items-ah. "lt_items-ag.
         ls_item-payment_block = ''.
         ls_item-grp_amt = ''.
         ls_item-anc_amt = ''.
         ls_item-permit_payee = ''.
         ls_item-value_date = ''.
         ls_item-pernr   = ''.
         ls_item-legacy1 = ''.
         ls_item-legacy2 = ''.
         ls_item-legacy3 = ''.
         ls_item-legacy4 = ''.
         ls_item-legacy5 = ''.
         ls_item-legacy6 = ''.
         ls_item-legacy7 = ''.
         ls_item-legacy8 = ''.
         ls_item-legacy9 = ''.
         ls_item-legacy10 = ''.
         ls_item-eor = 'X'.
         TRANSLATE lt_items-ai TO UPPER CASE.
         TRANSLATE lt_items-b TO UPPER CASE.
         TRANSLATE lt_items-a TO UPPER CASE.
         TRANSLATE lt_items-aj TO UPPER CASE.
         IF l_current_curr <> lt_items-a "lt_items-ai
           OR l_current_postdate <> ls_header-pstng_date "lt_items-aj
           OR l_current_compcode <> lt_items-b.
           l_current_curr = lt_items-a.
           l_current_postdate = ls_header-pstng_date. "lt_items-aj.
           l_current_compcode = lt_items-b.
           ls_header-comp_code = l_current_compcode.
           ls_header-currency = l_current_curr.
           ls_header-pstng_date = l_current_postdate.
           ls_header-doc_date = l_current_postdate.
           TRANSFER ls_header TO p_unixfilename.
           l_line_count = l_line_count + 1.
         ENDIF.
         TRANSFER ls_item TO p_unixfilename.
         l_line_count = l_line_count + 1.
       ENDLOOP.
       ls_trailer-rec_type = 'T'.
       ls_trailer-rec_count = l_line_count.
       TRANSFER ls_trailer TO p_unixfilename.
       CLOSE DATASET p_unixfilename.
    * change the format to fixed format for the remainder of the load program
       p_fixed = 'X'.
       p_rstmnt = ''.
    Thanks,
    Koushik

  • Deploying against a JSP site using JSTL

    I am reviewing Contribute for use at my company. Our current
    corp site is deployed in JSP and makes extensive use of the Java
    Standard Tag Library, especially for writing dynamic URLs to
    content such as images, pdf, and application download.
    Can Contribute and/or my site be configured in such a way
    that contributors can edit the JSP pages? I've exploded the war and
    deployed it as a set of standard files so Contribute can access the
    files, but Contirbute doesn't resolve the JSTL references.
    Help!

    contribute was designed to allow editting of static HTML
    content only.. It does not have the capability to edit anything
    dynamic.. It would be better to use Dreamweaver..

  • Calling a method that returns values in a map - using JSTL

    Hi I have a method within an object that returns a List for a particular category
    public List<String> getFieldsInCategory(String categoryName){
        return _categoryFieldsMap.get(categoryName); //This is a map that returns a list                                                             
      }Trying to call the above function in jsp, the object is available as "document",
    how do i pass a key to the above function to return a List.
       <c:forEach items="${document.fieldsInCategory('ABSTRACT')}" var="temp">How do i get the list by passing a string key to my method,
    please let me know how to go about this.
    Thanks

    JSTL can not directly call methods that take parameters.
    All it can do is access javabean properties - ie via the revealed get/set methods.
    You can fudge it by having a seperate variable to set:
    Map  _categoryFieldsMap;
    String category = null;
    public void setCategory(String category){
      this.category = category;
    public String getCategory(String category){
      return category;
    public List<String> getFieldsInCategory(){
        return _categoryFieldsMap.get(categoryName); //This is a map that returns a list                          
      }You would then do it like this in your JSP:
    <c:set target="document.category" value="ABSTRACT"/>
    <c:forEach items="${document.fieldsInCategory}" var="temp">
    ...The other alternative is to return the entire map to the page.
    EL accesses maps quite handily.
    so given a method that returns the map:
    public Map getCategoryFieldsMap(){
    return _categoryFieldsMap;
    then the expression: ${document.categoryFieldsMap.ABSTRACT} returns what you are after.
    Hope this helps,
    evnafets

  • How to restrict  redundant value in report while using left outer urgent

    Hi frineds
          i am developing pp report,
    i am using the select query,
      the output instead of one i ,got two for every one
    ex reason badm-- onlyone
    but igives badm
                    badm
      SELECT FMATNR FAUFNR FPSMNG GXMNGA GPERNR GBUDAT GGRUND GVORNR  GAUFPL  GIEDD H~GRDTX INTO CORRESPONDING FIELDS OF TABLE IT_AFPO_IDEL
             FROM AFPO AS F
             INNER JOIN AFRU AS G ON FAUFNR = GAUFNR
            INNER JOIN TRUGT AS H ON GGRUND = HGRUND
             LEFT OUTER  JOIN TRUGT AS H ON GGRUND = HGRUND
             WHERE F~MATNR IN S_MATNR AND
                   F~AUFNR IN S_AUFNR   AND
                  G~ISDD IN S_ISDD AND
                   G~IEDD IN S_IEDD AND
                   G~WERKS IN S_WERKS AND
                   G~XMNGA <> 0 .
    how can i restrict ,give me solution ,very urgent
    Thanks in advance
    Regards
    ds

    Hi Chandran,
                I got that Idea too. I created a authorized customer, I created a authorized Object and assigned to a role.But in the role, when I am changing the object to generate profile, it is asking to select list of customers from the customer table.If the customers are always constant then this would work,  but in my scenario, customers for the sales rep changes over time and when I ever reps open the query, they should see updated list of customers assigned to them only, as we update the master data everyday from source system and that shud reflect in the value help.
    I am trying User Exit to achieve this, but I am not getting proper ideas how to do this.
    Any Help on this issue with user exit code???
    Thanks in Advance
    regards,
    PNK

  • Drop down values are missing while using the function module KCD_EXCEL_OLE_TO_INT_CONVERT

    Hi all,
    I am using the function module "KCD_EXCEL_OLE_TO_INT_CONVERT"  to upload the excel template to an internal table but i am not getting the complete excel data into the table the fields which contains the drop down list values those values are not coming in to the table.
    Is there any other function module which can read even the drop down list values? can any one please provide me the solution.
    Thanks in advance
    ** FYI...i am using the below code:
    * upload excel file to a generic table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = l_filename
           i_begin_col             = 1
           i_begin_row             = 1
           i_end_col               = 150
           i_end_row               = 65000
         TABLES
           intern                  = lt_intern
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    Thanks,
    Koushik

    Hi all,
    I am using the function module "KCD_EXCEL_OLE_TO_INT_CONVERT"  to upload the excel template to an internal table but i am not getting the complete excel data into the table the fields which contains the drop down list values those values are not coming in to the table.
    Is there any other function module which can read even the drop down list values? can any one please provide me the solution.
    Thanks in advance
    ** FYI...i am using the below code:
    * upload excel file to a generic table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = l_filename
           i_begin_col             = 1
           i_begin_row             = 1
           i_end_col               = 150
           i_end_row               = 65000
         TABLES
           intern                  = lt_intern
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    Thanks,
    Koushik

  • Cannot debug my jsp while using jbuilderx na dtomcat4.0????

    HI!
    I am using jbuilderx and tomcat4.0 (of jbuilderx) in my web application i can successfully run a page from jbuilder but when i try to debug it it doesn't stop at the breakpoints i speify ..... I cannnot understand why i am not able to debug my page
    please help me in that regard....

    Never mind, found a way...

  • Print GregorianCalendar using JSTL

    I have a GregorianCalendar property (for example exchange.rateDate) and I want to print it in a jsp page using jstl tags.
    How can I solve this problem?
    liviu

    If the object you are trying to print is a GregorianCalendar, then you need to get the time property of the Calendar, which returns a Date object; the formatDate tag cannot handle a "raw" GregorianCalendar.
    Using the previous example, it should be:
    <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <fmt:formatDate value="${exchange.rateDate.time}" type="date" dateStyle="SHORT"/>
    <fmt:formatDate value="${exchange.rateDate.time}" type="date" pattern="dd/MM/yyyy"/>

  • Error while using Enumeration and Vectors

    Hi all,
    I am new bee in java i am using enumeration and vectors in my JSP page,
    i want to get the values from JSP page using enumeration and store then in Vector, below is the code, its giving errors saying ArrayIndexoutofException
    pls help, thanx in advance.
              while ( enum.hasMoreElements() )
              String enumString = (String)enum.nextElement();
              String[] enumValue =request.getParameterValues(enumString);
              for(int n=0;n<=enumValue.length;n++)
              tempbean.dbRows.add(enumValue[n]);     //tempbean.dbRows is a vector,
    if I seperate the For block out of While loop then im getting cannot resolve enum variable, bcoz its declared in while loop, I cannot declare it out side of while loop because I dont know the perfect size of the array and it will change dynamically.
    pls help

    Thankyou ,
    It worked out,
    Thank you very much.

  • Exception When trying to Format XML using JSTL

    Hi all
    I m trying to display content of XML in a .jsp page using JSTL ,
    When i try to dispaly the content it is thowing an exception :
    org/saxpath/SAXPathException
    Can any one please help ....
    i m using jstl1.0.6.jar and standard-1.0.6.jar
    Code Snppet Used:
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    <c:set var="someXML">
    <name>Sri</name>
    </c:set>
    <x:parse var="parsedDocument" xml="${someXML}" />
    <x:out select="$parsedDocument/name" />
    Thanks in Advance

    Thank for reply
    I had even tried with this code:
    <c:set var="someXML">
         <person>
              <name>Joe</name>
              <age>30</age>
         </person>
    </c:set>
    <x:parse varDom="parsedDocument" xml="${someXML}" />
         <x:set var="name" select="$parsedDocument/person/name" />
         <c:out value="${name}" />
    even then i m getting the same exception:
    Message: org/saxpath/SAXPathException

  • How to populate a form based on values in a database with JSTL?

    I know how to write Java code to connect to a database, but where exactly (and how) in my JSP page , using JSTL tags will I actually call the function that connects to the database?
    Should the code to connect and populate the Java Bean fields go into the JavaBean constructor or anther method ( but from what I understand I can't really call the Java Bean's methods through JSTL - unless I did it througha scriplet)

    I know how to write Java code to connect to a
    database, but where exactly (and how) in my JSP page
    , using JSTL tags will I actually call the function
    that connects to the database?You won't. The point of writing JSPs with JSTL is to realize that the purpose of JSP is to produce HTML, and not to do extraneous things like accessing databases. You would write a servlet that connects to the database, extracts the data, and puts it somewhere the JSTL can find it. (Most likely in a List object in request scope.)
    Then the servlet forwards to a JSP, where you use JSTL simply to scan through that List and convert the objects in it into HTML.

  • How can i display the values in the vector in a jsp using jstl

    in a task i am recieving a vector in a jsp... how can i display those vector values in the jsp using jstl.... plz help me
    thanks in advance

    <%
    here you got vector say; v
    pagecontext.setAttribute("varname",v);
    %>
    <c:forEach var="i" items="${varname}">
    <c:out value="${i}">
    </c:forEach>

  • Problem while parsing xmlString in jsp using JSTL

    HI, I am not able to display data in jsp page that I have stored in string variable in XML form.
    I want to print xmlString data in jsp using jstl.
    probably i might have to parse it but i don't have idea . Can any one help me PLZ??

    I managed the code but getting following error
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Content is not allowed in prolog.
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: javax.servlet.jsp.JspException: Content is not allowed in prolog.
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.xml.test_jsp._jspService(test_jsp.java:106)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
         com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSource(ParseSupport.java:227)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseInputSourceWithFilter(ParseSupport.java:193)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseReaderWithFilter(ParseSupport.java:199)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.parseStringWithFilter(ParseSupport.java:206)
         org.apache.taglibs.standard.tag.common.xml.ParseSupport.doEndTag(ParseSupport.java:138)
         org.apache.jsp.xml.test_jsp._jspx_meth_x_parse_0(test_jsp.java:168)
         org.apache.jsp.xml.test_jsp._jspService(test_jsp.java:82)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

  • Send Vector class to JSP and print this Vector using JSTL

    Hello All!
    I need your help to solve my question.
    I developed a Servlet + jsp application.
    I tested it in local with Apache Tomcat/6.0.20 and it works correctly.
    I write and use these classes:
    class for execute query, and including data page:
    package MySQL;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.util.*;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    * @author initmax
    public class MySQLQuery {
        private Connection CurrentConnect; //obj for connect to databae
        private Vector VectorPageObj = new Vector(); //save array object page, after execute query
    public MySQLQuery() {}
    //constructor accept current conection database
    public MySQLQuery(Connection CurrentConnectBase)
        CurrentConnect = CurrentConnectBase;
    //method accept name table and return all info on this table
    public void SelectAllField(String NameTable)
           try
             Statement st = CurrentConnect.createStatement();
             String query = ("select * from "+NameTable);
             ResultSet resultQuery = null;
             resultQuery = st.executeQuery(query);
    //step in cycle after execution query, and create Vector object
               while (resultQuery.next())
                  GenPageMySQL PageObj = new GenPageMySQL();
                  PageObj.setId(resultQuery.getInt("id"));
                  PageObj.setTheme(resultQuery.getString("theme"));
                  PageObj.setPage(resultQuery.getString("page"));
                  VectorPageObj.add(PageObj); //add obj in tail vector
           catch (SQLException e) {
             e.printStackTrace();
        *@set the CurrentConnect
        public void setConnection(Connection CurrentConnectBase) {
             CurrentConnect = CurrentConnectBase;
        *@get Vector object "Vector created after execute query"
         public Vector getVectorPageObj(Connection CurrentConnectBase) {
             return VectorPageObj;
    }start Servlet class:
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import MySQL.*;
    public class indexServlet extends HttpServlet {
        private  String getpage;
        //Connected MySQL
        private MySQLConnect MySQLConnectObj = new MySQLConnect();
        private MySQLQuery MySQLQueryObj = new MySQLQuery();
        public void init(){
              MySQLConnectObj.DownloadDriver();
              MySQLConnectObj.Connected();
              //Use current connection, for execution query
              MySQLQueryObj.setConnection(MySQLConnectObj.GetConnection());
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException, NullPointerException  {
      //      init();
            PrintWriter out = response.getWriter();
    //GET case useer
          getpage = request.getParameter("page");
          out.print("MySQLConnectObj.GetConnection() = "+MySQLConnectObj.GetConnection()); 
    //Check curent connect to database
          if(MySQLConnectObj.GetConnection() != null)
               MySQLQueryObj.SelectAllField("up_menu");//execution query
               MySQLConnectObj.DisConnected();
                request.setAttribute("up_menu_theme",MySQLQueryObj.getVectorPageObj(null));
                RequestDispatcher Dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/jsp/index.jsp");
                Dispatcher.forward(request, response);
          else if(MySQLConnectObj.GetConnection() == null){
                init() ;
            out.print("MySQLConnectObj.GetConnection() = "+MySQLConnectObj.GetConnection());
    //        MySQLConnectObj.DisConnected();
    }I forward Vector "MySQLQueryObj.getVectorPageObj(null)" to JSP, how I can print data vector using JSTL?

    your right, I learn Java however this very Interesting!
    I change code, change Vector on List
    class MySQLQyery:
    package MySQL;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.util.*;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    * @author initmax
    public class MySQLQuery {
        private Connection CurrentConnect; //obj for connect to databae
    public MySQLQuery() {}
    //constructor accept current conection database
    public MySQLQuery(Connection CurrentConnectBase) {
        CurrentConnect = CurrentConnectBase;
    //method accept name table and link on List, after work return all info on this table inside List
    public List<GenPageMySQL> selectAllField(String NameTable, List<GenPageMySQL> ListPageObj) {
           try {
             Statement st = CurrentConnect.createStatement();
             String query = ("select * from "+NameTable);
             ResultSet resultQuery = null;
             resultQuery = st.executeQuery(query);
    //step in cycle after execution query, and create Vector object
               while (resultQuery.next()) {
                  GenPageMySQL PageObj = new GenPageMySQL();
                  PageObj.setId(resultQuery.getInt("id"));
                  PageObj.setTheme(resultQuery.getString("theme"));
                  PageObj.setPage(resultQuery.getString("page"));
                  ListPageObj.add(PageObj); //add obj in tail vector
           catch (SQLException e) {
             e.printStackTrace();
           return ListPageObj;
        *@set the CurrentConnect
        public void setConnection(Connection CurrentConnectBase) {
             CurrentConnect = CurrentConnectBase;
      List<GenPageMySQL> ListPageObj;
                //get List<RowObject>
                ListPageObj = MySQLQueryObj.getListPageObj();
      out.print("Size Page objects = "+ListPageObj.size());
                request.setAttribute("upMenu",ListPageObj);
                RequestDispatcher Dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/jsp/index.jsp");
                Dispatcher.forward(request, response);string out.print("Size Page objects = "+ListPageObj.size()); == worked, I get count objects correct
    How I can output fields Object GenPageMySQL in JSTL?
    writing so:
             <c:out value="hello, Max" />
             <c:out value="${10+20/2}" />
             <c:forEach items="${upMenu}" var="Object" >     
                   <c:out value="${Object.getId}"> </c:out>
             </c:forEach>
        </body>
    </html>but get error:
    org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/index.jsp at line 36
    33:          <c:forEach items="${upMenu}" var="Object" >
    34:         
    35:                 
    36:                <c:out value="${Object.getId}"> </c:out>
    37:
    38:    
    39:          </c:forEach>
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         indexServlet.doGet(indexServlet.java:49)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)How I can in output print fields my Object?
    Thank you for your help.

Maybe you are looking for

  • HT1444 As an obvious novice I want to know how to upgrade my mac mini OSx 10.4 to a newer system can anyone help?

    As obvious novice I want to know how to upgrade my mac mini 10.4 OS X to a more uptodate system

  • Z10 DELETE AND AUTO CORRECT PROB AS WELL AS LETTER A and L

    Was having real probs with the delete ket wiping out everything I had written.  Read in hear somewhere to turn off the magnification settings.  Did it and it seemed to help quite nicely. Before I turned off the magnification setting I was also having

  • Setting up Airport Time Capsule

    We will soon set up a Time Capsule and new iMac.  Is there a preference to whether the iMac should be hardwired through the LAN Input, or connected wirelessly? Thanks. Edward

  • DVCPRO HD and Quicktime 7.4

    Hello, I have a Quicktime file encoded with DVCPRO HD codec. I tried to view it with Quicktime but it could only play the audio but couldn't show the video. I don't have FCP installed on this machine. Does it mean I can't watch any file with DVCPRO H

  • Query on selection screen

    Hi all, Please give me the solutions to the following in selection screen: 1. In selection-screen there is one select-options and one parameter. Now,if the select-opotions range is given 30 to 40 then, the parameter should be populated with 'A'. If t