Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 29th, 2004, 06:37 AM
Authorized User
 
Join Date: Oct 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default prob.. confirm message

hey...

its the updation query.In this page when i click the update button it updates the values in the row..and this query is working...

I want to do that..when i click a update button it gives me a confirms message whether did u want to update the row and also displaying the particular gl_code no in that confirms message.when i click on yes it updates the row..otherwise it doesnot.

after updation it shows message that this particular gl_code no is has been updated.

<%
String action = request.getParameter("action");

if (action != null && action.equals("update")) {
conn.setAutoCommit(false);


PreparedStatement pstatement = conn.prepareStatement(
"UPDATE gl_mast SET gl_descr = ?, db_amt = ?, " +
"cr_amt = ?, gl_type = ? , gl_pct = ? WHERE gl_code=?");

pstatement.setString(1, request.getParameter("gl_descr"));
pstatement.setFloat(2,Float.parseFloat(request.get Parameter("db_amt")));
pstatement.setFloat(3,Float.parseFloat(request.get Parameter("cr_amt")));
pstatement.setString(4, request.getParameter("gl_type"));
pstatement.setFloat(5,Float.parseFloat(request.get Parameter("gl_pct")));
pstatement.setInt(6,Integer.parseInt(request.getPa rameter("gl_code")));

int rowCount = pstatement.executeUpdate();
conn.setAutoCommit(false);
conn.setAutoCommit(true);
}



%>


<%

Statement statement = conn.createStatement();

ResultSet rs = statement.executeQuery
("SELECT * FROM gl_mast ");

%>


<form action="gl_update.jsp" method="get">
<input type="hidden" value="update" name="action">
<tr>
<td><input value="<%= rs.getInt("gl_code") %>" size="5" name="gl_code"></td>
<td><input value="<%= rs.getString("gl_descr") %>" size="55" name="gl_descr"></td>
<td><input value="<%= rs.getFloat("db_amt") %>" size="12" name="db_amt"></td>
<td><input value="<%= rs.getFloat("cr_amt") %>" size="12" name="cr_amt"></td>
<td><input value="<%= rs.getString("gl_type") %>" size="3" name="gl_type"></td>
<td><input value="<%= rs.getFloat("gl_pct") %>"size="5" name="gl_pct"></td>
<td><input type="submit" value="Update"></td>
</tr>
</form>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Confirm in ItemDataBound rstelma ASP.NET 1.0 and 1.1 Basics 3 December 6th, 2006 02:10 AM
Javascript Confirm Message box itHighway Javascript How-To 5 September 25th, 2006 02:51 AM
Confirm messagebox edwin.debrouwere ASP.NET 2.0 Basics 0 September 5th, 2006 07:29 AM
confirm crmpicco Javascript How-To 2 February 7th, 2005 01:23 PM
HTML Confirm VSnewbie Javascript How-To 3 August 30th, 2004 10:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.