How to edit values in textboxes from database using jsp

Ads

 
 

Share on Google+Share on Google+

lissy
How to edit values in textboxes from database using jsp
0 Answer(s)      7 years ago
Posted in : JSP-Servlet

Hi RoseIndia,

I need help to solve my technical problem, i want to edit values in textboxes from database table using jsp, here is my code Please can anyone help me

editData.jsp

<%@ page language="java" import="java.util.*;"%> <%@ page language="java" import="java.sql.*"%>

<%! String IPAddress = ""; String SubnetMask = ""; String AggregatedSwitch = ""; String AllocatedHostname = ""; String VLANID = ""; String HeadendName = ""; String DateIssued = ""; String Remarks = "";

    %>

    <br><br><br>
    <table align="center" width="300px" style="background-color:#EDF6EA;border:1px solid #000000;">

        <tr><td colspan=2 style="font-weight:bold;" align="center">Edit User</td></tr>
        <tr><td colspan=2 align="center" height="10px"></td></tr>
        <tr>
            <td>IP Address</td>
            <td><input type="text" name="IPAddress" value="<%=IPAddress%>"></td>
        </tr>
        <tr>
            <td>Subnet Mask</td>
            <td><input type="text" name="SubnetMask" value="<%=SubnetMask%>"></td>
        </tr>
        <tr>
            <td>Aggregated Switch</td>
            <td><input type="text" name="AggregatedSwitch" value="<%=AggregatedSwitch%>"></td>
        </tr>
        <tr>
            <td>Allocated Hostname</td>
            <td><input type="text" name="AllocatedHostname" value="<%=AllocatedHostname%>"></td>
        </tr>

        <tr>
            <td>VLAN ID</td>
            <td><input type="text"  name="VLANID" value="<%=VLANID%>"></td>
        </tr>
        <tr>
            <td>Headend Name</td>
            <td><input type="text" name="HeadendName" value="<%=HeadendName%>"></td>
        </tr>
        <tr>
            <td>Date Issued</td>
            <td><input type="text" name="DateIssued" value="<%=DateIssued%>"></td>
        </tr>
        <tr>
            <td>Remarks</td>
            <td><input type="text" name="Remarks" value="<%=Remarks%>"></td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" name="Submit" value="Update" style="background-color:#49743D;font-weight:bold;color:#ffffff;"></td>
        </tr>
        <tr><td colspan=2 align="center" height="10px"></td></tr>
    </table>
    <%
                IPAddress = request.getParameter("IPAddress");
                SubnetMask = request.getParameter("SubnetMask");
                AggregatedSwitch = request.getParameter("AggregatedSwitch");
                AllocatedHostname = request.getParameter("AllocatedHostname");
                VLANID = request.getParameter("VLANID");
                HeadendName = request.getParameter("HeadendName");
                DateIssued = request.getParameter("DateIssued");
                Remarks = request.getParameter("Remarks");
                Statement stmt;
                Connection conn = null;
                String url = "jdbc:odbc:Driver={Microsoft Access Driver "
                        + "(*.mdb, *.accdb)};DBQ=C:\\Database\\Databaseip.accdb";
                String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
                out.println(request.getRequestURI());
                if (IPAddress != null && SubnetMask != null && AggregatedSwitch != null && AllocatedHostname != null && VLANID != null && HeadendName != null && DateIssued != null && Remarks != null) {
                    if (IPAddress != "" && SubnetMask != "" && AggregatedSwitch != "" && AllocatedHostname != "" && VLANID != "" && HeadendName != "" && DateIssued != "" && Remarks != "") {
                        try {
                            Class.forName(driver).newInstance();
                            conn = DriverManager.getConnection(url);
                            System.out.println("Connected to the database");

                            //ArrayList al = null;
                            // ArrayList userList = new ArrayList();
                            String query = "UPDATE ip_address SET IPAddress= "+IPAddress+",SubnetMask=" + SubnetMask + ",AggregatedSwitch=" + AggregatedSwitch + ",AllocatedHostname=" + AllocatedHostname + ",VLANID=" + VLANID + ",HeadendName=" + HeadendName + ",DateIssued=" + DateIssued + ",Remarks=" + Remarks + "";
                    stmt = conn.createStatement();

                    int i = stmt.executeUpdate(query);
                    System.out.println("query" + query);
                            if (i > 0) {
                                response.sendRedirect("adminHome.jsp");
                            }
                            conn.close();
                            System.out.println("Disconnected from database");
    %>
    <br>
    <TABLE style="background-color: #E3E4FA;"
           WIDTH="30%" border="1">
        <tr><th>Data Modified successfully
                in database.</th></tr>
    </TABLE>
    <%

                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }

    %>
</form>

This code is not working its not displaying any values in the textboxes, it simply displays the textboxes empty, Please can anyone help me....

Thanks in advance

Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
How to edit values in textboxes from database using jsp
How to edit values in textboxes from database using jsp  Hi RoseIndia, I need help to solve my technical problem, i want to edit values in textboxes from database table using jsp, here is my code Please can anyone help me
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
Advertisements
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
how to display values from database into table using jsp
how to display values from database into table using jsp  I want to display values from database into table based on condition in query, how... the values from database based on the bookname or authorname entered must be display
how to read values from excel sheet and compare with database using jsp
how to read values from excel sheet and compare with database using jsp  hi sir i am arun how to read values from excel sheet and compare with database using jsp coding i.e, if i have 6(assetid,assetname,serialno,cubical
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
retrieving values from dynamically added textboxes in jsp - JSP-Servlet
retrieving values from dynamically added textboxes in jsp  hai friends, iam new to this site ,please help me in this senario in jsp how to retrieve values from dynamically added textbox like we can see in naukri.com
edit database using jsp and servlet
edit database using jsp and servlet  I am creating a website using jsp and servlets that is used to view houses from a database. I want to be able... information from the database in the textboxes. Please help me to display
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
How to store values in a database using JSTL? - JSP-Servlet
How to store values in a database using JSTL?  I want to store values in a database... How can i store in database? Here is my code... This wil... in a database...How can i do? Airport
How to insert data from a combobox and textbox values into DB using JSP?
How to insert data from a combobox and textbox values into DB using JSP?  hi, How to insert a comb-box and a text box values in to DB using JSP? @DB:student; @table:stu_info; Combobox values:(class1,class2,class3); textbox1
How to fetch entries/values from database to a jsp page one by one?
How to fetch entries/values from database to a jsp page one by one?  ... and data and each column has 10 enteries. I have a jsp page on which i want to display different database entries of the each column in different blocks. Now
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file  Hi am new to java. i need to create... Solution field from database and display in the textbox of the jsp.   1
how to insert values from jsp into ms access
how to insert values from jsp into ms access   how to insert values using jsp into ms access database
How to retrieve image from database using jsp and servlet?
How to retrieve image from database using jsp and servlet?  Hi, I am trying to find code for displaying the image from database in a JSP page. How to retrieve image from database using jsp and servlet
How to display image in jsp from database using Servlet?
How to display image in jsp from database using Servlet?  Hi, How to display image in jsp from database using Servlet? Thanks   Hi, You will find code and example program at Retrieve image from database using Servlet
Store values of dynamically generated textboxes into database
Store values of dynamically generated textboxes into database   I'm trying to create a form where the user gives number to generate textboxes. when... it to be saved in MYSQL database. Anybody please help me
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2... these dynamic textbox values to database(Oracle 11g)...Please help me out. I have
how to generate reports from oracle database using jsp and ajax code
how to generate reports from oracle database using jsp and ajax code  Hai masters i am new to this Java world. my team leader ask me to generate sales report data from oracle database to jsp page please any one know how to do
How to create bar chart using database values
How to create bar chart using database values  How to create bar chart using database values i.e excellent,good,average fields using jsp?It is like opinion poll.I want to show how many votes are came for excellent,good,average
create,edit and delete in JSP using struts and SQL server2005 as database in jdeveloper?
create,edit and delete in JSP using struts and SQL server2005 as database... to create,edit and delete tasks: taskid, taskname, date, project in JSP and struts... example using struts.if anyone knows how to do it..please help me.. thanks a lot
How to get the data from the database using Servlet or JSP program
How to get the data from the database using Servlet or JSP program  ... database using JSP Get data from database using JSP... from the database like oracle . I have created one jsp program like this <
Retrieve values from database using views
Retrieve values from database using views  hi......... I have a huge database so i have created views in database where i am selecting only... from that created views and display on form . I am trying to do so but its
create,edit and delete in JSP using struts and SQL server2005 as database in jdeveloper?
create,edit and delete in JSP using struts and SQL server2005 as database in jdeveloper?  I have a project ie create an application for users to create,edit and delete tasks: taskid, taskname, date, project in JSP and struts
How to get data from Oracle database using JSP
How to get data from Oracle database using JSP  hello i have a simple problem in jsp in the sense to get data from the database like oracle . I have... the answer to retrieve data from the database by using servlet or jsp program
how to upload an image from a jsp page to a mysql database table using jsp
how to upload an image from a jsp page to a mysql database table using jsp  how to upload an image from a jsp page to a mysql database table using jspstrong text
how to store multiple values from drop down in database where i am using java struts 1.3
how to store multiple values from drop down in database where i am using java struts 1.3  hii, i am coding a form where i need a keyskills attribute... is displaying.. i need code in java so that it takes multiple values
getting values from database - JSP-Servlet
JSP code separately.If it will not display database values then try your code...getting values from database  I tried the following code abc.html aaa.jsp I am not getting exceptions now

Ads

 
Advertisement null

Ads