如何在java中将3个单选按钮值插入数据库 [英] How can I insert 3 values of radio button into database in java

查看:151
本文介绍了如何在java中将3个单选按钮值插入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How can i insert radio button values into database? 
Hi to all
I have three radio buttons .. and i want to insert one radio button values which i will click ....give me some code....

What I have tried:

<pre lang="java">if condition

推荐答案

在您的问题中只有很少的上下文,唯一真正要回答的是如何在java中进行数据库插入。并且看到至少有大量的教程,我将把你推荐给其中一个。



JDBC - 插入记录示例 [ ^ ]
Well with very little context in your question, the only thing really to answer is how to do a database insert within java. And seeings there are at least a gazillion tutorials I will just refer you to one of these.

JDBC - Insert Records Example[^]


目前还不清楚,因为您没有提到这些单选按钮的来源,这些是基于Spring的控件还是其他Java基于EE的HTML网页,JSP或完全不同的东西。一种方法就是这样, java - 如何获得buttonGroup的所选radioButton的值 - Stack Overflow [ ^ ],检查单选按钮是否被选中......但它完全取决于您的情况。



你需要做的只是捕获该单选按钮的值 - 如果可以选择多个单选按钮,那么我想你需要更改单选按钮复选框。获得单选按钮(或单选按钮组)的值后,只需使用正常的 INSERT INTO 命令保存它(正如Richard在评论中提到的那样你的问题)。
It is unclear because you did not mention where those radio buttons are coming from, are these Spring based controls, or other Java EE based HTML web pages, JSPs, or something entirely different. One way to do that is like this, java - How to get value of selected radioButton of buttonGroup - Stack Overflow[^], checking if the radio button is selected... But it can entirely depend upon your case.

All you need to do is, just capture the value for that radio button—if multiple radio buttons can be selected, then I guess you need to change the requirement from radio button to check box. Once you have the value of the radio button (or the radio button group), just save it using a normal INSERT INTO command (as Richard mentions in the comment to your question).


这篇关于如何在java中将3个单选按钮值插入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆