views:

142

answers:

1

When running my Grails 1.1-M2 app as a WAR under Geronimo 2.1.4 (jetty6, javaee5), the HTML generated from the GSPs do not include my dynamic content.

Specifically, this GSP snippet:

<tr class="prop">
    <td valign="top" class="name">
        <label for="type">
            <g:message code="album.type.label" default="Type" />
        </label>
    </td>
    <td valign="top" class="value ${hasErrors(bean:albumInstance,field:'type','errors')}">
        <g:select  from="${AlbumType?.values()}" value="${albumInstance?.type}" name="type" ></g:select>
    </td>
</tr>

...produces this HTML when running under Geronimo:

<tr class="prop">
    <td valign="top" class="name">
        <label for="type">
            Type
        </label>
    </td>
    <td valign="top" class="value ">
        <select name="type" id="type" ></select>
    </td>
</tr>

...however when running as 'grails run-app' or 'grails run-war', this, correct HTML is produced:

<tr class="prop">
    <td valign="top" class="name">
        <label for="type">
            Type
        </label>
    </td>
    <td valign="top" class="value ">
        <select name="type" id="type" >
            <option value="EP" >EP</option>
            <option value="LP" >LP</option>
            <option value="SINGLE" >SINGLE</option>
        </select>
    </td>
</tr>

AlbumType.groovy is defined in src/groovy as:

public enum AlbumType {
    EP,
    LP,
    SINGLE
}

I've turned on all logging within Grails and don't see any error or exceptions. This issue is confusing as I only see it while running my Grails WAR under Geronimo. Granted, I haven't tried any other app servers though it is curious that everything works fine with 'grails run-app' and 'grails run-war'.

Any ideas as to the problem?

+2  A: 

I would highly recommend keeping code out of the the default package and putting it into a good package structure. I suspect this is your issue.

Rhysyngsun
This was indeed the issue. Once I moved AlbumType to a package under src/groovy and imported it in the gsp, all was well. Thanks!
shek