单选按钮如何接起选择了哪一个 [英] Radio button how to pick up which one is selected

查看:82
本文介绍了单选按钮如何接起选择了哪一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在要解析的页面上有一个单选按钮,下面是getDF的cde,该cde应该解析并显示,但没有任何作用??

以下是解析rdusa1单选按钮的方法

<输入标题=" NAME ="vv" value ="lT1m6J0zdWek" id ="rdusa1" type ="radio" data-ms ="7 :1:1"data-md =" tt>

< label for id ="rdusa1"> 立即开始</label>




假定下面的代码为utton radio解析了上面的代码

Hello Guys I have following radio button on a page i am trying to parse, below is the cde for getDF that is suppose to parse it and display but it is not working any ideas??

Following is supposet to parse rdusa1 radio button

<input title="" NAME="vv" value="lT1m6J0zdWek" id="rdusa1" type="radio" data-ms="7:1:1" data-md="tt" >

<label for id="rdusa1">TF NOW</label>




Following code is suppose to parse the above code for radio utton

public static void getdf(Vector deliveryElements, String pageHTML, monitorSite msObj)
    {
       
 
            Matcher mDel = Pattern.compile("<input title=\"\" NAME=\"vv_delivery_choice\" value=\"(.*?)\" id=\"rdusa(.*?)\"<\\/label>", 2).matcher(pageHTML);
            do
            {
              
Basically trying to find out which radiobitton is selected like rdusa1, or rdusa2 etc

推荐答案

对于您的信息,按钮或任何其他控件都不需要解析.我不明白这个问题到底有什么问题,但是目前,从第一个版本开始,这似乎没有多大意义.也许这可以给您一个想法: http://en.wikipedia.org/wiki/Parsing [ ^ ].

—SA
For your information, buttons or any other controls do not need parsing. I don''t understand what exactly wrong with this question, but right now, as of first version, it does not look like making much sense. Maybe this can give you an idea: http://en.wikipedia.org/wiki/Parsing[^].

—SA


您需要创建一个Actionlistener.它可以是GUI类本身(button.setSelectionListener(this)),也可以是GUI元素旁边的一个类来执行逻辑部分(button.setSelectionListener(getGUIController());)
好处:如果事后更改了GUI布局,那么令人讨厌的东西就不会受到影响.

对于单选按钮,您很可能需要SelectionListener SelectionAdapter -我更喜欢Listener-Pattern.

有关ActionListener的教程 [
You need to create an Actionlistener. it can be the GUI-Class itself ( button.setSelectionListener(this) ), or better a class beside the GUI-Element to do the logical part ( button.setSelectionListener(getGUIController()); )
Benefit: if you change the GUI Layout afterwards, the pogic remains untouched.

For Radiobutton you''ll most likely need a SelectionListener or SelectionAdapter - I prefer the Listener-Pattern.

Tutorial on ActionListener[^]


这篇关于单选按钮如何接起选择了哪一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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