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

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

View Answers









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 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 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 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 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 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 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
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
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
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
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 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
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 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 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 <
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 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
how to check username & password from database using jsp
how to check username & password from database using jsp  Hello, I have created 1 html page which contain username, password & submit button. in my oracle10G database already contain table name admin which has name, password
search functionality using jsp from database
search functionality using jsp from database  search functionality using jsp from database
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 show effect (visual) on jsp page using value from database
how to show effect (visual) on jsp page using value from database  I am making a ticket booking system. I have a databse with a clumn "booking status... is "not_booked" then the picture shown as seat should be displayed red. Also i dont know how
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
3 dropdown list from the database using JSP
3 dropdown list from the database using JSP  Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
how to retrieve data from database using combobox value without using request.getParameter in jsp - JSP-Servlet
how to retrieve data from database using combobox value without using request.getParameter in jsp  Answer pl
How to carry multiple values from a Servlet to a JSP?
How to carry multiple values from a Servlet to a JSP?  By using the below code I am able to carry the username to a JSP (single value... needs to be carried from my servlet to a JSP. How do I do
How to display all the Select values from the MySQL database table in where condition= In JSP?
How to display all the Select values from the MySQL database table in where... to display all the select values from MySQL DB** only first value is displayed in the jsp file. @select * from table dept where dept_no=10;" jsp code i have used
How to access the database from JSP?
How to access the database from JSP?  Hi, What is the process of accessing the database from JSP page? Thanks   Hi, In the JSP program... database from JSP which explains you how to access the database by embedding
jsp :how to edit table of data displayed using jsp when clicked on edit button
jsp :how to edit table of data displayed using jsp when clicked on edit button  i have a jsp program which displays data in the form of table ..now i... the data when clicked on save button.. how can i do
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one value at a time without any prb, but I am unable to carry multiple (from two
jsp :how to edit table of data displayed using jsp when clicked on edit button
jsp :how to edit table of data displayed using jsp when clicked on edit... code retrieve data from database and display in the html table. At each row...){ System.out.println(e); } %>   My database is xml..How can i do the same
How to get sub category based on category from database using jsp and javascript.
How to get sub category based on category from database using jsp and javascript.  How to get sub category based on category from database using jsp and javascript
<img src=""> using retrieve image from database using jsp
using retrieve image from database using jsp  how to <img src="" > tag using retrieve image from database and display in jsp
How to get the text from textarea in HTML and store it in database using javascript and jsp
How to get the text from textarea in HTML and store it in database using javascript and jsp  How to get the text from textarea in HTML and store it in database using javascript and jsp <script> function str() { <
graph generation using jfreechart and retrieving values from the database
graph generation using jfreechart and retrieving values from the database ... database using prepared statement and then display the bar graph using..... Note that it is a access made database. How can I proceed ..Pls answer.Its very
How retreive data from database without using post method in jsp - JSP-Servlet
How retreive data from database without using post method in jsp  Tell me how?  Hi Friend, If you don't want to use post method then use... the selected value from the combo box and get textbox value from another page
how to display a table from database using servlet
how to display a table from database using servlet  how to display a table with values from servletpage   Hi Friend, Please go through the following link:ADS_TO_REPLACE_1 http://roseindia.net/jsp/servlet-jsp-data
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript  when click on the next button/link then it must display next 10 record from database and same for previous
retrive image from database using jsp without stream
retrive image from database using jsp without stream  How to retrive image from database using jsp without stream like (inputStream

Ads