I am writing a web-server using Tomcat. The tech i decided to use is JSTL.
I want to first say that it works, the page displays successfully and everything runs. I do like to get rid of warnings. The warning i get from intelliJ is: "Cannot resolve variable ''", it comes from a JSP page where i have some JSTL code. The jsp page is called from my controller using RequestDispatcher forward function.
request.setAttribute("resultsModel", resultsModel);
request.setAttribute("times", times);
request.setAttribute("emailErr", emailErr);
request.setAttribute("qid", id);
RequestDispatcher view = request.getRequestDispatcher("ShowResults.jsp");
view.forward(request, respone);
The JSP page then uses this variables in a variety of JSTL tags, example from page:
<c:choose>
<%-- When database access was succesfull --%>
<c:when test="${resultsModel != null}">
<c:choose>
<%-- When the job ID exists --%>
<c:when test="${resultsModel.jobEntity != null}">
ect...
The warning is then given on those positions where i try to access resultModel. I tried adding a jsp:useBean tag as such:
<jsp:useBean id="resultsModel" scope="request" type="bgu.bioinf.rnaSequenceSniffer.Model.ResultsModel"/>
But I still get a warning. Any idea? Something i am doing really wrong? Thanks!
I meet this question too, and really bother me.
Today I googled this problem and find no solution.
However I used the ModelMap
rather than HttpServletRequest
.
map.put("info",info);
And no doubt I got this warning,then I changed the method:
map.addAttribute("info",info);
I want to say this way does solve the warning,you can even ctrl
+ button1
to navigate the bean in the controller.
I don't know if this solve the problem in other scenario,But in intellij 2018.1 I just get rid of it.Hope it works for you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With