Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet How to edit values in textboxes from database using jsp
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


lissy
How to edit values in textboxes from database using jsp
0 Answer(s)      4 years and a month 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


Advertisement
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
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
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
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
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 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 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 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 validate values in the dynamically created textboxes?
how to validate values in the dynamically created textboxes?  how to validate values in the dynamically created textboxes in HTML using javascript? Here s my code. Anyone plz help me. Thanks in advance. <!DOCTYPE html PUBLIC
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
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 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
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
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 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
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
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
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
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 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
 

 

 

DMCA.com