Given the following controller:
@Controller
public class LandingPageController {
@RequestMapping(value = "/landingPage", method = RequestMethod.GET)
public String landingPage(Map<String, Object> model) {
model.put("page", new LandingPage());
return "landingPage";
}
}
This would be my jsp:
<c:forEach items="${page.links}" var="link">
<a href="${link.reference}">${link.label}</a>
</c:forEach>
IntelliJ shows the following warning:
Cannot resolve variable 'page'
Using the quickfix, IntelliJ adds:
<jsp:useBean id="page" scope="request" type="com.myApp.LandingPage"/>
This in return leads to a duplicate variable exception on loading the site.
Now my question:
How can I define the variable in JSP (including its type) without creating a duplicate?**