My Grails index.gsp(域类的视图)引发错误500:"Could not resolve view with name '/someClass/auth' in servlet with name 'grailsDispatcherServlet' "
我在我的控制器中定义了一个空动作def auth={}
,除了文本字段和g:form
动作auth
/user/index.gsp:
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main" />
<g:set var="entityName" value="${message(code: 'someClass.label', default: 'SomeClass')}" />
<title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
<g:form action="auth">
<a href="#list-someClass" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content…"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
<g:if test="${flash.message}">
<div class="message" role="status">${flash.message}</div>
</g:if>
<input type="submit" value="login"/>
</g:form>
</body>
</html>
答案 0 :(得分:0)
假设gsp在/user/index.gsp
中,按照惯例,grails期望UserController
和一个名为auth
的方法。如果auth
方法位于不同的控制器中,请确保在g:form
的控制器属性中添加名称
<g:form controller="<controller-name>" action="auth">