Problems with Submitting the form

Hey Guys,
I have a form with 7 different fields. my form is connected with the database. once the user fills out the information and clicks on submit the entry should be saved in the database.
Everything is working fine. i can establish connection with the database. my only problem is that when i click on submit its not adding the entry in the database. I think i have problems with this command
<form method = "post" > . Any helpo will be really appreciated. I am posting some part of the code.
<%!
  public void jspInit() {
    try {
      Class.forName("org.apache.derby.jdbc.ClientDriver");
      System.out.println("JDBC driver loaded");
    catch (ClassNotFoundException e) {
      System.out.println(e.toString());
<body>
<%
String name, unit, title, supervisor, region, dept, date;
%>
<p align="center"><b><font size="5" face="Arial">LOGIN REQUEST FORM </font></b>
<form method="POST">
<p align="left"><b><font size="2">                           
     </b>Name:<b> <input type="text" name="name" size="20">   </b>Title   <b>
     <input type="text" name="title" size="20">         </b> Dept <b>         
     <input type="text" name="dept" size="20"></b></font></p>
     <p align="left"><font size="2"><b>                 
     </b>Supervisor: <b> <input type="text" name="supervisor" size="20"> </b>Region<b> 
     <input type="text" name="region" size="20">  </b>Business Unit<b>
     <input type="text" name="unit" size="20"></b></font></p>
     <p align="left"><font size="2"><b>              </b>
     Effective Date:<b> <input type="text" name="date" size="20"></b></font></p>
     <input type = "reset">
     <input type = "submit">
     <%
     name = request.getParameter("name");
     unit = request.getParameter("unit");
     title = request.getParameter("title");
     supervisor = request.getParameter("supervisor");
     region = request.getParameter("region");
     dept = request.getParameter("dept");
     date = request.getParameter("date");
     boolean error = false;
     String message = null;
     try {
          Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/sample");
          System.out.println("Connection Established");
          Statement s = con.createStatement();
          String sql = "SELECT name FROM users" +
          "WHERE name='" + name + "'";
          ResultSet rs = s.executeQuery(sql);
          if(rs.next()) {
               rs.close();
               message = "The username <B>" + encodeHtmlTag(name) + "</B> has already been taken. Please select another name.";
               error = true;
          else {
               rs.close();
               sql = "INSERT INTO user" +
               "(name, unit, title, supervisor, region, dept, date)" +
               "VALUES" +
               "('" + name + "'," + " '" + unit + "'," + " '" + title + "'," + " '" + supervisor + "',"
               + " '" + region + "'," + " '" + dept + "'," + " '" + date + "')";
               int i = s.executeUpdate(sql);
               if(i==1) {
                    message = "User Added";
          s.close();
          con.close();
     catch(SQLException e) {
          message = "Error " + e.toString();
     catch(Exception e) {
          message = "Error" + e.toString();
          error = true;
     %>
</form>
</body>
</html>

Even if there was an exception being thrown, you wouldn't see it because you're catching it but not doing anything with the message:
catch(SQLException e) {
          message = "Error " + e.toString();
     catch(Exception e) {
          message = "Error" + e.toString();
          error = true;
     }Try changing this part to:
catch(SQLException e) {
          message = "Error " + e.toString();
                e.printStackTrace();
     catch(Exception e) {
          message = "Error" + e.toString();
          error = true;
                e.printStackTrace();
     }

Similar Messages

  • Problem in submiting the form onchange of html:select

    I am using WSAD 5.0 and working on a small application with struts.
    I have following code where I want to submit the form if user selects any option from the list. Problem is when i select any option it is giving error that this property is not supported. Following is my code
    <html:form action="/NewUserAction1">
    <tr>
                   <td>
                        <font color="Blue">
                             <b><bean:message key="NewUser1.CountryName" /></b>
                        </font>*
                   </td>
                   <td>
                        <html:select property="state" onchange="submit();">
                             <html:option value="default">select state</html:option>
                             <html:option value="bangalore">Bangalore</html:option>
                             <html:option value="delhi">Delhi</html:option>
                        </html:select>
                   </td>
              </tr>
         </html:form>
    Please help me someone why i am not able to submit the form on onchange event of <html:select>
    Thanks.

    I got the solution :)
    Finally I figured out that
    by default, struts gives <html:submit/> tags a name of
    "submit". Thus there was a namespace collision in the
    form object, with the submit button overriding the
    form's submit method. I fixed the problem by changing
    the name of the submit button. Something like this
    works great:
    <html:submit property="submitPage">
                        <bean:message key="NewUse1.Submit"/>
                   </html:submit></td>
    Now i am able to submit the form.
    Thanks alot.

  • Problems with generating the form

    Hi there,
    I'm trying to create an interactive form for print in ABAP. So, I created an interface and a form. I've generated the interface, it worked properly. So i've checked the syntax of the form, there was no error and i clicked the button to generate it. Although there's no error, it stays inactive, that's the first problem.
    The second problem ist the menu-tree. Expanding the node of my inactive form, there's another node 'used interface' and under it appears another node with my inactive form. This funny behaviour doesn't stop, and i assume it's a GUI problem, but i'm not sure.
    Do you have any ideas to solve my problems.
    thanks a lot, greetings, Stefan

    Hi Stefan
    also, have a look at this post ADS: unable to activate a new adobe form where the issue was that the ADS is not even installed and configured. To go through all teh right steps, get the ADS Configuration Guide from the Service Marketplace at http://service.sap.com/adobe -> Media Library -> Documentation.
    Best regards,
    Markus

  • Problem with filling the forms in Nokia browser af...

    Hello,
     I updated my Nokia 808 to FP2 successfuly. But i realized one problem in web browser and the new keyboard. For example when i want to write into a form box i can only see virtual keyboard. I cannot see what i type. If you want to test this, please open your local nokia website and click on support / e mail us. You will see a form which will ask your phone model and OS etc. Try to type into the boxes. Yesterday i failed to write anything. Also reaction is very slow. You can see what i m talking about in the attachments.
      Also with the new update, videos are not working correctly. Sometimes video player is crashing. Sometimes i see strange and colourful images while it is trying to play the video. Then it turns to normal and i see the video clearly.
      Im satisfied with some new things in the update but there are problems and slow downs. Some features are not working such as Nokia Social. I hope Nokia Team will find a solution. Thank you.
    Attachments:
    Fotoğraf0001.jpg ‏183 KB
    Fotoğraf0150.jpg ‏179 KB

    HI ilkerol,
    Welcome to Nokia Support Discussions!
    Thanks for the feedback! I tested the support form with the same results, the page was slow and kept on moving up to the top when I was typing in the textbox.  I tried it with a Lumia device, and even though I was able to fill the textbox without problems, the drop down menus did not work. Based on that experience, it seems that the form is meant to be used with a personal computer, not a mobile device. I will, however, escalate this issue in case there is a possibility of a quick fix. 
    As for the video issue, does this happen with all videos or just certain ones? Colorful images etc. usually mean that the video file encoding is somehow broken and the player cannot read it properly.
    Hope this helps!
    Puigchild
    If you find this post helpful, a click upon the white star at bottom would always be appreciated.
    If it also solves your problem, clicking ACCEPT AS SOLUTION below it will benefit other users!

  • Problems with Submitting a Adobe Livecycle Designer 8.0 created Form after Update to Adobe Prof. 8.1

    Hi folks,
    can someone tell me, which problem is it? Forms created in Livecycle Designer 8.0 with Adobe Prof. 8.0 don't have problem with submitting, but with Adobe Prof. 8.1.
    Thanks for help or information in adv!

    Hello Mr Aandi Inston,
    thanks for your quick answer! My problem is the following: The functionality email submitting in Livecycle 8.0 created form under Adobe Prof. 8.1 is malfunction when you open the form in Adobe Reader 8.x. There are non error messages to able to locate the problem. When you click the submit button, nothing is happen. Forms created before update adobe prof. 8.0 to 8.1 didn't have problem like this.
    Normally, after clicking submit button ms outlook popup with suitable subject, attachment and so on. Executing the form in Adobe Prof. you wont have problem to submit form per email. Now I suppose that this problem is caused by updating???
    Why do I claim it? After failed testing the modified form based on dynamic interactive template form "Purchase Order.pdf" from Designer 8.0 under different windows os and ms office versions I tried to test the above-named template, the same problem you will get: email submitting is malfunction!
    I hope, my description will be detailed enough to you and I'm glad to hearing from you soon!

  • Hi.  I purchased Adobe Acrobat Xi Pro from a store (card).  I submitted the number (under the scratch area on the card) on the adobe website, with my personal details etc.  When I submitted the form, I got an error message:  413 header length too large (a

    Hi.  I purchased Adobe Acrobat Xi Pro from a store (card).  I submitted the number (under the scratch area on the card) on the adobe website, with my personal details etc.  When I submitted the form, I got an error message:  413 header length too large (and on top the page reads JRun Servelet Error).  What does this mean? What should I do next?

    Hi.  I purchased Adobe Acrobat Xi Pro from a store (card).  I submitted the number (under the scratch area on the card) on the adobe website, with my personal details etc.  When I submitted the form, I got an error message:  413 header length too large (and on top the page reads JRun Servelet Error).  What does this mean? What should I do next?

  • How to Save State on an Entry Form prior to Submitting the Form?

    I want to be able to save the values the user enters to fields on the entry form if they navigate away from the page and come back (without the user clicking the submit button for the form.) For example, one of the input fields has a goLink to go to another page to lookup a field value - when the user returns from the page, all other form field values are cleared. If the user does submit the form by clicking the command button, then all form field values are saved (if the user navigates from the page and comes back, all values are retained.) What I'm trying to do then is somehow save the values (passivate the state) for the field the user has filled in when the user navigates from the page without submitting the form. Any suggestions?
    I am using a read-only View Object with all transient values. The VO is configured to passivate state including all transient values. The initial row is created programmatically; there will only be one row for the VO used as an entry form. I am not using a backing bean for the values and would prefer not to use one, but would rather use the VO's capability to passivate state to save the data values. The question then seems to be how to force the VO to passivate state prior to the form being submitted.
    thanks
    Message was edited by:
    javaX

    "My hunch is that the real problem is that the fields are not being set into the bindings due to the use of immediate="true"."
    Yes. Now I see that is the real problem. Is there anyway to force setting the bindings from the input form field values if the user navigates from the page using a goLink, or commandButton with immediate="true" other than overriding the default FacesPageLifecycle classes?
    I'd prefer not to have to do that unless necessary, and, if I over-ride that method, then how could I get it to work normally when the user presses the commandButton at the end of the form and I do want all validation checks to be performed (immediate=false for the form's submit button; immediate=true only for lookup commandButtons used for certain fields)?
    Here's an overview of how I set the page up:
    1. create transient view object; all attributes marked as always updateable; passivate state=true for VO and all transient values; no key id field selected (will only ever be one row - just using VO to save values that will eventually be used to do an insert to the database);
    2. transient VO added to Application Module
    3. Add data control to .jspx page as an ADF Form (not an ADF Creation Form)
    4. Add code to AM to create the initial row for the input form
    protected void prepareSession(Session session) {
    super.prepareSession(session);
    insertTransientViewObjRows();
    private void insertTransientViewObjRows() {
    ViewObject transientvo = getViewObj1();
    transientvo.clearCache();
    transientvo.insertRow(transientvo.createRow());
    --- Entry Form .jspx pagedef.xml snippet ---
    <executables>
    <iterator id="MyIterator" RangeSize="10" Binds="MyView"
    DataControl="AMDataControl"/>
    </executables>
    <bindings>
    <attributeValues id="sponsorid" IterBinding="MyIterator">
    <AttrNames>
    <Item Value="sponsorid"/>
    </AttrNames>
    </attributeValues>
    --- Entry Form .jspx page snippet ---
    <h:form>
    <af:panelForm>
    <af:panelLabelAndMessage label="#{bindings.sponsorid.label}">
    <af:panelGroup layout="horizontal">
    <af:inputText value="#{bindings.sponsorid.inputValue}"/>
    // state will not be saved for other form field values if use immediate="true" when temporarily navigate away from page and return; don't want to validate other form fields here
    <af:commandButton text="Lookup Details"
    action="lookup-page" immediate="true"/>
    </af:panelGroup>
    </af:panelLabelAndMessage>....
    // state will be saved with immediate="false" when user submit forms at end of entry (need to perform validation of form's required fields here)
    <af:commandButton text="Continue to Next Step" immediate="false"
    action="nextpage"/>
    Message was edited by:
    javaX

  • Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Here is one solution:
    // mouse up action for submit button;
    function GetField(cName) {
    // get field object for cName field with error checking;
    var oField = this.getField(cName);
    if(oField == null) app.alert("Error accessing field named " + cName + "\nPleae verigy field name, spelling and capitalizeation.", 1, 0);
    return oField;
    } // end GetField function;
    var oPhone = GetField("phone");
    oPhone.required = oPhone.value == oPhone.defaultValue;
    var oEmail = GetField("email");
    oEmail.required = oEmail.value == oEmail.defaultValue;
    if(oPhone.required && oEmail.required) {
    app.alert("Missing required fields.", 1, 0);
    } else {
    app.alert("Submitting form", 3, 0);
    // additional code for submission;

  • Problem with navagation of forms

    Hi everybody
    I have a problem with navigation of forms
    I have two forms say a and b.In form a i have a button and i want, when i press that button the form b should open.I wrote when_button_pressed trigger for that button in form a as open_form('b'); Raise form_trigger_failure;
    When i run form a and press the button form b is not opening.It is giving me a message as 'form b cannot be opened'
    Can somebody tell me where i am wrong.I have compiled b.
    TIA
    Prajakta

    Why are you using Raise form_trigger_failure;
    You don't need it.
    Try doing open_form('b.fmx');
    If this doesnt work
    I think your problem is that the fmx file for form b is not in the path to be found.
    make sure to include the direcoty in the forms60_path or have it in the same directory as form a.

  • Very big problem with JSF about FORM and "id=" for HTML form's elements and

    I have discovered a very big problem with JSF about FORM and "id=" for HTML form's elements and java instruction "request.getParameterNames()".
    Suppose you have something like this, to render some datas form a Java Beans :
    <h:dataTable value="#{TablesDb2Bean.myDataDb2ListSelection}" var="current" border="2" width="50%" cellpadding="2" cellspacing="2" style="text-align: center">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:outputText id="nameTableDb2" value="#{current.db2_name_table}"/>
    </h:column>
    </h:dataTable>
    Everything works fine...
    Suppose you want to get the name/value pairs for id="nameTableDb2" and #{current.db2_name_table} to process them in a servlet. Here is the HTML generated :
    <td><span <span class="attribute-name">id=<span class="attribute-value">"j_id_jsp_1715189495_22:0:nameTableDb2">my-table-db2-xxxxx</span></td>
    You think you can use the java instructions :
    Enumeration NamesParam = request.getParameterNames();
    while (NomsParam.hasMoreElements()) {
    String NameParam = (String) NamesParam.nextElement();
    out.println("<h4>"++NameParam+ "+</h4>);
    YOU ARE WRONG : request.getParameterNames() wants the syntax *name="nameTableDb2" but JSF must use id="nameTableDb2" for "<h:outputText"... So, you can't process datas in a FORM generated with JSF in a Servlet ! Perhaps I have made an error, but really, I wonder which ?
    Edited by: ungars on Jul 18, 2010 12:43 AM
    Edited by: ungars on Jul 18, 2010 12:45 AM

    While I certainly appreciate ejb's helpful responses, this thread shows up a difference in perspective between how I read the forum and how others do. Author ejb is correct in advising you to stay inside JSF for form processing if form processing is what you want to do.
    However, I detect another aspect to this post which reminds me of something Marc Andreesen once said when he was trying to get Netscape off the ground: "there's no such thing as bad HTML."
    In this case, I interpret ungar's request as a new feature request. Can I phrase it like this?
    "Wouldn't it be nice if I could render my nice form with JSF but, in certain cases, when I REALLY know what I'm doing" just post out to a separate servlet? I know that in this case I'll be missing out on all the nice validation, conversion, l10n, i18n, ajax, portlet and other features provided by JSF".
    If this is the case, because it really misses the point of JSF, we don't allow it, but we do have an issue filed for it
    https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=127
    If you can't wait for it to be fixed, you could decorate the FormRenderer to fix what you want.
    I have an example in my JSF book that shows how to do this decoration. http://bit.ly/edburnsjsf2
    Ed

  • How to trigger a value change listener in JSF without submitting the form

    hi friends,
    I have a JSF Page which contains a check box and a text box.
    I made the text box property as readonly.
    when i click the check box , i want to make my text box as editable.
    i achieved the above task by submitting the whole form when i click the check box.
    i want to acheive the same functionality with out submitting the form.
    In one of the references it is stated that "Value-changed handlers are executed if the page is submitted and the value of the component has changed."
    hope you got the question.
    please let me know, if you know the answer.

    Hi,
    If at all you dont want to submit the form and wanna reflect same form's field(s) as per the change in drop-down/check-box,
    you can simply achive it using traditional way of 'JavaScript'.
    For that you may typically give <h:form> tag any specific id say
    <h:form id="myForm"> and for dropdown/checkbox also you may give id say
    <h:selectBooleanCheckbox id="group" onchange="javascript:reflectChangedValue();"  ... >
    </h:selectBooleanCheckbox>and in the same JSP you can write any JS function say reflectChangedValue() as
    function reflectChangedValue()  {
         var formPrefix  = "myForm:";
         var groupId = formPrefix + "group";
         var value = document.getElementById(groupId).value;
          if(value) {
               // enale textbox here
          } else {
               // disable textbox here
    }For formPrefix and groupId, f you are having any doubts, you can refer to 'view source' from the browser,
    generated HTML of the working JSP.

  • I am getting weary of my iPhone 4s. the battery life is non-existent, second, i had problems with calls, the caller couldn't hear me and now it cannot detect internet networks. Be they wi-fi or cellular. what could be the problem.

    I am getting weary of my iPhone 4s. The battery life is non-existent, secondly, I had problems with calls, the caller couldn't hear me and now it cannot detect internet networks. Be they Wi-Fi or cellular. what could be the problem?

    Mullaly75 wrote:
    I assume u guys don't understand what open source software is
    Yes, I think most of us do understand what open source software is. It sounds as if you don't. Here's some information:
    Open-source software (OSS) is computer software that is available in source code form: the source code and certain other rights normally reserved forcopyright holders are provided under an open-source license that permits users to study, change, improve and at times also to distribute the software.
    Open source software is very often developed in a public, collaborative manner. Open-source software is the most prominent example of open-sourcedevelopment and often compared to (technically defined) user-generated content or (legally defined) open content movements.
    from http://en.wikipedia.org/wiki/Open_source_software
    Yes, Tom Wu of Stanford wrote a paper on something called Secure Remote Access Protocol. It's a form of Asymetric Key Exchange and has nothing to do with hacking anything. It's actually intended to protect data.

  • I have problems with buttons and Forms in my trial proof of Indesign CC, how can I fix it?

    I have problems with buttons and Forms in my trial proof of Indesign CC, how can I fix it?

    Moved to InDesign forum.
    You can start by telling us what the problem is.

  • Problems with software the update with Nokia 6233

    Problems with software the update with Nokia 6233
    Hello,
    I have so far some-paints tries my software to update.
    Each time the update procedure begins, sometime stands then on the telephone “test mode”.
    On the computer wars I the reference in the update manager “connection to the telephone broken off” and wants the update to again start.
    If I change my profile attitudes since that for example, then after a telephone restart again deleted.
    What there can I make?
    GreetingsMessage Edited by adisaily on 24-Aug-2007 09:03 AM

    It sounds like your 5800 has the earpiece fault that was common with 5800's made before February.
    You need to take it to a nokia care point for repair under warranty.
    Care points/service centres and repair info:
    UK • Europe • Asia-Pacific • USA •
    Canada • Middle East and Africa
    Elsewhere: Click here, select your country, go to the support section, then select repair.

  • Error"There was an internal error when submitting the form" URM Disposition

    Hello
    I get the following error - "*There was an internal error when submitting the form*" - when i allocate a Retention Disposition to a Retention Category.
    Any Ideas how this can be solved?
    Thank you

    Not based on the minimal information provided.
    Error messages in 11g, from a UI standpoint, are severely deficient. How about looking in the content server logs and posting some more information?

Maybe you are looking for

  • Iphoto wont open it says im using an old version

    new mac pro. i used my time macine to go from the old computer...iphoto will not open. it says im using an older version...i only have 1. only option is to quit.

  • Confirmation TO  IDOC WMTCID03

    Hi , This IDOC is used for confirmation that comes from external syste. SAP confirms the TO in the background. SAP confirms that based on the function module.. my question is what are minimum fields that SAP should have inorder to confirm the Transfe

  • How can you assign user 1 to org 1 and user 2 to org 2. (Reports)

    if i use user 1 and user 2 for org 1 and org 2 respectively. I want user 1 can see the data of org 1 only not org 2 and same for user 2 can see the data for org 2 only how i can do this in reports. Now suppose you have 200 user and org then how you h

  • Invalidate navigation

    Hi, Situation: In our BSP framework to each generated page we add a piece of javascript wich will check the input value on specified inputfields. If the user fills in an exceptional amount we generate a popup (GetVBMessageBox) which warns him/her abo

  • Can't start Dreamweaver from desktop shortcut

    Dreamweaver starts normally when I right click on an html file, and choose "Open With." However, when I try to start Dreamweaver by clicking on the desktop shortcut, I see a Windows installer window with the message "Please wait while Windows configu