0
votes

My Grails index.gsp (domain class's view) throws an error 500: "Could not resolve view with name '/someClass/auth' in servlet with name 'grailsDispatcherServlet' "

I have defined an empty action def auth={} in my controller and there is nothing but a text field and a button with g:form action 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&hellip;"/></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>
1

1 Answers

1
votes

Assuming that the gsp is in /user/index.gsp, by convention, grails expect UserController and a method called auth. If the auth method is in different controller, make sure you add the name in the controller attribute of g:form

<g:form controller="<controller-name>" action="auth">