0

I have an application which should display data about singers, taken from MySQL datbase. However, when I launch the app and open my browser I see nothing but ${singer.firstName}, ${singer.lastName}, ${singer.birthDate}. Changing isELIgnored to false, which was recommended by other stackoverflow users, did not help. JSPX page looks like this

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:spring="http://www.springframework.org/tags" version="2.0">
    <jsp:directive.page language="java" contentType="text/html;charset=UTF-8" isELIgnored="false"/>
    <jsp:output omit-xml-declaration="yes"/>

    <spring:message code="label_singer_list" var="labelSingerList"/>
    <spring:message code="label_singer_first_name" var="labelSingerFirstName"/>
    <spring:message code="label_singer_last_name" var="labelSingerLastName"/>
    <spring:message code="label_singer_birth_date" var="labelSingerBirthDate"/>

    <html>
    <head><title>Title</title></head>
    <body>
    <h1>${labelSingerList}</h1>
    <c:if test="${not empty singers}">
        <table>
            <thead>
            <tr>
                <th>${labelSingerFirstName}</th>
                <th>${labelSingerLastName}</th>
                <th>${labelSingerBirthDate}</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${singers}" var="singer">
                <tr>
                    <td>${singer.firstName}</td>
                    <td>${singer.lastName}</td>
                    <td>${singer.birthDate}</td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </c:if>
    </body>
    </html>
</jsp:root>

Message codes are for internationalization. Since I already tested the app without them, they don`t affect results I get.

EDIT: I`ve changed the content of my jspx page according to http://www.hs-augsburg.de/homes/meixner/saj/skript/architektursichten/examples/roodemo/pizza/src/main/webapp/WEB-INF/views/base/list.jspx but got new mistake. Every time I launch the app and log in, I get message This XML file does not appear to have any style information associated with it. The document tree is shown below. The logic of the program itself was not changed. Here is new content

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:c="http://java.sun.com/jsp/jstl/core"
     xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
     xmlns:jsp="http://java.sun.com/JSP/Page"
     xmlns:spring="http://www.springframework.org/tags" version="2.0">
    <jsp:directive.page contentType="text/html; charset=UTF-8" isELIgnored="false"/>
    <jsp:output omit-xml-declaration="yes"/>

    <spring:message code="label_singer_list"
                     var="labelSingerList"/>
    <spring:message code="label_singer_first_name"
                    var="labelSingerFirstName"/>
    <spring:message code="label_singer_last_name"
                    var="labelSingerLastName"/>
    <spring:message code="label_singer_birth_date"
                    var="labelSingerBirthDate"/>

    <h1>${labelSingerList}</h1>

    <c:if test="${not empty singers}">
        <table>
            <thead>
            <tr>
                <th>${labelSingerFirstName}</th>
                <th>${labelSingerLastName}</th>
                <th>${labelSingerBirthDate}</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${singers}" var="singer">
                <tr>
                    <td>${singer.firstName}</td>
                    <td>${singer.lastName}</td>
                    <td>${singer.birthDate}</td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </c:if>
</div>
4
  • You haven't defined the singer object. If it a java class where is the import? Commented Aug 14, 2020 at 9:32
  • Singer object is created via data in my database. In fact, I have not one, but three Singer objects Commented Aug 15, 2020 at 11:04
  • 1
    hs-augsburg.de/homes/meixner/saj/skript/architektursichten/… shows an example with jspx . In my eyes you went a wrong or incomplete way to show the result. Commented Aug 17, 2020 at 9:27
  • Ok, I`ve changed my file into what you recommendet. Now I keep getting This XML file does not appear to have any style information associated with it Commented Aug 22, 2020 at 15:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.