JSP and JavaScript! How to put session values into html form?

I have a master form which goes to detail form to input data and back to master to Confirm submit operation. I want to put all the form data into request or session variable so it can be retrieved in both the forms. In master form i want to use it in the following way:
MasterForm-onLoad(){
check for form data Object in the session/request
if the data exists
populate the form fields (by getter methods of form data object)
Show the input from detail form
otherwise
show empty form
Now the problem is that it throws null pointer exception if the form data does not exist and i try to access it within an IF statement.
I beleive this is coz the JSP code will be executed on the server before the html page is loaded. Can any one please tell me how to solve this problem.
Thanks and Best Regards
Gul

thats exactly what i m doing but the session variable is not a simple variable or objct, its a serializable object with getters and setters which i will call to retrieve its values. its like this
FormBean formData=(FormBean) session.getAttribute("formData");
now in javaScript i will have to check if the formData is null and than perform the getters or setters.
<script>
function getValues(){
if("<%formData%>"!="null"){
form1.SID.value="<%=formData.getIDVal()%>"
</script>
thats what i was trying to do but the problem is all jsp code will be executed before the page is loaded so it will try to execute inside of the if statement even when the object is null so NullPointerException.
The only way i have got it working so far is to retrieve all the values in the JSP scriptlet, and than use the individual variables as u also mentioned.... SO Far i havnt been successful in calling getter methods in JavaScript. you think it can be done?
Thanks for the reply
GUL

Similar Messages

  • How to put Variable value into Labeltext of a subcomponent WIB

    Hello
    In our Web Based Planning tool we uses Tabstrib_control component and the Label-Text is filled like 'Plan 2008'. (Our BPS = 3.5 and Web interface builder)
    I am looking for a way,how to put a variable into the Label field of the component.  I am not sure if there is a possibility to enhance the labelfield with variable values.
    Thanks a lof for any good idea.
    Best regards
    Christian
    Our BPS = 3.5 and Web interface builder

    Hello Christian,
    Maybe I have a solution for your problem.
    1. Create subcomponent "Selector variable" with your variable.
    2. Hide this new subcomponent
    3. Write in the Label-Text: <%=descr("Name of new subcomponent"/value)%>
    If the variable will be selected by the user in the web interface, put the name of this selector in the field "Update upon Change of" in the properties of the new created subcomponent.
    Hope this helps.
    Friedrich

  • How to put a value into the Gauge object

    Hi Experts
    I would like to use the DS_1.getData() command to retrieve data from a query
    and place it into a gauge (standard object in DS). What I understand is that
    the getData command retrieves a float value and the gauge object expects an integer
    value. I didn’t find a float to integer conversion so I tried a work around. It
    looked something like this but it did not work:
    GAUGE_1.setValue(Convert.stringToInt(Convert.floatToString(DS_1.getData("CKXYNLFBDHH0X2U91711DX83S",
    {"ZQMSITEPD":'S999'}).value)));
    The value from the float to string conversion holds the decimals like 49,937 and this creates an error in the conversion from
    string to int.
    Does anyone have an example on how to get data from a DS into a gauge?
    Kind regards
    Erik

    HI Erik, have you tried to use the Convert object?
    float can be converted to string with argument "###", this will round all numbers after colon.
    eg.
    var fullNumber = Convert.floatToString(55.83, "###");
    var numberInt = Convert.stringToInt(fullNumber);
    APPLICATION.createInfoMessage("Value " + numberInt);
    fullNumber = Convert.floatToString(55.23, "###");
    numberInt = Convert.stringToInt(fullNumber);
    APPLICATION.createInfoMessage("Value " + numberInt);
    see for many examples
    Design Studio 1.3 Scripting Example to Convert String Number to Date
    Regards, Karol

  • To allow me put a value into field without coming out the tcode.

    Hi Friends,
    My requirement is when a value is entered into a field leaving the other field empty should display a error  message
    I'm making use of the below statement to display the error message
    message S000(01) display like 'E' raising error_with_message.
    But the thing is ,when trying to save it after entering value into a field leaving the other empty, its displaying the error message which i have maintianed.till here its well and good.But from here I can only come out of the tcode without allowing me to enter the value into the other field.
    want a message to be displayed on the status bar and allow me to put the value into the remaining field
    without coming out from the screen..
    Please help..

    Hi laxman,
    Are you saying like this..
    message S000(01) dispaly like 's' raising error_with_message.
          set screen 100.
          leave screen.
    The Req is "If I enter a value in field leaving the other field empty in tcode XXXX..its should display a message that this particular field is mandatory and allow me to put the value into the other field "
    I'm able to display a message when the second field is left empty..
    In the message dialog (where the message gets displayed), exit option is there.so i'm coming out of the tcode.But it should give me message and allow me to put the value in the screen without coming out of it.

  • How to get the values from html:select? tag..?

    i tried with this, but its not working...
    <html:select styleClass="text" name="querydefs" property="shortcut"
                 onchange="retrieveOptions()" styleId="firstBox" indexed="true">
    <html:options collection="advanced.choices" property="shortcut" labelProperty="label" />
    </html:select>
                        <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>

    <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>This java script is not working at all..its not printing anything in document.write();
    This is code..
    <td class="rowcolor1" width="20%">
    <html:select styleClass="text" name="querydefs" property="shortcut"
                             onchange="retrieveSecondOptions()" styleId="firstBox"
                             indexed="true">
                             <html:options collection="advanced.choices" property="shortcut"
                                  labelProperty="label"  />
                        </html:select>i tried with this also. but no use..i'm not the getting the seleced option...
    function retrieveOptions(){
    firstBox = document.getElementById('firstBox');
                             if(firstBox.selectedIndex==0){
          return;
        selectedOption = firstBox.options[firstBox.selectedIndex].value;
    }actually , how to get the values from <html:select> ...?
    my idea is to know which value is selected from the combo box(<html:select> ) if that value is equal some string i have enable a hyperlink to open a popup window

  • How to put my podcasts into playlist folders? Can't drag'em.

    How to put my podcasts into playlist folders? Can't drag'em.
    I've subscribed to a number of podcasts & they appear in my iTunes window under the Podcasts section.
    There i have
    2 problems:
    1st: I can't rearrange or group them so can listen consecutively to different topics.
    I must listen to one, then come to the keyboard and select the next to start playing. Now, I know that I can get them to play consecutively once I've placed them into Playlist folders,
    but that brings me to my second problem:
    2) I can't drag and drop them into separate iTunes FOLDERS (by topics).
    (Though I have been able to drag&drop separate items from my 'Music' section into iTunes playlist folders.)
    But can't drag from Podcasts section into Playlists,
    as everytime I try they just refuse to go in and scurry back to their starting position under Podcasts.
    Zupwidiss? This can't be.
    I would be grateful for your solution.
    And also grateful if I could have easily found the solution explained
    before I had to resort to bothering this forum with this question.
    Just using my MacMini, Snow Lep.

    Thanks very much.
    You have reminded of the
    difference between
    Playlists and Playlist Folders:
    One can only drag things from the Master list into PLAYLISTS.
    And can only drag Playlists into Playlist Folders.
    I'm an older man, and easily confused by these things.
    Many thanks to my friend in Germany.
    P.S. Your English is excellent.

  • How to put measures correctly into spreadsheet

    Hi expert,
         I loaded data into a planning model, and I can see data in BW and BEX, but when I put 'ACCOUNT' into row, and 'TIME' into column, I can't see 'measures' in spreadsheet, eventhough I drag 'measures' into spreadsheet from EPM pane, then update, getting blank for 'measures', it is gone. please tell me how to put measures correctly into spreadsheet.

    P.S If you are creating report by drag n drop on EPM pan, then same way need to add measure dimension in desired axis.
    Share the screen shot.
    Shrikant

  • How to put 2nd column into 1st column in excel

    Hello,
    I have a question how to put 2nd column into 1st column in excel. Thank you.
    Solved!
    Go to Solution.

    Why the 1 iteration for loops?
    Why the two Index Arrays?  It is just trying to fix the problem created by the For Loops on the original 1-D arrays.
    Both of those things are creating 2-D arrays that are complicating things and can be eliminated.
    You can take your 2 1-D arrays, use Build Array and right click to set "Concatenate Inputs".
    If you do have a 2-D array, you can use Reshape Array to make it a 1 column by N row 2-D array.

  • How to pass src value into img tag in ADF

    Hi,
    My Dev : 11.1.2.3.0
    How to pass row values into <img> tag.,I used the below code but it's taking empty.,
    I tried both ways like #{row.CdFilePath}   and   ${row.CdFilePath}
    <af:iterator var="row"
                      value="#{bindings.xxx.collectionModel}"
                     id="i2">
         <img src='/ShowImage?src=#{row.CdFilePath}' border='0' style="width:100px; height:100px; margin:5px;"/>
    </af:iterator>
    Please tell me any other option is there..
    Thanks

    This works if you use a normal table so I guess it should work here too.
    Are you sure the el #{row.CdFilePath} return something?
    Why don't you use the adf image tag <af:image source="/ShowImage?src=#{row.CdFilePath}".../> instead of the html img tag?
    Should the src property not be enclosed with " instead of your '?
    Timo

  • How to put selected videos into one place (File)

    How to put selected videos into a File so I can only show on TV the videos in that file

    YYou have to describe your issue in more detail. Are you using iTunes? Trying to see it in Apple TV, etc, etc.

  • How to put a dvd into ipod touch

    i have no idea how to put my DVDs into my ipod touch! can someone help? i have the new touch, 3g i think? it's a 32GB. i really don't feel like having to buy the movie on itunes when i already own it as a dvd. can someone please help me?

    Sorry, but the Apple Forum Terms of Use don't permit us to discuss ripping commercial DVDs. Try Googling for such information.

  • How can I embed an DOCTYPE HTML Form from Adobe Forms central into a responsive html5 page?

    How can I embed an DOCTYPE HTML Form from Adobe Forms central into a responsive html5 page?
    -Luis

    Hi,
    You can embed the form on your website, but you need to make sure that javascript has been enabled in the browser. You need to copy the embed code and add it into your HTML code. If you would like FormsCentral to generate embeded HTML form without using javascript, you may post a feature request and vote it. Hope it helps! Thanks!
    Kind regards,
    Shiyao Bao

  • How to convert table content into html format?

    Hi,
    Experts,
    How to convert internal data into HTML format is there any function module or piece of code to download content into HTML.
    Thank u,
    Shabeer Ahmed.

    Then use this code....
    REPORT  ytest_table_html1.
    *        D A T A   D E C L A R A T I O N
    *-HTML Table
    DATA:
      t_html TYPE STANDARD TABLE OF w3html WITH HEADER LINE,
                                           " Html Table
    *- Declare Internal table and Fieldcatalog
      it_flight TYPE STANDARD TABLE OF sflight WITH HEADER LINE,
                                           " Flights Details
      it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
                                           " Fieldcatalog
    *-Variables
    DATA:
      v_lines TYPE i,
      v_field(40).
    *-Fieldsymbols
    FIELD-SYMBOLS: <fs> TYPE ANY.
    *        S T A R T - O F - S E L E C T I O N
    START-OF-SELECTION.
      SELECT *
        FROM sflight
        INTO TABLE it_flight
        UP TO 20 ROWS.
    *        E N D - O F - S E L E C T I O N
    END-OF-SELECTION.
    *-Fill the Column headings and Properties
    * Field catalog is used to populate the Headings and Values of
    * The table cells dynamically
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = it_fcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2.
      DELETE it_fcat WHERE fieldname = 'MANDT'.
      t_html-line = '<html>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<td><h1>Flights Details</h1></td>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<table border = "1">'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
    *-Populate HTML columns from Filedcatalog
      LOOP AT it_fcat.
        CONCATENATE '<th bgcolor = "green" fgcolor = "black">'
            it_fcat-scrtext_l
            '</th>' INTO t_html-line.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      DESCRIBE TABLE it_fcat LINES v_lines.
    *-Populate HTML table from Internal table data
      LOOP AT it_flight.
        t_html-line = '<tr>'.
        APPEND t_html.
        CLEAR t_html.
    *-Populate entire row of HTML table Dynamically
    *-With the Help of Fieldcatalog.
        DO v_lines TIMES.
          READ TABLE it_fcat INDEX sy-index.
          CONCATENATE 'IT_FLIGHT-' it_fcat-fieldname INTO v_field.
          ASSIGN (v_field) TO <fs>.
          t_html-line = '<td>'.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = <fs>.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = '</td>'.
          APPEND t_html.
          CLEAR t_html.
          CLEAR v_field.
          UNASSIGN <fs>.
        ENDDO.
        t_html-line = '</tr>'.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</table>'.
      APPEND t_html.
      CLEAR t_html.
    *-Download  the HTML into frontend
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'C:\Flights.htm'
        TABLES
          data_tab                = t_html
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *-Display the HTML file
      CALL METHOD cl_gui_frontend_services=>execute
        EXPORTING
          document               = 'C:\Flights.htm'
          operation              = 'OPEN'
        EXCEPTIONS
          cntl_error             = 1
          error_no_gui           = 2
          bad_parameter          = 3
          file_not_found         = 4
          path_not_found         = 5
          file_extension_unknown = 6
          error_execute_failed   = 7
          synchronous_failed     = 8
          not_supported_by_gui   = 9
          OTHERS                 = 10.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    none of the above function modules r obsolete...

  • How to access variables across JSP and JavaScript?

    Hi,
    I have some .js files and in those files, some of the methods need to access to the variables that I'd declare in the jsp files. How do I do it?
    Anne

    You can do it this way, but I'm not sure if this is what you had in mind.
    Say you had a java variable called XString. And you wanted to display
    the value of XString in a javascript Alert. Here's how:
    <html>
    <body>
    <% String XString = "Hi There!"; %>
    </body>
    <script language="javascript">
    alert("<%=XString%>");
    </html>Hope This Help,
    P.

  • How to display Session value of an item  using Javascript?

    Hello All,
    I have a file browse item and I browse some file and click on upload, i run this javascript :
    function passBack()
    javascript:doSubmit('UPLOAD');
    alert('hi');
    var var_flag = $x('P91_FILE');
    alert(var_flag.value);
    opener.document.forms["wwv_flow"].f05[3].value = var_flag.value;
    close();
    </script>
    It dispalys 'hi ' as per the first alert.
    For the second alert it shows the file path value . ( C:\test\test1.sql).
    I need the file session value to be displayed here
    Like the following :
    F477093380/test1.sql
    and then I need to pass that value to parent page. and close the child page.
    Any idea?
    Thanks in advance.
    Regards,
    Archana

    Archana,
    I'm not sure about javascript, but u can use a sql query on the "APEX_APPLICATION_FILES" view to obtain that.
    Something like:
    SELECT id,NAME
      FROM APEX_APPLICATION_FILES;

Maybe you are looking for