Passing asp form data to a .jsp string

Hello and thanks in advance for any help.
I would like to pass form information that comes from a standard form into a URL string as follows:
"http://ui.constantcontact.com/roving/wdk/API_AddSiteVisitor.jsp?loginName=benefitevents&loginPassword=connoisseur&ea=[email protected]&ic=test&first_name=Joe&last_name=smith"
I would then like to pass that string forward to its final destination.
Some more info.
Form data is collected on "register.asp" and then passed to "register1.asp" using form method="post" action="register1.asp".
On register1.asp the form info is processed and delivered to the SQL database.
I am only a beginner with the code (it was done by a programmer who is mostly absent when needed now).
So, I need to know as much of the following as you can help with (in descending priority):
1. How to pass the .jsp string forward assuming the proper variables have been passed in the asp code.
2. Where should this command live, in register.asp or register1.asp?
3. How to correctly insert the variables in the URL string from form (correct syntax using asp).
As may be obvious this is for one registrant at a time. The object is deliver the registration information to my SQL database and, at the same time, pass some info to a Constant Contact list. This allows me to integrate Constant Contact into my services to clients seamlessly.
Thank you, hope this was not too much info!
Jim

Javascript is not the same as Java.
There are JS related forums at webdeveloper.com. But I would rethink about the JS approach. It should also be able with ASP and I would prefer that.

Similar Messages

  • Passing variables between data tag and JSP-scriptlets

    Hi,
    There were some questions about this issue. However, the answers were not satisfactory.
    I would like to assign the value returned from data tag to a variable in JSP-scriptlets as follows:
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <br>
    <jbo:ApplicationModule id="isae.OPKv1.OPKv1Module" configname="isae.OPKv1.OPKv1Module.OPKv1ModuleLocal" username="t1" password="t1"/>
    <br>
    <!-- a record is selected -->
    <jbo:DataSource id="ds" appid="isae.OPKv1.OPKv1Module" viewobject="AePk100View" whereclause=" <%= ic %> " />
    <br>
    <jbo:Row id="privRow" action="CURRENT" datasource="ds">
    <%
    String privName = (String) privRow.getAttribute("ArBau325"); // this is the suggestion of William Dwight (Jan 21, 2001 this forum)
    %>
    </jbo:Row>
    This code did not work. I have obtained an error :
    java.lang.ClassCastExeption
    Any help would be greatly appreciated.
    Thanks

    The value return by the getAtribute might not be of type String. If you want to return a String value you need to convert the value using the toString method as follow:
    <jbo:Row id="privRow" action="CURRENT" datasource="ds"/>
    <%
    String privName = "";
    Object obj = privRow.getAttribute("ArBau325");
    if (obj != null)
    privName = obj.toString();
    %>
    Also note that you do not need to put the scriplet code inside the body of the row tag.
    Charles.

  • Sharepoint 2013 pass custom form data

    I am asking the question since this is my first project working with Sharepoint 2013.
    Here is the project requirements:
    1. I created a custom list for users to enter data in a custom form that is modified by Infopath 2013.
    2. Once the user clicks the 'save' button on the custom form, the workflow is started and the workflow will be waiting for certain users to accept or reject the form.
    3. If the form is rejected the user needs to make modifications and the form can be  resubmited.
    4. Once the custom form is accepted, the user will be required to submit bimonthly updates on the progress of the request they made based upon the start and end dates submitted on the original form.
    5. After the custom form as been accepted, a master/detail will be setup with the master being the accepted form and the bimonthly updates will be details.
    Here are my question:
     I want to pass the information from the accepted form to the master/detail form that will do the following 'Once the custom form is accepted, the user will be required to submit bimonthly updates on the progress of the request they made based upon the
    start and end dates submitted on the original form'. Would you tell me how to pass the information from the accepted custom form to being the 'master' part of the master/detail form I just mentioned?
    Is this a good solution? If you how would you change the design and how would you make these coding changes and what would the design change be?

    Hi Scampsman,
    Based on your description, my understanding is that you want to pass data from one InfoPath form to another InfoPath form in SharePoint.
    To achieve this goal, we can write code in the details form with FormEvents_Loading to capture and display the incoming parameters passed from the original form.
    Please refer to the link below for more detail steps(same for InfoPath 2013):
    http://sharepointbeeeye.com/infopath-2010-passing-data-between-forms/
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Passing form data from html page to JSP page

    Hi,
    I have a simple HTML page with a form on it that sends the information to a JSP page that stores the form data in a JSP session. I created a simple form that asks for the user's name, sends it to the JSP page, stores that in a session, then sends it to another JSP page which displays the name. This worked fine.
    However, I added another input box to my form that asks for the user's age to do the same steps as outlined above. This does not work, and I'm not sure why. Here's the code from my HTML page:
    <form method=post action="savename.jsp">
    What's your name?
    <input type=text name=username size=20 />
    <p />
    What's your age?
    <input type=text name=age size=20 />
    <p />
    <input type=submit />Here's the code from my JSP page, savename.jsp (later on in the JSP page it links to another page, but that is not relevant):
    <%
    String name = request.getParameter("username");
    String age = request.getParamater("age");
    session.setAttribute("theName", name);
    session.setAttribute("theAge", age);
    %>Finally, here is the error message from Tomcat 6.0.9:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 3 in the jsp file: /savename.jsp
    The method getParamater(String) is undefined for the type HttpServletRequest
    1: <%
    2: String name = request.getParameter("username");
    3: String age = request.getParamater("age");
    4: session.setAttribute("theName", name);
    5: session.setAttribute("theAge", age);
    6: %>
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)I do not understand the error, as it works fine when I simply try to retrieve "theName", but breaks when I try to retrieve both.
    What is it I am missing here?
    Thanks,
    Dan

    Ummm.... you misspelled "parameter" the second time
    you tried to use it.......
    That is incredibly embarrassing. Sorry if I made anyone think it was something more serious. Holy mackerel, I think it's time for me to read over my code much more carefully before posting about a problem.
    Thanks for the help DrClap.

  • How to pass a form value  as a url parameter??

    I have following form and I want to pass the selected value of the drop down choice in as one of the parameter in the URL. How can I do that ??
    something like proposalid that I have done in the url, I want to pass the selected value of the variable doc_id, when I click the Link button
    <form name = "link" method="POST" enctype="multipart/form-data" action="<%= request.getScheme() %>://<%= request.getServerName() %>/webAppCore/common/add_doc.jsp">
    <table>
         <tr> <td class="tableContent"> Doc Identifier: </td>
    <td class="tableContent"> <SELECT name="doc_id">
    <%
         Vector v = iddata.getDocumentIdList(tabName);
         //out.println(v);
         if (v != null && v.size() > 0) {
              for (int i = 0; i < v.size(); i++) {
              Hashtable hash = (Hashtable) v.elementAt(i);
    %>
    <OPTION selected name="id " value="<%=(String)hash.get("DOCUMENT_ID")%>"> <%=(String)hash.get("DOCUMENT_NAME")%></OPTION>
    <% } } else {%>
         <OPTION selected name="id " value="test"> No DocIDs</OPTION>
    <%}%>
    <tr> <td colspan = "2">
         <table border="1" width="200">
              <tr> <td> <input type="text" name="link_file" size="30" value=""/></td><td> <INPUT TYPE=button VALUE="Link..." onClick="window.open('<%= request.getScheme() %>://<%= request.getServerName() %>/webAppCore/common/link.jsp?proposalid=<%=proposalID>','mywindow','toolbar=no,location=no,directories=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300,left=20,top=20');"></td> </tr>
              <tr> <td colspan = "2">
                   To Create Links: <br>
                   * Select Doc Identifier
                   * Click on Link...to select file within eFile. <br>
                   * Click Add to create the Link <br>
              </td> </tr>
         </table>
         </tr>

    if - in your form declaration - you change your method to GET from POST, it will append the form data onto the URL string instead of putting it in the request header. For instance, if you have a form with an input called THE_INPUT, and you submit to a servlet (or script of some kind or whatever) when the value of that text box is "foo", the URL will be:
    http://www.yourdomain.com/yourservlet?THE_INPUT=foo
    But, if you use the POST method, the URL will just be:
    http://www.yourdomain.com/yourservlet
    Is that what you meant?

  • How to capture the data from a JSP form

    Hi
    I have a JSP form, My task is to capture the data from a JSP and submit to Data Base. for example I have the field like
    Enter Table name to be created in data base: The table name is to be captured by a servlet and by that table name, table should be created in the data base.
    Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????
    Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????

    Get the entered value from the jsp into servlet using request.getParameter("enteredTableName"). it will return the String,pass this table name to execute query using JDBC connection and statement objects.
    -cheers Ram

  • Can't pass parameter from HTML form of multipart/form-dta type to JSP

    I am using request.getParameter(passed variable name) to pass data from HTML form to JSP with no problem. WHen I try to pass data from HTML form of multipart/form-dta type to JSP as following:
    < form enctype="multipart/form-data" name="theForm" method="post" ACTION="http://titan.ssd.loral.com:7778/ifs/jsp-bin/ifs-cts/stringsecond.jsp">
    The passed value is null. Why?
    How can I pass data successfully from this form to JSP?
    How can I pass data from JavaScript to JSP?
    Thank you

    I am using request.getParameter(passed variable name)
    to pass data from HTML form to JSP with no problem.
    WHen I try to pass data from HTML form of
    multipart/form-dta type to JSP as following:
    < form enctype="multipart/form-data" name="theForm"
    method="post"
    ACTION="http://titan.ssd.loral.com:7778/ifs/jsp-bin/if
    -cts/stringsecond.jsp">
    The passed value is null. Why?because the jsp most likely does not handling of POST parameters like this.
    How can I pass data successfully from this form to
    JSP?jsp's are not meant to read such amounts of data. this (= uploading) is a typical task for a specialized servlet. there you have full control over input and output. if you need to, you can still forward to a jsp after processing in the servlet.
    How can I pass data from JavaScript to JSP???? i'm not sure what exactly you mean. normally you put it into an url and submit it.
    robert

  • How to Validate Data from a JSP form

    [newbie]
    From a netui:anchor, I call a data entry form (dataEntry.jsp). It contains 5 textboxes created using netui:form and netui:textbox.
    The user enters the new account info and clicks the submit button, a form bean is populated and passed back to the controller which calls a method to update the database. This all works well. At least it did, until I found that I could enter control characters into the form... So, this brought up the issue of data validation.
    I would imagine there is a standard way to validate form data. (like checking a value is numeric or alpha, has a specific length or to apply a regex or edit mask prior to insertion into a database...)
    Is it generally done within the jsp?, the form bean? or in the controller? The latter 2 would be java, I suppose. If it's in the jsp, are there jsp tag libraries for that?
    Any direction would be most appreciated.
    Mark
    If I should be on another forum/newgroups (perhaps one for amateurs, please let me know... :>)

    I believe I found the answers to my questions in some Beehive docs. I'll follow up if I have others... Mark

  • How to use session to passing data from one JSP to another JSP

    Dear All, I had create 2 jsp web page and want to do this:
    1. input some data into the text box and click the submit button, the jsp page
    will open another jsp page and send the text box data to the new open jsp page.
    can any one tell me how to open a new jsp web page and reciev data from another jsp page?
    thanks yu very much!
    the question.jsp got some code like:
    <html>
    <input type= 'text' name = 'txtName' size = 10 >
    <input type= 'submit' name = 'submit'>
    <% some jsp code %>
    </html>
    answer.jsp
    <html>
    <%
    some jsp code here
    %>
    </html>

    Contents of HTML forms are transmitted as name-value pairs, so you can call request.getParameter(String name) with your form field's name in order to access its value:
    String textValue=request.getParameter("txtName");Regards

  • I want to use data binding in jsp,just like microsoft ASP's RDS,how can I d

    I want to use data binding in jsp,just like microsoft ASP's RDS,how can I do?

    I can't claim to know exactly what RDS binding involves, but if my hunch is correct, you can get very similar behavior by using JSTL and define your data source using JNDI. See the JSTL spec, my article series about JSTL, or a JSP/JSTL book (such as mine ;-) for details:
    http://java.sun.com/products/jsp/jstl
    http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html
    http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html
    http://www.onjava.com/pub/a/onjava/2002/10/30/jstl3.html
    http://www.thejspbook.com/

  • Send form data from Coldfusion to ASP

    I need to send form data from CF to ASP.
    I submit a CF page and validate it on my end with another CF
    page, which then needs to post the results to an asp page on
    another site. The post has to be sent via SSL and I don't need to
    and cannot receive any status message back from the remote ASP
    site. Any suggestions would be greatly appreciated. I was thinking
    some type of cfhttp, but I am not very familiar with its usage.
    Thanks!

    It doesn't matter what type of page you are sending to as
    long as it can handle the data that is sent. Either a form or
    cfhttp will work.

  • ASP Classic - post form data without form

    I have to send our account password and user entered form
    data to a page (which I can't modify). I don't want to use the Get
    method and I don't want to put our password into a hidden field. I
    would like to have the user fill out the form, which submits back
    to the page where I add my password field value via ASP, then send
    all of that data to another page via post.
    To further clarify, we are using a service and to add user
    data I have to also supply our account name and password.

    Get it from the database and when you send it make sure its
    sent as
    unencrypted text. Its all the rage...
    <%= Clinton Gallagher
    NET csgallagher AT metromilwaukee.com
    URL
    http://clintongallagher.metromilwaukee.com/
    "jasonacook" <[email protected]> wrote in
    message
    news:f6321t$s9j$[email protected]..
    >I have to send our account password and user entered form
    data to a page
    >(which
    > I can't modify). I don't want to use the Get method and
    I don't want to
    > put our
    > password into a hidden field. I would like to have the
    user fill out the
    > form,
    > which submits back to the page where I add my password
    field value via
    > ASP,
    > then send all of that data to another page via post.
    > To further clarify, we are using a service and to add
    user data I have to
    > also
    > supply our account name and password.
    >

  • Problem with transfering unicode form data in MULTIPART/FORM-DATA

    HI experts,
    I have this web based multilingual application. Page 1(form6.jsp) is basic registeration form with 5 fields and one image upload to the server. Page 2(verify.jsp) is another jsp page for verification of UTF data entered in page 1.
    page 2 (verify.jsp) also uses a bean called (verify.java) for picking up values. page 3(insertEntry.jsp) is the page for inserting that data into the Database and uses a bean called (logicbean.java).
    Now, the problem im facing here is that if i use multipart/form-data, the unicode text filled in page1 is shown as garbage when its is transfered to page2 and displayed on page2. It is all gibberish. But if i do not use multipart/form-data, the unicode text transfered from page1 to page2 is displayed perfectly on page2.Im using devenagari(UTF) language for filling in details.
    // form6.jsp
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ page import="java.util.*,java.text.*" %>
    <%@ page import="com.oreilly.servlet.*" %>
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <HTML>
    <HEAD>
    <TITLE>
    <%=session.getValue("main.title")%>
    </TITLE>
    </HEAD>
    <h1><center><%=session.getValue("main.head")%><Center>
    <BODY background="brown.bmp">
    <form name=form6 action="verify.jsp" method="post" enctype="multipart/form-data">
    <center>
    <font>
    <table border=1>
    <tr>
    <td colspan=2><center><img src="asok.bmp"></center>
    </tr>
    <tr>
    <td >
    <b>1.)<%=session.getValue("main.ec")%></b>
    </td>
    <td></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.ecname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="votername"></td>
    <td></td>
    </tr>
    <tr>
    <td align="right"> <b><%=session.getValue("main.ecsurname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="votersurname"></td>
    <td></td>
    </tr>
    <tr>
    <td align="left"><b>2.)<%=session.getValue("main.rel")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    <select name="relation" onchange="if(this.selectedIndex!=0){this.form.texthiddenrelation.value=this.options[this.selectedIndex].value}" size="1">
                                       <option>Choose</option>
    <option value="father">Father</option>
    <option value="mother">Mother</option>
    <option value="husband">Husband</option>
    </select>
    <input type="hidden" name="texthiddenrelation" />
    </td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.relname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="parentname">
    <td></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.relsurname")%>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</b><input type="text" name="parentsurname">
    <td></td>
    </tr>
    <tr>
    <td align="right"><b>3.)<%=session.getValue("main.sex")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    <select name="sex" onchange="if(this.selectedIndex!=0){this.form.texthiddensex.value=this.options[this.selectedIndex].value}" size="1">
                                            <option>Choose</option>
                                            <option value="male">Male</option>
    <option value="female">Female</option>
    <option value="other">Other</option>
    </select>
    <input type="hidden" name="texthiddensex" /> </td>
    <td align="right"><b><%=session.getValue("form6.image")%><input type ="file" name=pic1 onchange={this.form.pic.value=this.form.pic1.value}><input type= hidden name=pic> </b></td>
    </tr>
    <tr>
    <td colspan=2><b>4.)<%=session.getValue("main.age")%></b><input type="text" name="age">
    </td>
    </tr>
    <tr>
    <td><b>5.)<%=session.getValue("main.dob")%></b>
    <td><b><%=session.getValue("main.dobday")%></b> <select name="cmbday">
    <option value="1"> 1 </option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">10</option>
    <option value="10">11</option>
    <option value="11">12</option>
    <option value="12">13</option>
    <option value="13">14</option>
    <option value="14">15</option>
    <option value="15">16</option>
    <option value="16">17</option>
    <option value="17">18</option>
    <option value="18">19</option>
    <option value="19">20</option>
    <option value="20">21</option>
    <option value="21">22</option>
    <option value="22">23</option>
    <option value="23">24</option>
    <option value="24">25</option>
    <option value="25">26</option>
    <option value="26">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select>
    <b><%=session.getValue("main.dobmonth")%></b><select name="cmbmonth">
    <option value="jan">JAN</option>
    <option value="feb">FEB</option>
    <option value="mar">MAR</option>
    <option value="apr">APR</option>
    <option value="may">MAY</option>
    <option value="jun">JUN</option>
    <option value="jul">JUL</option>
    <option value="aug">AUG</option>
    <option value="sep">SEPT</option>
    <option value="oct">OCT</option>
    <option value="nov">NOV</option>
    <option value="dec">DEC</option>
    </select>
    <b><%=session.getValue("main.dobyear")%></b> <select name="cmbyear" onchange="if(this.form.cmbday.selectedIndex!=0 && this.form.cmbmonth.selectedIndex!=0 && this.form.cmbyear.selectedIndex!=0){this.form.mergedage.value=this.form.cmbday.options[this.form.cmbday.selectedIndex].value +' '+this.form.cmbmonth.options[this.form.cmbmonth.selectedIndex].text +' '+ this.form.cmbyear.options[this.form.cmbmonth.selectedIndex].value}" size="1">
    <option value="1970">1970</option>
    <option value="1971">1971</option>
    <option value="1972">1972</option>
    <option value="1973">1973</option>
    <option value="1974">1974</option>
    <option value="1975">1975</option>
    <option value="1976">1976</option>
    <option value="1977">1977</option>
    <option value="1978">1978</option>
    <option value="1979">1979</option>
    <option value="1980">1980</option>
    <option value="1981">1981</option>
    <option value="1982">1982</option>
    <option value="1983">1983</option>
    <option value="1984">1984</option>
    <option value="1985">1985</option>
    <option value="1986">1986</option>
    <option value="1987">1987</option>
    <option value="1988">1988</option>
    <option value="1989">1989</option>
    <option value="1990">1990</option>
    <option>
    </select>
    <input type="hidden" name="mergedage">
    </tr>
    <tr>
    <td colspan=2><b>6.)<%=session.getValue("main.add")%></b>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.addline1")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="address1" value=""></td>
    <td><b><%=session.getValue("main.addstate")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="state"></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.addline2")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="address2" onChange="this.form.finaladdress.value=this.form.address1.value + ';' + this.value;"> <input type="hidden" name="finaladdress"> </td>
    <td><b><%=session.getValue("main.addcity")%>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</b><input type="text" name="city"></td>
    </tr>
    <tr>
    <td align="right"> <b><%=session.getValue("main.addpin")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="pincode">
    <td></td>
    </tr>
    <tr>
    <td ><b>7.)<%=session.getValue("main.const")%></b> <input type="text" name="constituency">
    <td ><b>8.)<%=session.getValue("main.id")%></b> &nbsp&nbsp<input type="text" name="refno">
    </tr>
    <tr>
    <td colspan="2"><center><input type="reset" name="reset" value="<%=session.getValue("button.reset")%>">&nbsp&nbsp<input type=submit name=Submit value="<%=session.getValue("button.submit")%>"></center></td>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    </form>
    </font>
    </BODY>
    </HTML>
    // verify.jsp
    <%@ page language="java" pageEncoding="UTF-8"%>
    <jsp:useBean id="verify" class="pack.verify" scope="request"/>
    <%@ page import="com.oreilly.servlet.*" %>
    <%@ page import="java.util.*,java.text.*" %>
    <%!
    MultipartRequest mp;
    // ParameterParser pp;
    %>
    <!-- Perform the actions on the bean. -->
    <%
    //pp.setCharacterEncoding("utf-8");
    %>
    <%
    try
    mp = new MultipartRequest(request, "d:/Files");
    out.println("DONE");
    /* Set the request object.*/
    /* The request object is implicitly available in the JSP page.*/
    verify.setRequest(mp);
    /* Insert the employee data into the database.*/
    verify.verifyEntry();
    //verify.setscope();
    /* Run the query to retrieve the employee data from the database.*/
    //logicbean.runQuery();
    catch (Exception e)
    System.out.println(e.getMessage());
    %>
    <HTML>
    <HEAD>
    <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>
    </TITLE>
    </HEAD>
    <BODY background="brown.bmp">
    <form name=form6 action="insertEntry.jsp" method="POST">
    <center>
    <table border=3>
    <tr>
    <td colspan=2><center><img src="asok.bmp"></center>
    </tr>
    <tr>
    <td >
    <b>1.)<%=session.getValue("main.ec")%></b>
    </td>
    <td rowspan=3>
    <image src="<%=verify.getpic()%>" width="85" hieght="85">
    </td>
    </tr>
    <tr>
    <td > &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.ecname")%></b> <%=verify.getvotername()%>&nbsp&nbsp<input type="hidden" value= "<%=verify.getvotername()%>" name="votername"></td>
    </tr>
    <tr >
    <td> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.ecsurname")%></b><%=verify.getvotersurname()%>
    <input type="hidden" value= "<%=verify.getvotersurname()%>" name="votersurname"></td>
    </tr>
    <tr>
    <td ><b>2.)<%=session.getValue("main.rel")%></b><input type="hidden" value= "<%=verify.getvoterrelation()%>" name="texthiddenrelation"></td>
    <td><%=verify.getvoterrelation()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.relname")%></b>&nbsp&nbsp&nbsp <input type="hidden" value= "<%=verify.getparentname()%>" name="parentname"></td>
    <td><%=verify.getparentname()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.relsurname")%></b><input type="hidden" value= "<%=verify.getparentsurname()%>" name="parentsurname"></td>
    <td><%=verify.getparentsurname()%></td>
    </tr>
    <tr>
    <td><b>3.)<%=session.getValue("main.sex")%></b><input type="hidden" value= "<%=verify.getsex()%>" name="texthiddensex"></td>
    <td><%=verify.getsex()%></td>
    </tr>
    <tr>
    <td ><b>4.)<%=session.getValue("main.age")%></B><input type="hidden" value= "<%=verify.getage()%>" name="age"></td>
    <td><%=verify.getage()%></td>
    </tr>
    <tr>
    <td><b>5.)<%=session.getValue("main.dob")%></b> <input type="hidden" value= "<%=verify.getdob()%>" name="mergedage"></td>
    <td> <%=verify.getdob()%></td>
    </tr>
    <tr>
    <td colspan=2><b>
    6.)<b><%=session.getValue("main.add")%></b></td>
    </tr>
    <tr>
    <td> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("verify.add")%></b><input type="hidden" value= "<%=verify.getadderess()%>" name="finaladdress"> </td>
    <td><%=verify.getadderess()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.addpin")%></b><input type="hidden" value= "<%=verify.getpin()%>" name="pincode"></td>
    <td><%=verify.getpin()%></td>
    </tr>
    <tr>
    <td>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.addstate")%></b><input type="hidden" value= "<%=verify.getstate()%>" name="state"></td>
    <td><%=verify.getstate()%></td>
    </tr>
    <tr>
    <td><b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<%=session.getValue("main.addcity")%></b><input type="hidden" value= "<%=verify.getcity()%>" name="city"></td>
    <td><%=verify.getcity()%></td>
    </tr>
    <tr>
    <td><b>7.)<%=session.getValue("main.const")%></b> <input type="hidden" value= "<%=verify.getconst()%>" name="constituency"></td>
    <td><%=verify.getconst()%></td>
    </tr>
    <tr>
    <td><b>8.)<%=session.getValue("main.id")%></b> <input type="hidden" value= "<%=verify.getrefno()%>" name="refno"></td>
    <td><%=verify.getrefno()%></td>
    </tr>
    <tr>
    <td colspan="2"><center><INPUT TYPE="button" VALUE="<%=session.getValue("ie.back")%>" onClick="history.go(-1)">
    <input type=submit name=Submit value="<%=session.getValue("button.submit")%>"></center><input type="hidden" value= "<%=verify.getpic()%>" name="pic"></td>
    </tr>
    </form>
    </BODY>
    </HTML>
    //verify.java
    package pack;
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.oreilly.servlet.*;
    import com.oreilly.servlet.ParameterParser.*;
    * @author Administrator
    * To change this generated comment edit the template variable "typecomment":
    * Window>Preferences>Java>Templates.
    * To enable and disable the creation of type comments go to
    * Window>Preferences>Java>Code Generation.
    public class verify {
    String votername = "";
    String votersurname = "";
    String texthiddenrelation="";
    String parentname = "";
    String parentsurname = "";
    String gender = "";
    String texthiddensex="";
    String age = "";
    String dob = "";
    String mergedage="";
    String address = "";
    String finaladdress="";
    String pincode = "";
    String state = "";
    String city = "";
    String constituency = "";
    String refno = "";
    MultipartRequest request = null;
    Connection dbConn = null;
    ParameterParser pp;
    private String voternameParam;
    * Set the request object. This is used for getting parameters.
    public void setRequest(MultipartRequest request)
    this.request = request;
    public void verifyEntry()
    throws Exception
    /* Connect to the database.*/
    //pp.setCharacterEncoding("utf-8");
    //String nameParam = request.getParameter("name");
    MultipartRequest mp;
    System.out.println("connected to db2 through insertemployee");
    /* Get all the parameters from the calling HTML form.*/
    String voternameParam = request.getParameter("votername");
    System.out.println("the votername is " + request.getParameter("votername"));
    System.out.println(voternameParam);
    String votersurnameParam = request.getParameter("votersurname");
    System.out.println("the votersurname is " + request.getParameter("votersurname"));
    String hiddenrelationParam = request.getParameter("texthiddenrelation");
    System.out.println("the relation is " + request.getParameter("texthiddenrelation"));
    String parentnameParam = request.getParameter("parentname");
    System.out.println("the parentname is " + request.getParameter("parentname"));
    String parentsurnameParam = request.getParameter("parentsurname");
    System.out.println("the parentsurname is " + request.getParameter("parentsurname"));
    String ageParam = request.getParameter("age");
    System.out.println("the age is " + request.getParameter("age"));
    String mergedageParam = request.getParameter("mergedage");
    System.out.println("the mergedage is " + request.getParameter("mergedage"));
    String hiddensexParam = request.getParameter("texthiddensex");
    System.out.println("the hiddensex is " + request.getParameter("texthiddensex"));
    //String dobParam = request.getParameter("dob");
    //System.out.println("the dob is " + request.getParameter("dob"));
    String finaladdressParam = request.getParameter("finaladdress");
    System.out.println("the finaladdress is " + request.getParameter("finaladdress"));
    String pincodeParam = request.getParameter("pincode");
    System.out.println("the pincode is " + request.getParameter("pincode"));
    String stateParam = request.getParameter("state");
    System.out.println("the state is " + request.getParameter("state"));
    String cityParam = request.getParameter("city");
    System.out.println("the city is " + request.getParameter("city"));
    String constituencyParam = request.getParameter("constituency");
    System.out.println("the constituency is " + request.getParameter("constituency"));
    String refnoParam = request.getParameter("refno");
    System.out.println("the refno is " + request.getParameter("refno"));
    System.out.println("encoding = " + System.getProperty("file.encoding"));
    public String getvotername()
    return request.getParameter("votername");
    public String getvotersurname()
    return request.getParameter("votersurname");
    public String getvoterrelation()
    return request.getParameter("texthiddenrelation");
    public String getparentname()
    return request.getParameter("parentname");
    public String getparentsurname()
    return request.getParameter("parentsurname");
    public String getage()
    return request.getParameter("age");
    public String getsex()
    return request.getParameter("texthiddensex");
    public String getadderess()
    return request.getParameter("finaladdress");
    public String getpin()
    return request.getParameter("pincode");
    public String getstate()
    return request.getParameter("state");
    public String getcity()
    return request.getParameter("city");
    public String getconst()
    return request.getParameter("constituency");
    public String getrefno()
    return request.getParameter("refno");
    public String getdob()
    return request.getParameter("mergedage");
    public String getpic()
    //String a=request.getParameter("pic");
    //a=a.substring(a.lastIndexOf("/")+1);
    //System.out.print("Java path is "+a);     
    //Enumeration enum=request.getFileNames();
    //while(enum.hasMoreElements())
    //     String abc=(String)enum.nextElement();
    //     System.out.print("Java the path is "+abc);     
    return request.getParameter("pic");
    String votername1;
    //public void setScope()
    //request.setAttribute("votername1" ,voternameParam );
    //insertEntry.jsp
    <jsp:useBean id="logicbean" class="pack.logicbean" scope="request"/>
    <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
    <%@ page import="java.util.*,java.text.*" %>
    <%@ page import="com.oreilly.servlet.*" %>
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <!-- Perform the actions on the bean. -->
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <%
    try
    /* Set the request object.*/
    /* The request object is implicitly available in the JSP page.*/
    logicbean.setRequest(request);
    //MultiPartRequest mp=MultiPartRequest(request,"E:\Files");
    /* Insert the employee data into the database.*/
    logicbean.insertEntry();
    /* Run the query to retrieve the employee data from the database.*/
    //logicbean.runQueryInsert();
    catch (Exception e)
    System.out.println(e.getMessage());
    %>
    <HTML>
    <HEAD>
    <TITLE>
    Insert Record
    </TITLE>
    </HEAD>
    <BODY background="brown.bmp">
    <center><H2><%=session.getValue("ie.label")%>
    </H2>
    <font face = "Devanagari MT for IBM" size = +2>
    <b><%=session.getValue("ie.sd")%>|<%=session.getValue("ie.home")%></b>
    </font>
    </center>
    </BODY>
    </HTML>
    I have narrowed down the problem to the point where i understand that the "request.getParameter()" function for multipart is not able to understand or read UTF data properly. The out.println prints garbage from this function on the console. im using WAS
    plz help
    thanx in advance
    caffaine

    hi,
    To solve your problem Servlet Filters
    FILTER PROGRAM
    ===============
    package filters;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.UnavailableException;
    public class SetCharacterEncodingFilter implements Filter {
    // ----------------------------------------------------- Instance Variables
    * The default character encoding to set for requests that pass through
    * this filter.
    protected String encoding = null;
    * The filter configuration object we are associated with. If this value
    * is null, this filter instance is not currently configured.
    protected FilterConfig filterConfig = null;
    * Should a character encoding specified by the client be ignored?
    protected boolean ignore = true;
    // --------------------------------------------------------- Public Methods
    * Take this filter out of service.
    public void destroy() {
    this.encoding = null;
    this.filterConfig = null;
    * Select and set (if specified) the character encoding to be used to
    * interpret request parameters for this request.
    * @param request The servlet request we are processing
    * @param result The servlet response we are creating
    * @param chain The filter chain we are processing
    * @exception IOException if an input/output error occurs
    * @exception ServletException if a servlet error occurs
    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain)
         throws IOException, ServletException {
    // Conditionally select and set the character encoding to be used
    if (ignore || (request.getCharacterEncoding() == null)) {
    String encoding = selectEncoding(request);
    if (encoding != null)
    request.setCharacterEncoding(encoding);
         // Pass control on to the next filter
    chain.doFilter(request, response);
    * Place this filter into service.
    * @param filterConfig The filter configuration object
    public void init(FilterConfig filterConfig) throws ServletException {
         this.filterConfig = filterConfig;
    this.encoding = filterConfig.getInitParameter("encoding");
    String value = filterConfig.getInitParameter("ignore");
    if (value == null)
    this.ignore = true;
    else if (value.equalsIgnoreCase("true"))
    this.ignore = true;
    else if (value.equalsIgnoreCase("yes"))
    this.ignore = true;
    else
    this.ignore = false;
    // ------------------------------------------------------ Protected Methods
    * Select an appropriate character encoding to be used, based on the
    * characteristics of the current request and/or filter initialization
    * parameters. If no character encoding should be set, return
    * <code>null</code>.
    * <p>
    * The default implementation unconditionally returns the value configured
    * by the <strong>encoding</strong> initialization parameter for this
    * filter.
    * @param request The servlet request we are processing
    protected String selectEncoding(ServletRequest request) {
    return (this.encoding);
    web-xml entry
    +++++++++++
    <filter>     
         <filter-name>Set Character Encoding</filter-name>
    <filter-class>filters.SetCharacterEncodingFilter</filter-class>
              <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>Set Character Encoding</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>

  • Form data - to command - for verification - exec

    I'm attempting to assign entered form data into an array, to generate a list
    of command line commands from the form data, and pass the array to a
    verification page for display. After the displayed and verified information has
    been approved , press a submit button to spawn xterms that get passed the
    information in the array, the command list, for execution. I'm having a
    problems capturing and relaying the data between pages. Currently, the
    information(the command list being generated in variable ${myMap}) is
    being displayed correctly in the VerificationPage.jsp output but not displayed
    correctly (nothing from the ${myMap} variable is displayed)when
    ProcessingPage.jsp is loaded. I would appreciate any help offered. Below is
    the code I'm using.
    File one:
    data/form input
    File two: VerifcationPage.jsp - assign the consolidated command into myMap array and display it to screen
    <c:set scope="application" var="counter" value="0"/>
    <c:forEach var="rel" items="${paramValues.rel}" begin="0" step="1">
         ${myMap} bldautox ${param.phasecmd} -s ${param.submitter} -o r${paramValues.rel[counter]}${param.oldtreeext}${param.oldtreespin} -n r${paramValues.rel[counter]}${param.newtreeext}${param.newtreespin}
         <br>
         <c:set var="counter" value="${counter + 1}"/>
    </c:forEach>
         <br>
    <c:forEach items="${paramValues.myMap}" begin="0" step="1">
         <c:out value="${myMap[count]}" />
    </c:forEach>
         <input type="submit" name="submitbldreqs" value="Submit">
        </form>
    File three-the ProcessingPage.jsp - display each indice of myMap variable and be able to submit for command line execution
    <c:forEach var="myMap" items="${paramValues.myMap}" begin="0" step="1">
         <c:out value="${param.myMap[cntr]}" />
         <c:set var="cntr" value="${cntr + 1}"/>
    </c:forEach>
         <br>
         <% String cmd = "0"; %>
    <%-- Desired executable Runtime.getRuntime().exec("/usr/bin/xterm -e" + {myMap}[cntr]); --%>
         <% Runtime.getRuntime().exec("/usr/bin/xterm"); %>
      </body>

    You put newlines in by pressing the enter key a couple of times.
    see?
    For the rest of it, there is a big handy button with "code" labelled on it.
    [code[/i]]
    // put your code between tags like these.
    [code[/i]]
    That post is a completely unreadable mess. I suggest you try again.

  • Help fowarding data to a jsp page

    I know your not meant to double post but i was told it would be better if i post this message in here so:
    I am trying to create a bean that will connect to a database and bring back data depending on what a user typed into a html form. However i need some help, if the database does not find any data i want to send a message saying something like "no results" to a jsp page which then be displayed, if results are found i then want to pass on these results to another jsp page.
    My question is how would i pass on this data / message to a jsp page? Also if more then one piece of data is returned from the database how would i be able to make sure everything is sent to the jsp?

    In the above code a Servlet, a JavaBean, JDBC and everything else is combined into just one class. That is not how it is.
    A Servlet is a Servlet --- it is not a JavaBean ---- So create a dedicated class that is purely a Servlet and does what a Servlet is supposed to do. Taking the tutorial on Servlets will help you understand them better.
    A JavaBean is a JavaBean ---- it is not a Servlet --- Create a JavaBean class.
    Move the Database Connection code to the Data Access Layer --- this means create separate classes that are meant to only access data.
    It is better to learn each individual concept before attempting something more complex.
    Also build small code into your class, ---- understand what it's doing then compile it frequently.
    I'll give you hints on how you should properly implement an MVC pattern.
    JSP Page
    This page contains an HTML form , with form fields and a submit button.
    In the action attribute of the form you will specify the URL-pattern for the Servlet.
    The URL-pattern for the servlet will be defined in web.xml , for example
    <form action="/MyFirstServlet" method="post" >
    </form>Then create a Servlet , in its package , so for example
    com.myapp.servlet.MyFirstServlet.java
    Place the servlet file in a proper folder structure in the Java source folder.
    When the Servlet it compiled it needs to go under the corresponding folder structure under your applications /WEB-INF/classes/ folder.
    Your servlet will look something like this:
    package com.myapp.servlet.MyFirstServlet;
    //All import statements go here
    public class MyFirstServlet extends HttpServlet{
       public void doGet(HttpServletRequest request, HttpServletResponse response) throws ......... exceptions {
            doPost(request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ......... exceptions {
            //Process the request here
    request.getAttribute("someFormField");
    //similarly get all form fields
    //Store all fields into a JavaBean
    //Then call a method that saves the data to database
    saveToDatabase(pass the javabean here);
    private void saveToDatabase(SomeJavaBean someJavaBean){
        //Over here call a DataAccessObject -- DAO that saves the data
       // to the database.
    /WEB-INF/web.xml
    When you write a servlet you need to define it in web.xml and define a URL mapping also for it in web.xml
    JavaBean example
    com.myapp.beans.Person.java
    package com.myapp.beans.Person;
    //whatever import statements (if any) go here
    public class Person{
    private int age;
    private String firstName;
    public Person(){} //Every JavaBean must have a default constructor
    //Write the Getters and Setters for the private fields above.
    //in proper JavaBeans notation as follows
    public void setAge(int age){
      this.age = age;
    public int getAge(){
       return this.age;
    //Similarly write getter and setter for firstName
    }You would then use the above JavaBean to transport data between the database layer and JSP layer via the Servlet.
    If you are Saving to the Database , you read the HTML form's data and save it into one JavaBean and then pass the JavaBean to the database layer to be saved. In the Database layer you write JDBC code to save the data.
    If you are Reading from the database, you create an ArrayList of JavaBean objects in the database layer using JDBC code and then pass the ArrayList to the Servlet which stores it in the Request, then the servlet forwards control to the JSP which then reads the data from the request.
    Most of the above is pseudo code, it is just there to give you an idea about how do this properly in MVC --- you can then read tutorials on each of the above --- for example tutorial on Servlet, tutorial on JDBC, tutorial on Java Classes and then understand them more.

Maybe you are looking for

  • Can't get my Asus Xtion Pro Live to work

    I really hope there are some knowledgeable people for this problem on these forums. I just can't seem to get this device to work. This is the error I get upon trying to run any OpenNI stuff. One or more of the following nodes could not be enumerated:

  • PI 7.1 EHP1 Step Logical Ports error

    Hello, I got the below error when in ran the managed system configuration for PI 7.1 EHP1 system. Our solman is on SP22 Step Logical Ports Details A failure occured while creating the logical port for JAVA XI : An exception occurred that was not caug

  • Exchange Rate Type Problem

    Hi All, I have problem with Exchange rate conversion. The system is not picking correct Exchange rate in billing Invoice of FI from SD. The scenario is I have created Exchange rate type as Z and alternate currency type is FGE1. I created new one beca

  • Oracle Workflow

    Hello, We are planning to build workflow capability to our product. This product is written in C++ and uses Oracle 8i enterprise edition as database. One of the option is to use oracles existing workflow engine as the base and build over that. I had

  • How to track WCM Operaional WCD changes

    Hello,   We are in stage of implementation of Work clearance Management (WCM). There is requirement to track change history of operational WCD attached to isolation application. Maintenance person proposes isolation and operations person prepares the