Jsp rorm submitted twice problem

Hi all,
I have developed a application using jsp. And I am facing problem in submitting the form. When i click the submit button(only once) i am calling a java script to submit to next jsp. But the request sent twice to the servlet engine for a single click. How to avoid this.
Please help me to eliminate this twice form submit.
I am attaching my code to understand where the problem--
<PRE>
<FORM NAME="ECRDurationUserData" onSubmit="processSubmit()">
<INPUT type=SUBMIT value="Generate Report" name="generateReport" Title="Select Parameters for Generating Report, then Click..>">
<script LANGUAGE="JavaScript">
<!--
function processSubmit()
     document.ECRDurationUserData.action="<%=codebase%>/ext/reports/outputforms/ecrdurresult.jsp";
          document.ECRDurationUserData.method="POST";
          document.ECRDurationUserData.submit();
-->
</SCRIPT>
</PRE>

When you click the submit button (type="submit"), it submits the form. Then your processSubmit function is also submitting the form. It's not a good idea to submit the form via a script, at least in this case. The processSubmit function should return a boolean to tell the form to submit...
<FORM NAME="ECRDurationUserData" onSubmit="return processSubmit();">
<INPUT type=SUBMIT value="Generate Report" name="generateReport" Title="Select Parameters for Generating Report, then Click..>">
<script LANGUAGE="JavaScript">
<!--
function processSubmit() {
   document.ECRDurationUserData.action="<%=codebase%>/ext/reports/outputforms/ecrdurresult.jsp";
   document.ECRDurationUserData.method="POST";
   return true;
-->
</SCRIPT>And unless you are doing something special in processSubmit to set the action and method for the form dynamically based on other form selections, you should be just doing this:
<FORM NAME="ECRDurationUserData" method="POST" action="<%=codebase%>/ext/reports/outputforms/ecrdurresult.jsp" >
<INPUT type=SUBMIT value="Generate Report" name="generateReport" Title="Select Parameters for Generating Report, then Click..>">But I assume you are actually going to change the form action based on other form field selections.

Similar Messages

  • In a JSP Page, onclick of submit, it is submitting twice.

    Hello! everybody...
    Please help me.. its urgent!
    I have a jsp page, after i enter values in textboxes and click on submit, i am calling a javascript function wherein i am submitting the form.
    The problem is, it is submitting twice and inserting the record in the database twice.
    here is my code.
    anybody pls let me know where the problem is?
    Thanks in advance.
    /*Javascript Function for onsubmit*/
    function addVersion()
                             alert('hi');
                             this.VersionDynaForm.action = "./Version.do?param=add";
                             this.VersionDynaForm.submit();
    <html:form action="/Version.do" styleId="VersionDynaForm" onsubmit= "return addVersion()">
    <input type="hidden" name="actionType" value="">
         <table cellspacing=0 cellpadding=2 border=0 class="table_view" id="TABLE3" >
              <tr class="table_data">
                        <td class="smalltext" width="200px" align="left"><b>Year<span style="color:Red;">*</span></b></td>
                        <td width="150px">
                        <select id="FLP_YEAR" name="FLP_YEAR" class="mediumtext" style="width:120px; height:30px" onchange="FLP_YEARChanged()">
                        <option value="">Select</option>
                             <%
                             ArrayList year = new ArrayList<Version>();
                             year = (ArrayList)session.getAttribute("years");
                             if(year!=null)
                        for(int i=0;i<year.size();i++){                                 
                             Version temp1 = (Version)year.get(i);
                             if(temp1.getFLP_YEAR().equals(Element6)){
         %>
              <OPTION selected value='<%=temp1.getFLP_YEAR()%>'><%=temp1.getFLP_YEAR()%></OPTION>
                        <%}
                             else{%>
                             <OPTION value='<%=temp1.getFLP_YEAR()%>'><%=temp1.getFLP_YEAR()%></OPTION>
                        <%}
                        %>
                        </select>
                   </td>
                   <td width="150px"></td>
                   <td width="200px"></td>
                   <td width="200px"></td>     
                   <td width="150px"></td>
                   <td width="150px"></td>
                        <td width="200px"></td>
         </tr>
         <tr class="table_data">
                        <td class="smalltext" width="200px" align="left"><b>Business Line<span style="color:Red;">*</span></b></td>
                        <td widht="150px">
                        <select id="LPA_BUSINESS_LINES" name="LPA_BUSINESS_LINES" class="mediumtext" style="width:120px; height:30px" onchange="alert('hi');testChanged()">
                        <option value="">Select</option>
                             <%
                             ArrayList lst1 = new ArrayList<Version>();
                             lst1 = (ArrayList)session.getAttribute("mnemonic1");
                             if(lst1!=null)
                        for(int i=0;i<lst1.size();i++){                                 
                             Version temp1 = (Version)lst1.get(i);
                             if(temp1.getLPA_BUSINESS_LINES().equals(Element1)){
         %>
              <OPTION selected value='<%=temp1.getLPA_BUSINESS_LINES()%>'> <%=temp1.getLPA_BUSINESS_LINES()%></OPTION>
                        <%}
                             else{%>
                             <OPTION value='<%=temp1.getLPA_BUSINESS_LINES()%>'> <%=temp1.getLPA_BUSINESS_LINES()%></OPTION>
                        <%}
                        %>
                        </select>
                   </td>
                   <td width="150px"></td>
                   <td width="200px"></td>
                   <td width="200px"></td>     
                   <td width="150px"></td>
                   <td width="150px"></td>
                        <td width="200px"></td>
         </tr>
         <tr class="table_data" align="left">
                        <td class="smalltext" width="200px" align="left"><b>RC Number<span style="color:Red;">*</span></b></td>
                        <td width="150px">
                        <select id="LPA_RC_NUMBER" name="LPA_RC_NUMBER" class="mediumtext" style="width:120px; height:30px" onchange="LPA_RC_NUMBERChanged()">
                        <option value="">Select</option>
                             <%
                             ArrayList lst2 = new ArrayList<Version>();
                             lst2 = (ArrayList)session.getAttribute("rcmnemonic");
                             if(lst2!=null && Element2!=null)
                        for(int i=0;i<lst2.size();i++){                                 
                             Version temp2 = (Version)lst2.get(i);
                                  if(temp2.getLPA_RC_NUMBER().equals(Element2)){
         %>
              <OPTION selected value='<%=temp2.getLPA_RC_NUMBER()%>'> <%=temp2.getLPA_RC_NUMBER()%></OPTION>
                        <%}
                             else{%>
                             <OPTION value='<%=temp2.getLPA_RC_NUMBER()%>'> <%=temp2.getLPA_RC_NUMBER()%></OPTION>
                        <%}
                        %>
                        </select>
                        </td>
                        <td class="smalltext" width="200px" align="left"><b>Version<span style="color:Red;">*</span></b></td>
                        <td width="150px">
                        <select id="LPA_VERSION_ID" name="LPA_VERSION_ID" class="mediumtext" style="width:120px; height:30px" onchange="LPA_VERSION_IDChanged()">
                        <option value="">Select</option>
                             <%
                             ArrayList ver = new ArrayList<Version>();
                             ver = (ArrayList)session.getAttribute("version");
                             if(ver!=null && Element5!=null)
                        for(int i=0;i<ver.size();i++){                                 
                             Version temp3 = (Version)ver.get(i);
                                  if(temp3.getLPA_VERSION_ID().equals(Element5)){
         %>
              <OPTION selected value='<%=temp3.getLPA_VERSION_ID()%>'> <%=temp3.getLPA_VERSION_NO()%></OPTION>
                        <%}
                             else{%>
                             <OPTION value='<%=temp3.getLPA_VERSION_ID()%>'> <%=temp3.getLPA_VERSION_NO()%></OPTION>
                        <%}
                        %>
                        </select>
                        </td>
                   <td width="150px"></td>
                   <td width="200px"></td>
                   <td width="200px"></td>     
                   <td width="150px"></td>
         </tr>
         <tr class="table_data" >
                   <td class="smalltext" width="200px" align="left"><b>Project<span style="color:Red;">*</span></b></td>
                        <td width="150px">
                        <select id="LPA_PROJECT_NAME" name="LPA_PROJECT_NAME" class="mediumtext" style="width:120px; height:30px" onchange="LPA_PROJECT_NAMEChanged()">
                        <option value="">Select</option>
                             <%
                             ArrayList lst3 = new ArrayList<Version>();
                             lst3 = (ArrayList)session.getAttribute("project");
                             if(lst3!=null && Element3!=null)
                        for(int i=0;i<lst3.size();i++){                                 
                             Version temp2 = (Version)lst3.get(i);
                                  if(temp2.getLPA_PROJECT_NAME().equals(Element3)){
         %>
              <OPTION selected value='<%=temp2.getLPA_PROJECT_NAME()%>'> <%=temp2.getLPA_PROJECT_NAME()%></OPTION>
                        <%}
                             else{%>
                             <OPTION value='<%=temp2.getLPA_PROJECT_NAME()%>'> <%=temp2.getLPA_PROJECT_NAME()%></OPTION>
                        <%}
                        %>
                        </select>
                   </td>     
                   <td align="left" class="smalltext" width="150px"><b>Version Name</b><span style="color:Red;">*</span></td>
                   <td><input type="text" class="smalltext" property="LPA_VERSION_NAME" name="LPA_VERSION_NAME" value="" maxlength="30"/></td>
                   <td width="150px"></td>
                   <td width="200px"></td>
                   <td width="200px"></td>     
                   <td width="200px"></td>
         </tr>     
    </table>          
    <table cellspacing=0 cellpadding=2 border=0 class="table_input" id="TABLE2" >     
              <tr class="table_input">
                   <td height="10px" colspan="5" class="table_top_td" align = "right" >
                   <INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="submit" value="NewVersion" class="btn" >
                   <INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="button" value="Update" class="btn" name="method" onclick="javascript:return updateFunction();">
                   <INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="button" value=Cancel class="btn" name="method" onclick="history.go(-1)" >
                   </td>
              </tr>
    </table>

    hi
    change the type="button" in the following line
    <INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="submit" value="NewVersion" class="btn" >
    and call the javascript function on onClick in above line and dont call it from form(tat u hav done), remove it from form
    then it wont submit twice
    -venkat

  • Form Submits twice with IE

    Hi, my problem is that my form is submitted twice when using IE 7, but only once on firefox as desired. The steps my jsp app takes are:
    1. submit details
    2. validate details
    3. submit details to database
    4. faces-config navigates to appropriate download page and starts download
    The second submit happens when the user clicks on the IE warning bar that allows the download. I'm using <h:commandButton id="submit" value="Submit" action="#{userInfoBean.submit}" />
    All help is appreciated.

    I have the smae issue!!

  • Page hangs and submits twice

    I have page which has three on-submit processes. All of the processes call stored procedures. One of the process takes over 6 to 8 minutes and causes the page to hang and then times out, i.e. instead of showing the next page, I see "page cannot be displayed" message. Moreover, it seems that page has been submitted twice. The other strange thing is that stored procedures called by the page processes finish successfully even though the user do not go to the next page to see the results of the work accomplished by these store procedures.
    I have tried this experiment with a simpler page with one submit button which invokes one long running process when pressed. It seems when page hangs it submits again. I can attest this as there is a row being inserted by the stored procedure called by the on-sumbit process. I see this row being submitted twice with a time span of approximately 5 minutes (there is column for create_date and create_user).
    I have seen suggestions for using dbms_job for long running process, but this operation has to be done synchronously and user needs to see the results of the process on the next page. If the job is done asynchronously, then how can I refresh the hanging page and take the user to the result page.
    TIA,
    Salman

    Salman,
    There is an Apache timeout directive that you can increase, which should solve both problems. It looks like after the timeout the request is being retried, which may be the result of a different Apache directive. The access and error logs should show you some useful information about these cases. Some other reader might offer what those directives are, I'm not sure.
    That you are seeing the page processes complete even though the HTTP request times out is not strange. Once the server-side code is invoked, the request timeout cannot stop it.
    Scott

  • When submitting form, form elements like text box are not available in my action page. This occurs only for several times. if i resubmit the form, i can get the form elements in my action page. May be form get submitted twice in firefox 3.6.13

    I have a simple web page with two form elements say, two text box and submit button. when submitting my form, i didn't get the form data in my action page. This occurs only in Firefox 3.6.13 several times. Not always.
    May be form get submitted twice?
    Note: Remember, i am not facing this issue. However my friend is facing this issue.

    I have a simple web page with two form elements say, two text box and submit button. when submitting my form, i didn't get the form data in my action page. This occurs only in Firefox 3.6.13 several times. Not always.
    May be form get submitted twice?
    Note: Remember, i am not facing this issue. However my friend is facing this issue.

  • Forwarding JSP page through requestdispatcher problem in submiting form

    Hello everyone,
    I am very much new to servlet.
    My problem is somewhat this....
    when i am forwarding one JSP page by requestdispather , there is no problem.But after that when i am trying to submit one html form written inside the jsp page , the request is not submiting the jsp page rather it resides in the servlet.
    The code in servlet is
    RequestDispatcher rd =getServletContext().getRequestDispatcher("/applyConfirm.jsp");
    rd.forward(request,response);
    Now in (applyConfirm.jsp )jsp page one button is there , so when i will click that button the page has to be submitted.But its not submitting rather the request resides in the servlet.
    Dose someone will have any idea.
    Thanks in advance

    First check what sort of button you are using. It should be of "submit" type.
    Check the URL to witch URL it is submitting i.e. Action property in <FORM> tag.
    Make sure for the URLs in the client i.e HTML ex: href, action, and so on use the thumb rule of prefixing "<%=request.getContextPath()%>/" in your JSP or in servlet add it in the java code.
    This should solve the relative URL reference problem.
    Hope this helps.
    Cheers.

  • Sprint -- Form being submitted twice, IE only.

    Up front I'll state that this probably has nothing to do with Java, but I'll throw it out here just in case.
    On a particular page, when we put 19 or more items into a list in a form, when we submit that form, the onSubmit method of our subclass of org.springframework.web.servlet.mvc.SimpleFormController is getting called twice.
    This happens in IE, but not in Opera or Firefox.
    Because of the browser-specific nature of this problem, I'm pretty sure it's not related to Java, but if anybody has seen something like this before or has an idea where to start looking, I'd be very appreciative.
    This stuff was developed before my time, and I just started looking at it, so I'm not very familiar with it. It uses javascript, freemarker, and spring, none of which I'm familiar with. The only detail I've found for sure is that onSubmit is being called twice, and I'm a bit buggered as to where to look now.
    Thanks,
    Jeff

    Do the forms get submitted by using a javascript call to form.submit()?
    And is that javascript function called from an onclick event on an input type="submit"?
    That can (and does) result in a double submit in IE.
    It does not in firefox.
    Heres a quick jsp page that demonstrates this:
    <%! int count = 0; %>
    <html>
    <% System.out.println("Running..." + count++ + "Browser = " + request.getHeader("user-agent")); %>
    <script>
      function doStuff(button){
                     // submit via javascript
           button.form.submit();
    </script>
    <form>
      <input type="text" name="a1"/>
      <input type="text" name="a2"/>
      <input type="submit" onclick="doStuff(this)"/>
    </form>
    </html>This triggers two submits
    - one for calling form.submit();
    - one for pressing the submit button.
    To fix - remove/cancel one of the submission events, any of the following should work:
    - change the <input type="submit"> to an <input type="button">
    - change the onclick event to be "doStuff(); return false": returning false from an onclick event handler cancels the event - in this case it would cancel form submission.
    - remove the form.submit() javascript call
    Cheers,
    evanfets

  • Export JSP to Excel : Weird problem  (Urgent)

    Hi,
    Sorry for the length of question.
    I am facing a bit weired problem while exporting my JSP report to Excel.
    I have multiple tables in my JSP page .( Use of Multiple tables is a requirement .).
    I am using Struts and Oracle 9i JDeveloper for developement.
    I have a button called "Excel" and on its click , I am opening the same JSP page in a pop up and passing reqd. parameters to it using querystring
    ( sometimes I am keeping the parameters into session as the length is loo large to fit into queryString. )
    I am using
    response.setContentType("application/vnd.ms-excel");
    to transform my JSP page to Excel.
    Sometimes, this works fine.
    But, mant times this gives error such ( in Windows2000 Adv. Server ) as
    "Memory could not be "read"."..with the tile of error-popup as "Excel.exe".
    (In Windows NT , it never exports to Excel. Every time it gives "Dr. Watson Debugger" message box.)
    In Windows2000 Adv. Server ,
    While debugging, I observed that when I click on Excel button, the pop up opens and executes the page and again goes to the start of the page and executes again and thus tries to open the same Excel document.
    As we know, we cannot open same Excel document twice. Hence it gives a popup alert that
    " The file <filename with its entire path> could not be opened.
    There may be several reasons :
    You might be trying to open a file which does not exist.
    You might be trying to open the file which is already open. ..."
    etc.etc. and something like this.
    Now, this is totally unpredictable. If I click Excel button, It may open the file in excel and on next try it would give error.
    This is quite annoying. I searched on this forum, Google but could not find the solution yet.
    I cannot use POI - HSSF . I cannot use userdefined Excel tags as well. as it will require a lot of reqork and unfortunately I don't have that much time now.
    Please help me and let me know how would I be able to successfully and predictably export my JSP pages to Excel.
    Thanks,
    Swipsy.

    Hi,
    Why don�t you save as attachment? (use -> <% response.setHeader("Content-Disposition", "attachment; filename=\"name.xls\""); %> scriplet )...
    I�m doing the same work, but I have problems to export images to Excel by this method...
    Someone could help me??
    thanks a lot

  • Jsp code loads twice ?

    I dont know why, but many jsp pages does "compile" twice?
    I ve checked all code, but didnt find any problem
    I ve some System.out.println(msg);
    and in the console I can see all the msg twice.
    <%
    System.out.println("before...");
    System.out.println("true");
    System.out.println("after...");
    %>
    this would show in the console:
    before...
    true
    after...
    before...
    true
    after...
    TWICE!!!
    Whats wrong?

    Are you using Javascript to submit a form to that page?
    When you call a document.formname.submit() on a button or onSubmit it runs the JSP page twice.
    Took me ages to find out that one :)
    Just thought it sounded familiar.

  • JSP causes serious performance problem in my EP

    I have a native JSP application and running it on the EP. This application accessing a Oracle db (using oracle.jdbc.driver.OracleDriver driver).
    When this db not running, my EP doesn't open any page. The EP try to connect with this db, but not get success.
    I modify this application with TRY and CATCH to treat the application problem, but the EP problem continues.
    In the EP Thread Overview (System Adm -> Monitoring -> Portal -> Thread Overview), I see threads (locked) about this application. To unlock this threads, I delete the par file from the Portal and re-deploy it.
    When this threads is deleted, the application treat the problem (display a error message in the iView container) and EP work normally.
    My questions:
    1) Exists some way that the problem with this application does not cause performance problems with the EP (via code or property)?
    2) Exists some property in the Config Tool where I configure the connection timeout for access the external DB?
    3) Exists some way to liberate these (locked) threads of the EP (I see the page Clearing the Portal Runtime Cache - http://help.sap.com/saphelp_nw04/helpdata/en/d2/a216e1bd7b431c82fa5ff105187112/frameset.htm - but I don't know if I can use it for this)
    I use EP 6.0 SP 15.
    Thanks,
    Yuri Fiori de Almeida

    Hi Umair,
    the code is:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
    <%@ include file="isa_cad.jsp" %>
    <%
    Connection Connselect_localidade = null;
    try{
         Driver Driverselect_localidade = (Driver)Class.forName(MM_isa_cad_DRIVER).newInstance();
         Connselect_localidade = DriverManager.getConnection(MM_isa_cad_STRING,MM_isa_cad_USERNAME,MM_isa_cad_PASSWORD);
         PreparedStatement Statementselect_localidade = Connselect_localidade.prepareStatement("SELECT DISTINCT X AS Y FROM Z.K WHERE W = 1 ORDER BY X");
         ResultSet select_localidade = Statementselect_localidade.executeQuery();
         boolean select_localidade_isEmpty = !select_localidade.next();
         boolean select_localidade_hasData = !select_localidade_isEmpty;
         Object select_localidade_data;
         int select_localidade_numRows = 0;
    %>
    <!---- Page Layout --->
    <%
              select_localidade_hasData = select_localidade.next();
         select_localidade.close();
         Statementselect_localidade.close();
    //Connselect_localidade.close();
    %>
    <!---- Page Layout --->
    <%
    catch(Exception e){
    %>
    <!---- Page Layout ---><%
    finally{
         try{
              if(Connselect_localidade != null) Connselect_localidade.close();
         catch(Exception e){
    %>
    Thanks,
    Yuri.

  • I want to make a chatroom using jsp, and have some problem, Help!

    I want to build a chatroom using jsp and client using plain html, so i need every client could have a constant connection with the web server and will receive messages realtime. But i got 2 problems.
    First, how can i turn my buffers off so that messages can get to the client the time it is meant to be. I added
    <@page buffer="none">
    but seems that it takes no effect, any tricks here? thx
    Second, I want every user could have a constant conn. with server but i dont want my server to waste resources on those connection that has already been disconnected.so is it possible to stop executing JSP pages once client has diconnected.Since i found that it will throw no exception writing to the client even if the connection is disconnected in JSPs.
    Thanks!!!!!

    By theway, i'm using TOMCat 5.0 as my JSP container.

  • JSP is executed twice

    hi,
              I am running weblogic 6.1 with sp4. I have got two JSP which are using a
              datasource to connect to my database (oracle 8).
              When I got a java.sql.connection through the datasource, I am creating a
              statement and executing a query. It is a really simple query (select * from
              mytable) but mostly the JSP will be exceuted twice and I have no idea why.
              So can anyone help me?
              Michael
              

    hi,
              I am running weblogic 6.1 with sp4. I have got two JSP which are using a
              datasource to connect to my database (oracle 8).
              When I got a java.sql.connection through the datasource, I am creating a
              statement and executing a query. It is a really simple query (select * from
              mytable) but mostly the JSP will be exceuted twice and I have no idea why.
              So can anyone help me?
              Michael
              

  • Q: Another jsp drop-down menu problem+propeblem with savng button

    Well i have many problems:
    Starters i use eclipse with tomcat and postgres. I have to create a jsp page that shows some data directly from database.
    This is what i have so far:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ page import="property.core.Property"  %>
    <jsp:useBean id="PropertyDAO" scope="page" class="property.dao.PropertyDAO" />
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Vaata Vara</title>
    </head>
    <body>
    <script>
    function salvesta(){
    document.forms[0].mida_teha.value='salvestada' ; //salvesta=save and mida_teha=action
    document.forms[0].submit();
    </script>
    <input type='hidden' name='mida_teha' value='<%=request.getParameter("mida_teha") %>'>
    <form action='pg?mode=vaata_vara' method=POST>
    <input type='hidden' name='property' value='<%=request.getParameter("property") %>'>
    Valitud vara: <br>
    <% if((request.getParameter("property"))!=null){
    int property = Integer.valueOf(request.getParameter("property")).intValue();//
    String property_type="";
    String property_name ="";
    String property_created = "" ;
    String property_created_by ="" ;
    String property_updated = "" ;
    String property_updated_by ="" ;
    property.core.Property my_property ;
    if (request.getParameter("mida_teha") != null){
         my_property = PropertyDAO.GetProperty_fromDB(property);
         my_property.setProperty_name(request.getParameter("property_name"));
         my_property.setProperty_updated(request.getParameter("property_updated"));
         //my_property.getProperty_updated_by(request.getParameter("property_updated_by"));
         PropertyDAO.UpdateProperty_to_DB(my_property);
    out.println("<table border=1 cellpadding=0 cellspacing=0><tr><td><table"+
              "width=100% border=1 cellpadding=2 cellspacing=1>");
    if ((my_property = PropertyDAO.GetProperty_fromDB(property)) != null){
         property= my_property.getProperty() ;
        property_type = my_property.getProperty_type() ;
            property_name = my_property.getProperty_name() ;
        property_created = my_property.getProperty_created() ;
        property_created_by= my_property.getProperty_created_by() ;
        property_updated = my_property.getProperty_updated() ;
        property_updated_by= my_property.getProperty_updated_by() ;
         out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>ID</td><td> " + property + " </TD></tr>");
         out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>Tyyp</td><td> <SELECT ><OPTION value="+my_property.getProperty_name()+" 'name='property_type'>"+property_type+"</OPTION></SELECT> </TD></tr>");
         out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>Nimetus</td><td> <b><font color='#0000ff'><input type='text' value='"+ property_name + "' name='name'></font></b></TD></tr>");
         out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>Loodud</td><td> "+ property_created + " </TD></tr>");
         out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>Looja</td><td> " + property_created_by + " </TD></tr>");     
         out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>Uuendatud</td><td> <b><font color='#0000ff'><input type='text' value='"+ property_updated + "' name='updated'></font></b></TD></tr>");
         out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>Uuendaja</td><td> " + property_updated_by + " </TD></tr>");     
    out.println("</table></td></tr></table>");
    %>
    <input type="button" value="muuda vara" onClick="muuda_vara()">
    <input type="button" value="salvesta" onClick="salvesta()">
    </form>
    </body>
    </html>The problem is that i have no clue(allthough i have chekced the forums for help and experimented and i still could not make it work) how to make a dropdown menu for out.println("<TR BGCOLOR='#ffffff'><TD BGCOLOR='#cccccc' nowrap>Tyyp</td><td> <SELECT ><OPTION value="+my_property.getProperty_name()+" 'name='property_type'>"+property_type+"</OPTION></SELECT> </TD></tr>"); this. I have tryed http://forum.java.sun.com/thread.jspa?forumID=45&threadID=5241837 this page and that messes my "" up. If anyone can give me any tips how to integrate that code what is posted in the link to mine please let me know.
    Second problem is that when i push the save button, then i get a runtime error and a joyce to i want to debug or not. And as well in the example which i got from the teacher works just fine.
         //my_property.getProperty_updated_by(request.getParameter("property_updated_by")); this without the // get the not aplicable error as well(that in my other class file which is linked to this jsp the parameter is not aplicable). i managed to make in other jsp problem identical problem go away by adding a declaration of string and adding that string into the getParameter and this case everything should be okei, but it is not :(
    Anyway property.jsp uses property.java to get the getParameter and setParameter, PropertyDAO is the database stuff (connecting to database, getting data from the database).
    To be on the safe side i will add my propertyDAO.java
    package property.dao;
    import java.sql.* ;
    import property.core.Property ;
    import property.log.MyLogger ;
    import java.util.*;
    public class PropertyDAO {
        private int propertycount ;
        ResultSet VaraHulk ;
        String sql ;
        String url = "jdbc:postgresql://localhost/database";
        String usr = "";
        String pwd = "";
        Connection db ;     
        Statement  st ;
        Property [] VaraMassiiv  ;
        Property Current_Property ;
      public PropertyDAO(){
           try{
                   ResourceBundle bundle = ResourceBundle.getBundle("DBConnection");
                    this.url = bundle.getString("URL");
                    this.usr = bundle.getString("usr");
                    this.pwd = bundle.getString("pwd");
                    Class.forName(bundle.getString("Driver"));
           }catch(Exception ex){
                MyLogger MyLogger = new MyLogger();
               MyLogger.Log("dao.propertyDAO():",ex.getMessage());
           public Property [] getProperty_fromDB(){
                try{
                     this.db = DriverManager.getConnection(this.url, this.usr, this.pwd);
                     this.st = this.db.createStatement();
                    sql = "select count(*) as varade_arv from property" ;
                    VaraHulk = this.st.executeQuery(sql);
                    while(VaraHulk.next()){
                         this.propertycount = VaraHulk.getInt("varade_arv");
                    sql = "select property, property_type.name AS property_type, property.name AS property_name, " +
                              "property.created AS property_created, employee.first_name "+
                  "AS property_created_by, property.updated AS property_updated,employee.first_name AS property_updated_by" +
                  " from property, property_type, employee where property_type."+
                  "property_type=property.property_type and property.created_by=employee.employee ORDER by property" ;
                    VaraHulk = this.st.executeQuery(sql);
                    VaraMassiiv = new Property[this.propertycount];
                    int cnt = 0;
                    while(VaraHulk.next()){
                         Current_Property = new Property();   
                         Current_Property.setProperty(VaraHulk.getInt("property"));
                         Current_Property.setProperty_type(VaraHulk.getString("property_type"));
                      Current_Property.setProperty_name(VaraHulk.getString("property_name"));
                      System.out.println("getProperty_name:" + Current_Property.getProperty_name() );
                      Current_Property.setProperty_created(VaraHulk.getString("property_created"));
                      System.out.println("getProperty_created:" + Current_Property.getProperty_created() );
                      Current_Property.setProperty_created_by(VaraHulk.getString("property_created_by"));
                      System.out.println("getProperty_created_by:" + Current_Property.getProperty_created_by() );
                      Current_Property.setProperty_updated(VaraHulk.getString("property_updated"));
                      System.out.println("getProperty_updated:" + Current_Property.getProperty_updated() );
                      Current_Property.setProperty_updated_by(VaraHulk.getString("property_updated_by"));
                      System.out.println("getProperty_updated_by:" + Current_Property.getProperty_updated_by() );
                      VaraMassiiv[cnt] = Current_Property ;
                      cnt =  cnt + 1;
                       this.db.close();
                }catch(Exception ex){
                     MyLogger MyLogger = new MyLogger();
                    MyLogger.Log("property.getProperty_fromDB():",ex.getMessage());
                return VaraMassiiv;
           public Property GetProperty_fromDB(int property){
                try{
                     this.db = DriverManager.getConnection(this.url, this.usr, this.pwd);
                    this.propertycount = 0;
                    this.st = this.db.createStatement();
                    sql = "select property, property_type.name AS property_type, property.name AS property_name, property.created AS property_created, employee.first_name "+
                  "AS property_created_by,property.updated AS property_updated, employee.first_name AS property_updated_by" +
                  " from property, property_type, employee where property_type."+
                  "property_type=property.property_type and property.created_by=employee.employee and property.property =" + Integer.toString(property) ;
                    VaraHulk = this.st.executeQuery(sql);
                    while(VaraHulk.next()){
                         Current_Property = new Property();
                      Current_Property.setProperty(VaraHulk.getInt("property"));
                      Current_Property.setProperty_type(VaraHulk.getString("property_type"));
                      Current_Property.setProperty_name(VaraHulk.getString("property_name"));
                      System.out.println("getProperty_name:" + Current_Property.getProperty_name() );
                      Current_Property.setProperty_created(VaraHulk.getString("property_created"));
                      System.out.println("getProperty_created:" + Current_Property.getProperty_created() );
                      Current_Property.setProperty_created_by(VaraHulk.getString("property_created_by"));
                      System.out.println("getProperty_created_by:" + Current_Property.getProperty_created_by() );
                      Current_Property.setProperty_updated(VaraHulk.getString("property_updated"));
                      System.out.println("getProperty_updated:" + Current_Property.getProperty_updated() );
                      Current_Property.setProperty_updated_by(VaraHulk.getString("property_updated_by"));
                      System.out.println("getProperty_updated_by:" + Current_Property.getProperty_updated_by() );
                      this.propertycount =   this.propertycount + 1;
                    this.db.close();
                } catch(Exception ex){
                     MyLogger MyLogger = new MyLogger();
                    MyLogger.Log("PropertyDAO.GetProperty_fromDB():",ex.getMessage());
                return Current_Property ;
          public void UpdateProperty_to_DB (Property updated_property){
                try{
                     this.db = DriverManager.getConnection(this.url, this.usr, this.pwd);
                     this.st = this.db.createStatement();
                     int stmtInt = this.st.executeUpdate("update property set property_type='" + updated_property.getProperty_type() +
                               "',name=" +  updated_property.getProperty_name() + ",created=" + updated_property.getProperty_created() +
                               ",'created_by='" + updated_property.getProperty_created_by() +  ",updated="+updated_property.getProperty_updated()+
                               ",updated_by="+updated_property.getProperty_updated_by()+
                               "' where property=" + Integer.toString(updated_property.getProperty() ));
                     this.db.close(); 
                }catch(Exception ex){
                        MyLogger MyLogger = new MyLogger();
                        MyLogger.Log("PropertyDAO.UpdateProperty_to_DB():",ex.getMessage());
           public void finalize(){
                 try{
                   System.out.println("finalize");
                  }catch(Exception ex){ 
                    MyLogger MyLogger = new MyLogger();
                    MyLogger.Log("PropertyDAO.finalize():",ex.getMessage());
    }Property.java
    package property.core;
    import property.log.MyLogger ;
    public class Property {
        //private int propertycount ;
        private int property ;
        //private int current_property ;
        private String property_type ;
        private String property_name ;
        private String property_created ;
        private String property_created_by;
        private String property_updated_by;
        private String property_updated;
        public Property(){
             try{
             }catch(Exception ex){
                   MyLogger MyLogger = new MyLogger();
                   MyLogger.Log("core.Property():",ex.getMessage());
        public void setProperty (int property){
             this.property = property;
        public void setProperty_type (String property_type){
             this.property_type = property_type;
        public void setProperty_name (String property_name){
             this.property_name = property_name;
        public void setProperty_created ( String property_created){
             this.property_created = property_created;
        public void setProperty_created_by (String property_created_by){
             this.property_created_by = property_created_by;
        public void setProperty_updated ( String property_updated){
             this.property_updated = property_updated;
        public void setProperty_updated_by (String property_updated_by){
             this.property_updated_by = property_updated_by;
        public int getProperty () {
             return this.property ;
        public String getProperty_type () {
             return this.property_type ;
        public String getProperty_name () {
             return this.property_name ;
        public String getProperty_created () {
             return this.property_created;
        public String getProperty_created_by () {
             return this.property_created_by;
        public String getProperty_updated () {
             return this.property_updated;
        public String getProperty_updated_by () {
             return this.property_updated_by;
        public void finalize(){
             try{
                  System.out.println("finalize");
             }catch (Exception ex){
                   MyLogger MyLogger = new MyLogger();
                   MyLogger.Log("core.Property():",ex.getMessage());
    }(well it took me 3 days to get the code to work that much as it does anyways)
    hope someone here can help
    Edited by: kohuke on May 30, 2008 11:27 AM
    Added few codes that is connected with the current jsp page

    are you sure your stop() are in the right place??
    eg.. on the last frame of the onRollOver animation??
    also... why have you got on(releaseOutside); ???
    onRollOut will suffice.

  • JSP with useBean beginner problems need help

    I start to learn JSP and now I am facing a problem which cannot be solved for a whole day.
    I make a simple JSP and want to use a my defined class to make some logic outside JSP file. It can be built by "ant build".
    But there is always an error-message when I see through browser. Also, I have already "ant deploy" to copy all classes in WEB-INF/classes/...
    Besides, my tomcat can run JSP without importing external class or javaBean.
    Please help. I really have no idea. Thanks.
    The simple Converter.class in Test.Beans package
    package Test.Beans;
    import java.math.*;
    public class Converter {
         static BigDecimal yenRate = new BigDecimal("131.7800");
         static BigDecimal euroRate = new BigDecimal("0.0084");
    public BigDecimal dollarToYen(BigDecimal dollars) {
    BigDecimal result = dollars.multiply(yenRate);
    return result.setScale(2,BigDecimal.ROUND_UP);
    public BigDecimal yenToEuro(BigDecimal yen) {
    BigDecimal result = yen.multiply(euroRate);
    return result.setScale(2,BigDecimal.ROUND_UP);
    public Converter() {}
    The simple JSP:
    <%@ page import="java.math.*" %>
    <jsp:useBean id="c" class="Test.Beans.Converter" scope="page"/>
    <html>
    <head>
         <title>Converter</title>
    </head>
    <body bgcolor="white">
         <FONT SIZE=+1>
         <h1><center>Converter</center></h1>
         <hr>
         <p>Enter an amount to convert:</p>
         <form method="get">
         <input type="text" name="amount" size="25">
         <br>
         <p>
         <input type="submit" value="Submit">
         <input type="reset" value="Reset">
         </form>
         <%
         String amount = request.getParameter("amount");
              if ( amount != null && amount.length() > 0 ) {
              BigDecimal d = new BigDecimal (amount);
         %>
         <%= c.yenToEuro(d) %> Euro.
         <%
         %>
         </FONT>
    </body>
    </html>
    Here is the error message:
    org.apache.jasper.JasperException: /main.jsp(2,0) The value for the useBean class attribute Test.Beans.Converter is invalid.
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException: /main.jsp(2,0) The value for the useBean class attribute Test.Beans.Converter is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3304)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Message was edited by:
    BillyHui

    Works fine for me, copied and pasted exactly.
    Try recompiling your java class again, to make sure it is valid.
    Check that the class file is copied into the correct place by your ant build.
    Should be WEB-INF/classes/Test/Beans/Converter.class

  • How to set up displaying all jsp-errors in the problems-list?

    how can i set up that all jsp-problems and warnings like "some tag does not have an end tag..." are displayed in the problem list?
    when i open up a jsp-page in the editor, the warnings are displayed i can´t see them in the problem list. in the older version (m7) these warnings have been displayed by default and i can not find any setting to display this.
    any idea?
    tnx
    Rel

    When exactly it stopped displaying in Problems View? Have you installed any other plug-ins to Eclipse?
    Try the following steps:
    - Quit & relaunch Workshop
    - In Problems View, Launch Filters... window
    - Click "Restore Defaults" button (make sure JSP problem is checked)
    - Click OK
    - Does the warnings displayed in Workshop JSP/XML Editor appear in the Problems View?
    In case you still face the same problem, please send the following information to [email protected]
    * Help > About Workshop > Click on Eclipse icon - Version & build id
    * Help > About Workshop > Click on Workshop icon - Version & build id
    * Window > Preferences > Java > Installed JREs - the JRE/JDK version
    * .log file from <Eclipse Workspsace>.metadata directory
    * m7.log.0 from <Workshop_Home_Dir>Workshop\eclipse\plugins\com.m7.nitrox_3.0.0 directory
    * <Workshop_Home_Dir>Workshop_InstallLog.log
    * If you can remember, the steps exercised (or plug-ins installed) before encountering this behavior

Maybe you are looking for

  • Downloding the SAP master data and transaction data to a flat file

    Hello All, Is there any SAP standard method or transaction to download the SAP master data and transaction data to flat file. With out using ABAP development, SAP had provided any tool or method to download the SAP system master and transaction data

  • Speed negotiation settings for a 10G interface

    HI, We have the following setup: 2 ports of CISCO 6509(also has xfp long range)  switch connected to 2(XAUI) ports of SPARC box T5220. When the SPARC box goes for a reboot, the link is UP at XAUI while ports are down at CISCO end. However either of t

  • I am having problems with a clean install of the system Lion os over the internet Do these readings off socket connections look correct?

    Active Internet connections Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    tcp4       0      0  10.0.0.2.50921         a184-25-165-54.d.https CLOSE_WAIT tcp4       0      0  10.0.0.2.50920         a184-25-165-54.d.https

  • G5 Crashes Upon Startup

    Hey y'all. I'm having problems with my dual 1.8 G5. It keeps crashing over and over and over again. Here's the long version: I was playing Civ4, and my computer had been running as normal that day. For the record, I was running it off of a second har

  • Why is my video having problems?

    There is really just two things that i am concerned with. 1. Every few seconds my video will start lagging, then i will pause it and play it again and it will be fine. 2. The regularly yellow line in the top of the editing box turned red on three cli