I am trying to view some parameters in a jsp file. I send these parameters from a Java servlet with using the code below:
req.setAttribute("x", account.entities.getX());
req.setAttribute("y", account.entities.getY());
context.getRequestDispatcher("/Home.jsp").forward(req, resp);
In Home.jsp
file I want to view these parameters in a table and I used the code below:
<thead>
<tr>
<th>Header1</th>
<th>Header3</th>
</tr>
</thead>
<tbody style="text-align: center">
<tr>
<td>XName</td>
<td>${x}</td>
</tr>
<tr>
<td>YName</td>
<td>${y}</td>
</tr>
</tbody>
But when I run my web application on Tomcat Server, these parameters looks like exactly how I type these in jsp file. (This: ${y} ${x}
) And when I bring the cursor on these, I got this message: This inspection reports possible el problems such as unresolved references an invalid el locations.
In here, it says:
You can use Alt+Enter shortcut to invoke intention "Declare external variable in comment annotation" in order to get rid of "unresolved model attribute" in your views.
It automatically adds the below code when I try that:
<%--@elvariable id="x" type="What should be here"--%>
<%--@elvariable id="y" type="What should be here"--%>
But I do not know what to write in type part and I am not sure if it is the right solution or not. What should I do?