intellij not resolving el-variables within jsp-code inspection or autocomplete

My problem is similar to what is described here and a possible solution is given here. Unfortunately it does really solve my problem.I have a Spring MVC program which uses mav.addObject("results",  resultArray) to put Account array in a jsp file wich is processed there. The jsp file generates an XML file as output.
A snippet from the JSP file is:
<c:forEach var="index" begin ="1" end="10" >
        <resultvar name="resultset_<c:out value="${index}"/>_ppi_accountId"  type="string" value="${results[index-1].getAccountId()}"  />

Results resuts in this jsp being coloured beige. IntelliJ gives as error "This inspection reports possible EL problems, such as unresolved references and invalid EL locations". The solution suggested "helping intelliJ a hand like "<%--@elvariable id="results" type="java.util.List"--%>. If I do that in the JSP the beige color is gone. BUT autocompletion still doesn't work if I am at ${results[index-1]. and do Ctrl space I get "no suggestions".

For a collegue is does work for his program but perhaps in another context. I reinstalled IntelliJ 12.1.4 Ultimate just to be sure but to no avail.

1) Why is IntelliJ not able to guess what to do with auto complete (in this case).
2) What do I have to put in the @elvariableto get it to work. In my case its an array of Account object (which can contain other objects as well).

Remark: It also does not recognize simple stuff like inserting a  string into a JSP with addObject.
Remark: The program compiles corectly and works. Its just IntelliJ which gives warnings/errors which is suboptimal.

Any help/pointers is really appreciated. Without autocomplete I'm totally lost. It did not work with Eclipse but had high hopes IntelliJ would be able to handle this kind of stuff. I read that IntelliJ is very smart about this kind of stuff and basically "indexes the world".

Comment actions Permalink

Unfortunately, nobody has been able to help. I will create a skeleton of my program and gonna look when the problem vanishes. Perhaps a trick I had to do is causing that IntelliJ can't handle my setup.

I'm using a PropertySourcesPlaceholderConfigurer in Spring to read properties into the program. The properties are stored in a small database. When using them in the program I use constructs like
@Value("${getbalance.uri.sce}") // The ${} construction relates to properties.
private String url;

I noticed that url got as value the string "${getbalance.uri.sce", NOT the real value  of property getbalance.uri.sce which is something like http://<url>. I rtfm-ed and googled and found this solution. In my web.xml I have.




the spring-servlet.xml consists of the following entries.

  <bean id="viewResolver"
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".jsp"/>
<context:component-scan base-package="net.comsys.sce"/>

Not 100% sure how it works but I had to do this because otherwise I have apparently different applicationcontext for the webroot and for the <dispatcher> appilcation context.This resulted in the mentioned problems with @value.

Perhaps this borks the IntelliJ 'indexing the world' and results in the not resolving el-variables and name completion in jsp files.

Perhaps anyone has experienced my @value problem as well AND has a better solution which playes nice with IntelliJ. Again I'm hoping something someone can give me some hints and pointer. Having no name-completion etc in my JSP files is really totally suboptimal. Fingers crossed someone can help me out.

Comment actions Permalink

Could you please create ticket here and attach your project (you can set visibility to "idea-developers" to hide it from public)? Autocompletion should be supported here, so we can make sure there's no misconfiguration in your project's setup. Thanks.

Comment actions Permalink

Brilliant. Thanks will do that.This is REALLY appreciated.


Please sign in to leave a comment.