Hi, I want to know what is the different of this code when compiling
and execute in GAE.


<%
        EntityManager em = EMF.getInstance().createEntityManager();
        List<User> users = (List<User>) em.createQuery(
                        "SELECT FROM " + User.class.getName()).getResultList();
        request.setAttribute("rs", users);
        em.close();
%>

<display:table requestURI="displaytag.jsp" name="rs" export="true"
        sort="list" pagesize="10" class="display">
        <display:column property="id" title="User ID" sortable="true"
                headerClass="sortable" />
        <display:column property="name" title="User Name" sortable="true"
                headerClass="sortable" />
        <display:column property="gender" title="Gender" />
        <display:column property="aboutYou" title="About You" />
        <display:column property="country" title="Country" />
        <display:column property="mailingList" title="JOIN?" />
</display:table>

The above code is giving error code HTTP 500. However, when I change
to


<%
        EntityManager em = EMF.getInstance().createEntityManager();
        List<User> users = (List<User>) em.createQuery(
                        "SELECT FROM " + User.class.getName()).getResultList();
        request.setAttribute("rs", users);
        // em.close(); // just comment this line and move it down
%>

<display:table requestURI="displaytag.jsp" name="rs" export="true"
        sort="list" pagesize="10" class="display">
        <display:column property="id" title="User ID" sortable="true"
                headerClass="sortable" />
        <display:column property="name" title="User Name" sortable="true"
                headerClass="sortable" />
        <display:column property="gender" title="Gender" />
        <display:column property="aboutYou" title="About You" />
        <display:column property="country" title="Country" />
        <display:column property="mailingList" title="JOIN?" />
</display:table>

<%
        em.close();
%>


Then the JSP is running and show the result in displaytag table.

Anyone can explain why?

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=.


Reply via email to