editable grid in jsp

editable grid in jsp

i want to create editable grid in jsp for invoice so that i can insert multiple product at a same time.how to create that in jsap, plz reply

View Answers

February 11, 2012 at 3:29 PM

We are providing you the code where we have specified only three fields bookid,author and title in the database. Follow these steps to update these fields:

1) Create book.jsp

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

<form name=myname method=post action="edit.jsp">
<table border="1">
<tr><td></td>
<td><b><u>bookid</u></b></td>
<td><b><u>Author</u></b></td>
<td><b><u>title</u></b></td>
</tr>
<%try{

Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root", "root");
ResultSet rs = null;
Statement st=null;
st=conn.createStatement();
rs = st.executeQuery("select * from book");
int i=0; while(rs.next()){ %>
<tr><td><input type="checkbox" name="check<%=i%>" value=<%= rs.getString("bookid") %>></td>
<td><%= rs.getString("bookid") %></td>
<td><%= rs.getString("author") %></td>
<td><%= rs.getString("title") %></td>
</tr><%
i++;
}
}catch(SQLException e){ System.out.println(e.getMessage()); } %>
</table>
<input type="submit">
</form>

2) Create edit.jsp

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

<%String id[]= new String[10];
for(int i=0;i<10;i++){
id[i]=request.getParameter("check"+i);
out.println(id[i]);
}
%>

<form name=myname method=post action="update.jsp">
<table border="1">
<tr>
<td><b><u>bookid</u></b></td>
<td><b><u>Author</u></b></td>
<td><b><u>title</u></b></td>
</tr>
<%try{

Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root", "root");
ResultSet rs = null;
Statement st=null;
st=conn.createStatement();
for(int a=0;a<10;a++){
rs = st.executeQuery("select * from book where bookid='"+id[a]+"'");
while(rs.next()){ %>
<tr>
<td><input type="text" name="bid" value="<%= rs.getString("bookid") %>"></td>
<td><input type="text" name="auth" value="<%= rs.getString("author") %>"></td>
<td><input type="text" name="tit" value="<%= rs.getString("title") %>"></td>
</tr><%
}
}
}catch(SQLException e){ System.out.println(e.getMessage()); } %>
</table>

<input type="submit">

3)Create update.jsp

<%@page import="java.sql.*"%>
<%
String d[] =request.getParameterValues("bid");
if(d !=null) {
for(int i=0;i<d.length;i++) {
out.println(d[i]);
}
}
String name[] =request.getParameterValues("auth");
if(name !=null) {
for(int i=0;i<name.length;i++) {
out.println(name[i]);
}
}
String title[] =request.getParameterValues("tit");
if(title !=null) {
for(int i=0;i<title.length;i++) {
out.println(title[i]);
}
}
%>
<%
try{
Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root", "root");

Statement st=null;
st=conn.createStatement();
for(int a=0;a<10;a++){
String book_id=d[a];
String author=name[a];
String tit=title[a];
st.executeUpdate("update book set author='"+author+"', title='"+tit+"' where bookid='"+book_id+"'");
}
}
catch(Exception e){
e.printStackTrace();
}
%>









Related Tutorials/Questions & Answers:
editable grid in jsp
editable grid in jsp  i want to create editable grid in jsp for invoice so that i can insert multiple product at a same time.how to create that in jsap, plz reply   We are providing you the code where we have specified
GRID IN JSP - JSP-Servlet
GRID IN JSP  I m creating one ERP project in which i need to fill the data from the data base in a grid in jsp page. So pls any one provide the code
Advertisements
jsp grid
jsp grid  In jsp table example the values are not being accepted the error is that the item tag doesn't accept any attributes
Jsp Grid
Jsp Grid  <p>&lt;%@ page language="java" import="java.util....;"></p> <pre class="prettyprint">&lt;title&gt;My JSP...; --&gt; </code></pre> <p><title>jsp paging example
data grid - JSP-Servlet
data grid  how can we implement data grid (we have data grid in asp.net) in jsp. can u please send me the sample code and also the possible ways to implement data grid in jsp Thanks varun kumar  Hi friend, I
Re:Need Help for Editable Display table - JSP-Servlet
Re:Need Help for Editable Display table  Hi Genius i need a help in jsp to display editable display tag. I able to show the datagrid in jsp... and edit it in the same grid.. Thanks in advance Eswaramoorthy  Hi
editable datagrid
://www.roseindia.net/jsp/data-grid.shtml Here you will get an useful example. ThanksADS_TO_REPLACE_2   thanks but i want a editable grid,with the option...editable datagrid  How to create a editable datagrid in jsp,struts1.3
data grid - JSP-Servlet
data grid  i am trying to do the example in the following link http://www.roseindia.net/jsp/data-grid.shtml but i am not able to find... this example  Hi friend, To visit again http://www.roseindia.net/jsp/data
Re:Need Help for Editable Display table - JSP-Servlet
Re:Need Help for Editable Display table  Hi Genius
how to display data in List Or grid or in table in Jsp
how to display data in List Or grid or in table in Jsp   <%@page...;JSP Reading Text File</title> </head> <body> <...(); } %> </body> </html> this is my jsp code i want to display
display uploaded file option in editable form
display uploaded file option in editable form  how to show the uploaded file in editable mode on the jsp in struts2.0
display uploaded file option in editable form
display uploaded file option in editable form  how to show the uploaded file in editable mode on the jsp in struts2.0
Editable Html
Editable Html  i have editable html table with following elements textbox(n),checkbox(n),sno,dropdownlist..this elements are generated in runtime using javascript by taking the row count from user...now the problem, i dont know
Create Data Grid in JSP page
Create Data Grid in JSP page   ... grid that shows data from database table in jsp page. In this jsp code given... this data grid will fetch data and show in a jsp page. We have used database name
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?  In a jsp page InsertUpdate.jsp (say) there is a button Insert... saving data would be viewed in grid in the same page. Now problem is that, I need
Sigma grid -- Ajax-enabled JavaScript grid
Sigma grid -- Ajax-enabled JavaScript grid       Sigma Grid Sigma Grid is a freely open source AJAX editable data grid, written in pure javascript for displaying and inline
editable combobox method selection
editable combobox method selection  how to make an editable combobox that shows nothing initially but as a key is pressed it pops up and selects an item starting with that letter, subsequent keys would keep sorting from the list
how to use an editable combobox
how to use an editable combobox   Hello Everyone!!!!!!!! I have a jcombo box with certain values and i want to use it as an editable that means when user will type something in combobox, according to that text only matching item
ModuleNotFoundError: No module named 'sphinxcontrib-editable'
ModuleNotFoundError: No module named 'sphinxcontrib-editable'  Hi...: No module named 'sphinxcontrib-editable' How to remove the ModuleNotFoundError: No module named 'sphinxcontrib-editable' error? Thanks   Hi
Editable JTree
Editable JTree Nodes        In this section, you will learn  to make JTree editable..._TO_REPLACE_1 This program constructs a JTree that contains editable nodes. Firstly
Problem With Combo Box Editable Property
Problem With Combo Box Editable Property  Hi I am new To Flex i had set Combo Box Editable Property as true. But I didn't get the property filtering in the combo box like when you enter text "S" in the combo box then the names
jsp
jsp  hai please give me the table grid code code for jsp
ModuleNotFoundError: No module named 'django-content_editable'
ModuleNotFoundError: No module named 'django-content_editable'  Hi...: No module named 'django-content_editable' How to remove the ModuleNotFoundError: No module named 'django-content_editable' error? Thanks   
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap   i want to create invoice report editable. values should be taken from dabase and editable .. help out asap
Java with Grid - Ajax
/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx grid.... thanks.  Hi Friend, You can use jsp / servlet. For code, please visit the following links: http://www.roseindia.net/jsp/data-grid.shtml http
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap   i want to create invoice report .. help out asap
Ajax grid
Ajax grid  Hi, How I can create ajax grid in my program? Thanks
Non Editable Text File in java - Java Beginners
Non Editable Text File in java  Hello Sir ,I want to Show NonEditable TextFile on JButton Click which Contains User Manual of Project ,How I can Do It. plz Help Me
how can i display a editable result of form?
how can i display a editable result of form?  how can i display a editable result of form? i know how to display form result but the result is display on text. i cant modify them. i have a form with hundreds of checkbox. i want
HTML GRID
HTML GRID  how to retrieve data from mysql database in grid form using html and servlets? urgent....   import java.io.*; import java.sql....); } out.println("<html><h3>Pagination of JSP page</h3><body><
Nitobi Grid is not working in IE10/IE11
Nitobi Grid is not working in IE10/IE11  Nitobi grid is working in IE8, but not working in IE10/IE11. we are using above two javascript files to open the grid
ModuleNotFoundError: No module named 'odoo10-addon-attachment-attach-non-editable'
-editable'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'odoo10-addon-attachment-attach-non-editable...-attachment-attach-non-editable' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo10-addon-account-move-line-tax-editable'
-editable'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'odoo10-addon-account-move-line-tax-editable...-account-move-line-tax-editable' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo10-addon-attachment-attach-non-editable'
-editable'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'odoo10-addon-attachment-attach-non-editable...-attachment-attach-non-editable' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo11-addon-account-move-line-tax-editable'
-editable'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'odoo11-addon-account-move-line-tax-editable...-account-move-line-tax-editable' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo12-addon-account-move-line-tax-editable'
-editable'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'odoo12-addon-account-move-line-tax-editable...-account-move-line-tax-editable' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo12-addon-account-move-line-tax-editable'
-editable'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'odoo12-addon-account-move-line-tax-editable...-account-move-line-tax-editable' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo13-addon-account-move-line-tax-editable'
-editable'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'odoo13-addon-account-move-line-tax-editable...-account-move-line-tax-editable' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'grid'
ModuleNotFoundError: No module named 'grid'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'grid' How to remove the ModuleNotFoundError: No module named 'grid' error
java + grid - Java3D
java + grid  i need to give the output of the application in the form of a grid in XY-plane,the grid should have different colors for regions of different value range
How to export grid into excel
How to export grid into excel  Hi, i created a grid panel i have to export it to the excel. please help me by some sample code. thanks in advance. cool day dude
how to maKE Jcombox editable after saveing value init.
how to maKE Jcombox editable after saveing value init.  i have one JCombobox with 2 values"y", "N".when i selecting some value from dropdown... the value and when i clicked on save unable to save it. how to maKE Jcombox editable
Grid Problem - Java Beginners
Grid Problem  Hi Deepak Plz take seriously I m telling u detail. Steps: 1:- there r one form,this form belong to grid. and two... belong to different table.but in main form,all data going in the grid(with join
add row in grid using dojo
add row in grid using dojo  add row in grid using dojo
give me a grid example in php
give me a grid example in php  give me easy code example of grid in php like mysql editor
JSP Editor - JSP-Servlet
JSP Editor  Hi! I am using IDE Netbeans 5.5. One of my friend told me if you install plugins you can work with JSP with simple drag and drops and grid views such as grid view and multi view how we are doing in .NET
Version of com.nanosai>grid-ops dependency
List of Version of com.nanosai>grid-ops dependency
Grid rows delete issue
Grid rows delete issue  I have a grid having rows with Remove button to remove rows,But we also havae an facility to remove those rows on onchange event of dropdown also,so if we delete middle row and then remove all rows
ModuleNotFoundError: No module named 'djangocms-grid'
ModuleNotFoundError: No module named 'djangocms-grid'  Hi, My... named 'djangocms-grid' How to remove the ModuleNotFoundError: No module named 'djangocms-grid' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ez-grid'
ModuleNotFoundError: No module named 'ez-grid'  Hi, My Python...-grid' How to remove the ModuleNotFoundError: No module named 'ez-grid... to install padas library. You can install ez-grid python with following command

Ads