Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 29th, 2004, 05:18 AM
abhit_kumar abhit_kumar is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 22 abhit_kumar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 3 sec
Reputation Power: 0
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>

Reply With Quote
  #2  
Old December 29th, 2004, 10:13 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
I would suggest having your form submit to a confirmation form.

This form would have all the data from the first form in hidden fields [you could display their values in HTML as well if you want), as well as a Submit button labelled "Confirm".

This new form will submit to your JSP which handles the actual Database update.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > prob.. confirm message


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap