1

Full error is:

Error during execution of processor 'org.thymeleaf.spring4.processor.attr.SpringInputGeneralFieldAttrProcessor' (search:12)

My search.html page displays when I have:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <!--<meta charset="UTF-8">-->
    <title>Search Users</title>
</head>
<body>

<h3>Search Users</h3>
<form th:action="@{/user/search}" th:object="${searchCriteria}" method="post">
<p>First Name: <input type="text" value="*{firstname}"/></p>
<p>Last Name: <input type="text" value="${searchCritera.lastname}"/></p>
    <br/>
    <input type="submit" value="search"/>
</form>
</body>
</html>

But I then changed value to th:field for *{firstname} and ${searchCritera.lastname} as below:

<form th:action="@{/user/search}" th:object="${searchCriteria}" method="post">
<p>First Name: <input type="text" th:field="*{firstname}"/></p>
<p>Last Name: <input type="text" th:field="${searchCritera.lastname}"/></p>
    <br/>
    <input type="submit" value="Search"/>
</form>

Now I get the error above and can't seem to fix it. I tried th:value but it throws another error:

Exception evaluating SpringEL expression: "searchCritera.lastname" (search:12)

1 Answer 1

1

In general, when you're using dollar signs, use th::

<input type="text" th:value="${searchCriteria.lastname}"/>

And spell the variable name correctly.

Also include name= or th:field= as appropriate (or instead, depending on what you're trying to accomplish).

Sign up to request clarification or add additional context in comments.

Comments

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.