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 3rd, 2004, 05:40 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 in radio button

i have a radio button, i want to do that if i select that radio button then it displays Y in database and shows it, otherwise it shows N.

In my form it doesn't shows Y or N... but it shows hold(which is the value of hold button)..

In my oracle database its data type is CHAR(1)...

this is the radio button:

Hold <input type=radio name="hold" value="hold" >

and my form code is as follow:


<html>
<body>
<table>
<tr>
<td>

<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page language="java" import="java.sql.*" %>

<%
try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbcdbcf","scott","ttlscott");
System.out.println("got connection");

%>

<%

String action = request.getParameter("action");
if (action != null && action.equals("save")) {
conn.setAutoCommit(false);

PreparedStatement pstmt = conn.prepareStatement(
("INSERT INTO pay_header VALUES (?)"));

char pay_type;

if (request.getParameter("pay_type") != null) {pay_type = 'Y';} else {pay_post = 'N';}
pstmt.setString(1,request.getParameter("pay_type"));


pstmt.executeUpdate();
conn.commit();
conn.setAutoCommit(true);
}




%>


<%

Statement statement = conn.createStatement();


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





%>

<table>
<tr>
<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<th><input value="<%= request.getParameter("hold") %>" name="pay_type" size="15"></th>
<th><input type="submit" value="save"></th>
</form>
</tr>

<%

while ( rs.next() ) {

%>



<tr>
<form action="payment_save1.jsp" method="get">
<input type="hidden" value="save" name="action">
<td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
<td><input type="submit" value="save"></td>
</form>
</tr>


<%
}
%>
</table>



<%
// Close the ResultSet
rs.close();

// Close the Statement
statement.close();

// Close the Connection
conn.close();
} catch (SQLException sqle) {
out.println(sqle.getMessage());
} catch (Exception e) {
out.println(e.getMessage());
}
%>
</td>
</tr>
</body>
</html>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > prob in radio button


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