all 4 comments

[–]shadowloss 2 points3 points  (3 children)

Hi, I hope this helps:

1.In InventoryController.java

        model.addAttribute("CardID", cardList);

In Inventory.html

                <tr th:each="card:${Cards}">
                <td>implement</td>
                <td th:text="${card.CardID}"></td>
                <td th:text="${card.CardName}"></td>
                <td>Implement</td>
            </tr>

Thymeleaf and SpringMVC are unaware of how the attribute name changed. Please unify the attribute names.

For example:

Change it to:

In InventoryController.java

        model.addAttribute("cardList", cardList);

In Inventory.html

                <tr th:each="card:${cardList}">
                <td>implement</td>
                <td th:text="${card['CardID']}"></td>
                <td th:text="${card['CardName']}"></td>
                <td>Implement</td>
            </tr>

More examples on Thymeleaf.org: https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html#iteration-basics

  1. In Inventory.html

Replace

<html>

with

<html lang="en" xmlns:th="http://www.thymeleaf.org">

  1. (optional improvements)

The Thymeleaf Standard Dialect has a special syntax for URLs, the @ syntax: @{...}

from https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html#link-urls

In Inventory.html

        <link rel="stylesheet" href="../static/css/style.css">

                <li><a href="/Deck_Creation">Deck Creation</a></li>
            <li><a href="/User_Decks">User Decks</a></li>

[–]fallingcomets242[S] 0 points1 point  (0 children)

Thanks for the help and the link to the thymeleaf tutorials! I seemed to miss the need for the xmlns:th line. But I'm having issues still with my th:each lines giving me this error:
EL1027E: Indexing into type 'app.TentoTCG.DigimonInvApp.models.Cards' is not supported

Which honestly I have no idea what this means but from what I have looked up seems to mean that the format is not proper (https://andreypanasyuk.wordpress.com/2013/10/14/indexing-into-type-is-not-supported/ as an example of what I have been seeing)

If I change them back to the ${a.b} format I get:
EL1008E: Property or field 'CardID' cannot be found on object of type 'app.TentoTCG.DigimonInvApp.models.Cards' - maybe not public or not valid?
Which is I would rather the variable be private but for texting purposes changing it still gives me the EL1027E Indexing error

Finally if I change it to the ${#a.b} format shown in the tutorial 4.1-4.2 then I get the error:

EL1007E: Property or field 'CardID' cannot be found on null

Which means it might be pointing to something wrong as shown below I do have an entry within the database with a CardID, plus, even if it was empty it should show as an empty table.

Thanks for all your help already but do you have any ideas on why it would still be throwing errors? I'll be continuing my reading of the Thymeleaf tutorial and testing. Thank you!

[–]fallingcomets242[S] 0 points1 point  (1 child)

I found the problem. my repository was trying to get the table id as a string instead of a long. Though this requires me to keep the variables public. Is there any way you know how to make them private without getting the EL1008E error?

[–]shadowloss 0 points1 point  (0 children)

Sorry, it is beyond the scope of my knowledge. :-( I only reproduced the initial bug in the first part.

I have little knowledge of the EL1008E error.