简体   繁体   English

如果按钮的其他条件,Grails

[英]If else condition for button, Grails

I'm looking for controller codes in Grails for buttons if/else. 我正在Grails中寻找控制器代码(如果/其他)。

I've got the codes for radio button, when the user selects : 当用户选择时,我已经有了单选按钮的代码:

<g:radio name="myGroup" value ="input2" />


if (request.getParameter("myGroup").equals("input1"))
        {

        println("asdasdasdasdasdhelloipass")
        redirect (action: radio)

        }

This is how it works, but for buttons, what is the if condition for it when the user click on the button. 它是这样工作的,但是对于按钮,当用户单击按钮时,if条件是什么? Thanks in advance. 提前致谢。

 <g:actionSubmit value="Submit" action="abc"/>

What is it that you're trying to do? 您想做什么? The "actionSubmit" tag will submit the form parameters to an action called "abc". “ actionSubmit”标签会将表单参数提交给名为“ abc”的操作。

class SomeController {

    def index() { }

def abc() {
        log.debug("called abc")
    }
}

some/index.gsp 一些/ index.gsp

<html>
    <head>
    </head>
    <body>
        <g:form>
            <g:actionSubmit value="blah" action="abc"/>
        </g:form>
    </body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM