【问题标题】:If else condition for button, GrailsIf else 按钮​​的条件,Grails
【发布时间】:2012-11-06 08:51:19
【问题描述】:

我正在 Grails 中寻找用于 if/else 按钮​​的控制器代码。

当用户选择时,我有单选按钮的代码:

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


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

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

        }

这就是它的工作原理,但是对于按钮,当用户单击按钮时,它的 if 条件是什么。提前致谢。

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

【问题讨论】:

    标签: java grails if-statement gsp


    【解决方案1】:

    你想做什么? “actionSubmit”标签会将表单参数提交给名为“abc”的动作。

    class SomeController {
    
        def index() { }
    
    def abc() {
            log.debug("called abc")
        }
    }
    

    一些/index.gsp

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-06
      • 2020-09-15
      相关资源
      最近更新 更多