Pass data to JSP from HTML?

I can pass the data in a HTML form without problem if the form is in the same jsp file. I have no problem to pass data from one jsp file to another one. But when the jsp file has to take the data passed from calling HTML file and has to receive the data from the same jsp file, then the data from other HTML file will be null the first time runing the code, then second time will be passed right. If I shut down computer run the code again, same problem until the second time. Please tell me why if any of you know!

yes. The first part is HTML file which use the form to pass v_progname, the second part is a jsp file, it suppose to get the data in v_prgname, but the first time to run this code always get null, then the second time get the right data?
<html> <head> <title>CTI</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> </head>
<body bgcolor="#FFFFFF"> <form name="theForm" enctype="text/html" method="post"
action="http://titan.ssd.loral.com:7778/ifs/jsp-bin/ifs-cts/jsps/uploadfilehome.jsp">
<table border="1" cellspacing="0" cellpadding="4">
<tr> <td bgcolor="#FFFFEE"><font face="Arial, Helvetica,sans-serif" size="2"> Communication racking Item </font></td> <td colspan="5"><font face="Arial, Helvetica, sans-serif"size="2">SATMEX-6-2 </td>
<input type="hidden" name="v_sidname"value="/expctl/dev//comm_tracking.edit_document">
<input type="hidden" name="v_schema"value="migra2">
<input type="hidden" name="v_cti_number"value="SATMEX-6-2">
<input type="hidden" name="v_progname"value="satmex-8">
<input type="hidden" name="v_doc_id"value="5131"> </tr> </table><br>
<input type="submit" value="Upload Document">     
<input type="reset" value="Reset"></form></body></html>
uploadfilehome.jsp as following:
<html><head>
<%
String v_program=request.getParameter("v_progname");//this is the parameter passed from html file, //with a problem?
WebUILogin login = WebUILogin.getWebUILogin( request );
String step = WebUIUtils.getUTF8Parameter(request,"step");
//String path=WebUIUtils.getUTF8Parameter(request,"path");
String path="/home/scott/satmex-6";
String windowID=WebUIUtils.getNewWindowID();
%>
<SCRIPT LANGUAGE="JavaScript1.2">
var path="<%=path%>";
var jsWindowID="<%=windowID%>";
</script>
<%
if ( null == step )
step = "get";
%>
<SCRIPT LANGUAGE="JavaScript">
function AutoLogin() {
document.loginform.userName.value == "scott";
document.loginform.passWord.value == "tiger";
document.loginform.submit();
function PkeyPress(event)
if (document.layers)
if (event.which==13)
document.loginform.submit();
else {
if (window.event.keyCode==13)
document.loginform.submit();
</SCRIPT>
<%
if ( step.equals("try") )
login.processRequest(request);
%>
<SCRIPT LANGUAGE="JavaScript1.2">
window.location='../jsps/uploadhome.jsp?path='+path+'&windowID='+jsWindowID;
</script>
<%
// check to see if we have already logged in before...
if ( null != login.getSession() )
%>
<SCRIPT LANGUAGE="JavaScript1.2">
window.location='../jsps/uploadhome.jsp?path='+path+'&windowID='+jsWindowID;
</script>
<%
else
%>
<title><%=login.getJspResourceString(JspResourcesID.LOGIN_TITLE)%></title>
</head>
<body bgcolor="#FFFFFF" onLoad="AutoLogin();" onResize="return false;">
<form METHOD=POST NAME="loginform" ACTION="uploadfilehome.jsp">
<INPUT TYPE="hidden" NAME="userName" VALUE="scott">
<INPUT TYPE="hidden" NAME="passWord" VALUE="tiger" onKeyPress="PkeyPress(event);">
<INPUT TYPE="hidden" NAME="step" VALUE="try">
<INPUT TYPE="hidden" NAME="action" VALUE="Login">
</form>
</body>
</html>
<%
%>

Similar Messages

  • Passing values to jsp from html..

    Hi all,
    I have a jsp containing a selection list and need to pass the value to the java segment of the jsp. When reserching this, I've found some info where an html page was created, an initial jsp was saving the info (or bean was used) and then a third jsp displayed the data (using buttons). This is too many steps and I'm needing a way for the same jsp to display containing the selected option (simulating a refresh with the post when the drop down list is used). Is redirecting while setting and getting attributes all at once feasible/possible or is there a better direction or work around for this?
    Thanks in advance,
    Geoff-

    I would think submitting the page to itself, and setting hidden fields to signal that it is a resubmission, may be the way to go. If the new information being displayed is minimal, JavaScript may also work, by setting up an empty <div> or <span> and setting the innerHTML or innerText properties. The advantage of the JavaScript solution is it would be quicker, having the client do all the processing, but it also browser dependant.

  • How to passing value into Captivate from html?

    How to passing value into Captivate from html?
    Or
    How to communicate between objects in one slides?

    Hi czhao0378 and welcome to the forums!
    Captivate does not natively allow you to communicate your own
    data, either internally or externally. The only way to make this
    happen is to create your own functionality, either via custom-built
    Flash objects or JavaScript code executed in the browser or a
    combination of both.
    The only example I've seen of any "data passing" inside
    Captivate is a custom text input/output solution that was posted on
    the Captivate Developer Exchange:
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1253 021
    This solution consists of an input box that takes information
    from the user on one slide and a second box that displays that
    information on another slide. The functionality was built in Flash
    and is embedded in Captivate as a Flash "animation". Unfortunately,
    since this is a custom functionality, the information is not
    included in the user completion results Captivate can pass to a
    Learning Management System.
    Since the solution mentioned above relies on a Flash
    Actionscript variable to hold the information that is displayed,
    you can also pass the information from HTML to Captivate using the
    "SetVariable" command in JavaScript. This would at least allow you
    to display your own HTML-based data inside Captivate.
    Beyond that, I'm not aware of any other way to gather and
    pass data in Captivate.

  • 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().

  • Passing data row-wise from one VO to another.

    Hi,
    I am a ADF newbie so I have a slight issue which I am not able to resolve.
    I need to pass data from table t1 to table t2 which I am able to establish by creating viewlink between the two. But each time I press the 'CreateInsert' button for the VO made for t2,I need a different value to be passed. Basically, I need to pass values rowwise from t1 each time the user clicks the 'CreateInsert' button for t2 VO.
    Eg. If there is an itemCategory table which contains the attributes for an item such as Expiry Date,Food Code,Type of food then for the itemFood, each time I click the 'CreateInsert' button, a new row should be created where attributeId has to be passed one by one i.e. on first click Expiry date should be passed, 2nd click food code should be passed so that based on these attributes,corresponding attribute values for itemFood can be entered in the itemFood table.
    How can I achieve this in ADF? Is there an alternative way where instead of clicking the 'CreateInsert' button, attributeids cn be passed from itemCategory to itemFood?
    Any help in this case is highly appreciated.
    Thanks & Regards,
    Chaya

    Is it possible to pass multiple values for same attribute from one table to another using viewlink?
    eg. If there are 2 tables- FoodAttributes which contains the type of food and the attributes associated with it.
    say,Type -Vegetable, Non-veg, Fruits then for vegetables,attributes can be weight,leafy,etc.
    Another table is FoodTable where we have food specific attribute which contains name of food ,attributes associated with it and the values for those attributes, like cabbage is name, attributes associated with it are leafy,weight and in values we specify leafy as yes and its weight in kg. So I need to pass the attribute names from 1st table to 2nd table. Please suggest a way to do this.

  • Passing data to and from Comm Sub Vi with 2 loops

    Im sure this is simple, and I think Im stuck in vacation mode and cant wait the 4 more hours till I leave, but this is really bothering me. I have a pretty large Queued State Machine and within that machine I have some states which must communicate via the TCP/IP port. My servers are complete and made into Executables and work fine, however I want to leave my clients as sub vi's so that I can easily pass in and retreive data from them. They are designed with 2 while loops, one for sending the data and one for reading the data back. At the very least the read loop needs to remain in a loop to pick up unsolicited messages from my CAN server. However when I place these into my master QSM they hold up the process because of the loops executing. Now I have made a separate loop in my QSM for all my communication clients so the rest of the QSM runs but I cant pass data into these clients because they are stuck executing the loops internally and dont stop to pull in data.
    I should note that if I run my QSM to spawn the servers, then run my client as a separate VI rather than a sub and type my commands there then they execute perfectly.
    So if you can follow my crazy description what would be the best/cleanest way to circumvent this so I can get moving ahead. Thanks, Dave

    Dave,
    Would it work to use a queue to pass data from your main QSM loop to your communication loop? You could write the commands to the queue from your main QSM loop, and pick them up in the communication loop. They would then still run in parallel. Let me know if this works, or if you are looking for something else.
    Robert Mortensen
    Software Engineer
    National Instruments

  • Repeatly passing data to and from external program

    I'm looking for some help to get me started.  I'm willing to bet
    the info is here I'm just not sure what to look for and my searches
    aren't reveiling anwsers. 
    Background: I'm trying to take control of a device that is comunicating
    through the PCI bus.  The device has a set of API dll's that I can
    access through C++, but not directly in LabVIEW.  So wish to creat
    a wrapper program that will give LabVIEW indirect access to the
    dlls.  
    Problem: I've breifly read up on CINs and Libaray call functions and
    have found one underlying problem with both.  I have not found a
    way to pass data back and forth between the external code and LabVIEW
    once the external code is running.  I require an interactive
    conection between the two. 
    Any sugestions of what to search for would be greatly appreatiated, or even how to resolve my problem.
    Thank you.
    Don't get even, get odd!

    If the data buffers are owned by the driver and are updated asynchronously, you should expose that buffer to LabVIEW as a handle (simple int32 for the pointer to the buffer). This can then be passed to the wrapper code and checked (implements your polling). Remember that handling tasks in LV that should run in parallel is different from C++ however - you don't create threads, instead you should simply set up independent loops.
    I'm not sure what else to suggest since I don't fully understand what the API does or what the HW is doing, so feel free to post more information if you want more suggestions
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • Accessing a jsp from html

    Hi,
    Sorry if I have posted wrongly in this forum. I dont know where to post this question.
    Actually I have a jsp page . In that I have javascript function from where I open a window using window.open. I open a html page using that.
    Now from html page I have to access a function which is in the jsp page. i.e accessing a parent's function from child . But the parent is jsp and child is html. How to do that.?
    Please let me know.
    Thank you

    Just the same as normal HTML
    In child window
    window.opener.parentfunctionname()

  • Calling JSP from HTMl

    Hi,
    I want to call a JSP file from HTML. Is it possibel? How can it be done.
    Thanks.

    download a standalone server like tomcat or jswdk. tomcat is recommended.
    if you know how to write html then make a form with your action forwarding to your jsp page and use a post or get method. actually just look here.
    http://www.coreservlets.com/Apache-Tomcat-Tutorial/

  • Data in .jsp or HTML form fields, to a JAVA File and DB

    Hi,
    I am new to the JAX-RS, I have a form where I fill in some details, There is a submit button towards the bottom of that form, when I click submit, it needs to do two actions:
    1) Pass the data in different fields through different variables to into a JAVA file. I am not sure on how to call a JAVA file or program's method from either .HTML or .JSP
    2) Extract the data from the fields and populate a DB through JDBC Connection
    Your help is greatly appreciated!
    Thanks,

    If you're looking for some to write the code for you, you're in the wrong place. If you've tried to write it yourself, but are stuck on an error message, logic issue, or something similar, feel free to ask a question!
    If you submit code, don't forget to use the code tags. If you submit an error message, be sure to copy the entire message and stack trace.

  • Any sample program to fetch data with JSP from MySQL

    Hi,
    Anybody can you ple give me a sample code to fetch data from MySQL and show it.
    Database server : localhost
    Databasename : test
    Database User : root
    Database Password : (database have no password)
    Table Name : category
    Table column name : catName
    I am trying the following code, but it gives error:
    exception
    org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
         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)
    <%@ page import="java.sql.*" %>
    <%
    String connectionURL = "jdbc:mysql://localhost:3306/test";
    Connection connection = null;
    Statement statement = null;
    ResultSet rs = null;
    %>
    <html><body>
    <%
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    connection = DriverManager.getConnection(connectionURL, "root", "");
    statement = connection.createStatement();
    rs = statement.executeQuery("SELECT * FROM category");
    while (rs.next()) {
    out.println(rs.getString("catName")+"<br>");
    rs.close();
    %>
    </body></html>
    any help is appreciated.
    ---Sujoy

    Just replace the following code. I think it will work for u.
    <%@ page import="java.sql.*" %>
    <%
    try{
    String connectionURL = "jdbc:mysql://localhost:3306/test";
    Connection connection = null;
    Statement statement = null;
    ResultSet rs = null;
    Class.forName("com.mysql.jdbc.Driver");
    connection = DriverManager.getConnection(connectionURL, "root", "");
    statement = connection.createStatement();
    rs = statement.executeQuery("SELECT * FROM category");
    %>
    <html><body>
    <table>
    <%
    while(rs.next())
    %>
    <tr><td><%=rs.getString("catName")%></td></tr>
    <%
    %>
    </table>
    </body>
    </html>
    <%
    rs.close();
    statement.close();
    connection.close();
    catch(Exception e)
           e.printStackTrace();
    finally()
      try{
       rs.close();
       statement.close();
       connection.close();
      catch(Exception e)
            e.printStackTrace();
    %>

  • Passing Data to Webdynpro from normal module pool screen

    Hi,
    I am working on a requireent, where I have a normal screen with some fields and a button. When I click on the button I want to navigate to the webdynpro screen and also pass the data from the screen to web dynpro.
    Any suggestion is really appriciated.
    Thanks
    Sanjaya

    Hi Sanjaya,
      DATA lv_app TYPE swfvtv-vval.
      DATA lv_url TYPE string.
      DATA lv_url_pre TYPE string.
      DATA lv_url_suff TYPE string.
      DATA lv_task TYPE swfvtv-task.
      DATA lv_memid TYPE string.
      DATA lt_param TYPE tihttpnvp.
      DATA ls_param TYPE LINE OF tihttpnvp.
      DATA lo_window_manager TYPE REF TO if_wd_window_manager.
      DATA lo_api_component  TYPE REF TO if_wd_component.
      DATA lo_window         TYPE REF TO if_wd_window.
    Get Application Name.
      lv_task = sworklist-external_type.
      DATA lt_swfvtv TYPE TABLE OF swfvtv.
      DATA ls_swfvtv TYPE swfvtv.
    Get WD parameters
      SELECT *
      FROM   swfvtv
      INTO   CORRESPONDING FIELDS OF TABLE lt_swfvtv
      WHERE  task EQ lv_task
      AND    vtyp EQ 'WD_ABAP'.
      IF sy-subrc NE 0.
        RAISE not_found.
      ENDIF.
    Create application name in PAPPL
    Get namespace
      READ TABLE lt_swfvtv INTO ls_swfvtv WITH KEY vpar = 'NAMESPACE' .
      IF sy-subrc EQ 0.
        CONCATENATE pappl ls_swfvtv-vval INTO pappl SEPARATED BY '/'.
      ENDIF.
    Get application name
      READ TABLE lt_swfvtv INTO ls_swfvtv WITH KEY vpar = 'APPLICATION' .
      IF sy-subrc EQ 0.
        CONCATENATE pappl ls_swfvtv-vval INTO pappl SEPARATED BY '/'.
      ENDIF.
    Construct URL for application name.
      lv_url = pappl.
      CALL METHOD cl_wd_utilities=>construct_wd_url
        EXPORTING
          application_name = lv_url
          in_parameters    = lt_param
        IMPORTING
          out_absolute_url = lv_url.
      SPLIT lv_url AT '?' INTO lv_url_pre lv_url_suff.
      IF lv_url_suff IS NOT INITIAL.
        CONCATENATE '&' lv_url_suff INTO lv_url_suff.
      ENDIF.
      CONCATENATE lv_url_pre '?sap-client=' sy-mandt '&sap-language=' sy-langu lv_url_suff '&WI_ID=' sworklist-external_id
    INTO   lv_url.
    Create window for application.
      lo_api_component  = wd_this->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
      lo_window         = lo_window_manager->create_external_window(
                            url = lv_url
                            has_menubar = abap_false
                            has_toolbar = abap_false
                            has_location = abap_false ).
      lo_window->set_window_size( width = '700' height = '500' ).
      lo_window->open( ).
    This is the code to generate the URL for a Web Dynpro Application.
    modify the code according to need.
    Hope this will help you.
    Thanks &Regards,
    Arvind
    Hey i dont know why is this coming like this when posted.
    Copy-paste this in modify in editor.
    Edited by: Arvind Patel on Jun 16, 2010 2:35 PM

  • Pass date value back from called form

    I have a form that allows the user to select a date from a calendar canvas. I can call this form from another from and now want to pass the selected date on the called form back to the calling form. I'm new to multi-form applications so I'm looking for some guidence here. I am thinking a parameter list would be better than a global variable since globals only support char values. I've never done this before so any advice or examples would be helpful.
    Thanks in advance,
    Jeff

    Chander,
    Thanks for your reply. I think this is the .olb I am using. I created my calendar form using it or a similar .olb. The form runs OK, just lacks the means to pass the "date picked" to the calling form. This is where my inexperience is making things difficult. Assuming we are talking about the same olb, how do I pass the date back?
    Jeff

  • Passing data to se16 from within abap program

    Hi,
    I have an internal table itab defined as three fields (e.g., fld1(10) type c) and would like to pass the data from fld1 row 3 to the se16 textbox and then have se16 process to find the table.
    I used "call transaction 'SE16'." to initiate, but I do not know how to pass the field value to the textbox and then have it process the field value to find the table.  Can anyone advise?
    thanks!

    I believe that this is what you want.
    report zrich_0004.
    data:   bdcdata like bdcdata    occurs 0 with header line.
    start-of-selection.
      perform bdc_dynpro      using 'SAPLSETB' '0230'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'DATABROWSE-TABLENAME'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ANZE'.
      perform bdc_field       using 'DATABROWSE-TABLENAME'
                           'MARA'.
      call transaction 'SE16' using bdcdata
                                    mode 'E'.
    *        Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      append bdcdata.
    endform.
    *        Insert field                                                  *
    form bdc_field using fnam fval.
      clear bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      append bdcdata.
    endform.
    Regards,
    Rich Heilman

  • Report with Form Passing date to form from report issue

    Hi All ,
    I got stuck up in the below issue .Can anyone point out the issue behind it and how to get rid of this.
    I have created a report page with form page .The report page have 2 column identified as conjugate primary key.the col1 is varchar2 and col2 is date .
    The report page have one link on col1 field which is passing the Item_value for both col1 and col2 to form page .
    In the DB level the col2 data type is date (for e.g : 26/07/2007 07:08:56) .But the probem is when we are clicking on the link of col1 it is displaying error like Error like ORA-01403: no data found .
    But if the data in DB is only in format of DD/MM/YYYY removing the timestmap the link is working fine and returing data for other fields in the form page .
    Could anyone pls pointed out the problem and let us know the issue.
    Thanks in advance.
    Regards,
    Deba

    Hi Deba,
    I suppose your problem is due to the : in the time.
    You're passing these values with the url I suppose? Have a look how APEX generates/constructs the url, it uses : to separate things.
    I'm not sure why you want a date in a Primary Key?
    Thanks,
    Dimitri

Maybe you are looking for

  • How can i run hardware diagnostic in my Macbook pro running OSX Lion 10.7.2

    Yesterday My 1 and half year old Macbook Pro 13.3" suddently developed a noisy fan and battery indicator also suddently changed from cable sign to X in the battery bar. when i removed the power cable, the computer suddently shut down. i plaged the po

  • Can't install Oracle 8.1.7 Personal Edition on Windows ME

    I am trying to install "Oracle 8.1.7 Personal Edition for Windows 98" on Windows ME. I can't install it. During the install on the Oracle Universal Intaller, on the part where it asks for the Source and Destination, after I click "Next" to install, i

  • Fault handling for Mediator component

    I am trying to capture all the system and business faults of the composite and email the details to system groups. I am having issues with the fault policy file and get the following error. My Composite is made up of Web Services ---> Mediator ---->D

  • How to calculate percentage old school

    I am looking for a calculator aps that can calculate percentage like in the 1980 Casio calculator, Example: 100 x 25% + That would equal 125 and not 50 Merck

  • Connection string - using alias

    I am currently able to connect to Oracle databases using a connect string like: con = DriverManager.getConnection("jdbc:oracle:thin:@host_name:post:SID", "userid", "password"); Is there away I can connect by just passing the alias of the SID that is