I'm using Eclipse (3.6.1 on OS X) to write Java and JSP. Unfortunately, our JSPs contain a lot of Java -- I'd prefer to keep as much Java as possible in .java files, but that won't change, at least for a while.
I recently installed the Web Tools Project (WTP) version 1.1 and 1.2 to get better functionality when editing JSP. However, it doesn't do many things I'd expect. E.g., I cannot select a class name in the JSP and hit F3 (unsure of the function name) to open the class definition. In addition, in many cases Eclipse/WTP isn't aware of variables and/or class definitions that are present in JSP files that include the file containing the variable or class reference. That is, it reports
" cannot be resolved to a variable", etc. I searched the Eclipse documentation -- especially http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.wst.doc.user/topics/overview.html -- for guidance on how to configure WTP to present this info, to no avail.
Thanks
Arthur
Unfortunately there's no way for Eclipse to be sure which main JSP file, if any, the fragment file you're editing is included in, and should be used for this purpose.
Related
In my current project I'm working with Java, Spring Boot and .aj files. However, the main problem about work with AspectJ is that there are not a lot of IDEs that supports this feature.
Eclipse (and i think that netbeans too) supports the AspectJ language because I've used it in the past. However, I've worked with IntelliJ and Visual Studio Code IDEs during the last years and I don't really want to come back to Eclipse (or Netbeans). :)
Also, I know that the Ultimate Version of IntelliJ has support to AspectJ. The problem is that you must have an IntelliJ license to use it.
https://www.jetbrains.com/help/idea/enabling-aspectj-support-plugins.html
I started to create a new language server for the Visual Studio Code to manage the .aj files. I'm following this guide.
https://code.visualstudio.com/docs/extensions/example-language-server
The .aj files are now correct colored and shows a valid syntax!
However, I'm getting errors in the Java code. Check this schema about the AspectJ description:
As you could see, I have a .java file called Point and I want to have some methods divided in some .aj files. When the project is compiled, I'll have just one Point.class that includes the methods clone(), compareTo(), etc.
Also, another possible use is that if my .java class implements some interface, I'm able to implements the methods in a .aj file.
Problem: I'm not able to see my Java project without errors because the .java files and the .aj files are not "synchronized", so the .java class says that needs to implements some methods although they're defined in the .aj file.
Someone could help me with tips about language server development?
Regards,
I can't help you with VS Code <> AspectJ integration, but I could recommend a work-around with your issue. If my understanding is correct, you get errors because the methods declared through inter-type declarations by your aspects are not visible to your java code.
In that case you might try to create Java 8 interfaces with default methods that declare and implement those methods. I would try to get rid of the aspects altogether and work with just interfaces with default methods, but if - for some reason unknown to me - you really need to use aspects to implement those methods, you can still leave your default methods empty and move the implementation into the aspects. This way you don't need to use inter-type declarations anymore, so VS Code integration might work better.
I'm looking for an eclipse plugin which can at least search where the current JSP is included (or the path mentioned for example in custom "include like" tags or comment or anything). Similar like doing copy qualified name and do a file search with the correct path.In IDEA it's called Analyze Backward Dependencies and it works for JSPs too (at least for the standard includes).
A better one would be to show all the JSPs where the current one is included and show all the included JSPs recursively as a tree maybe so I can navigate in it easily. I'm not sure if this can be done to be usable (I think it would be slow).
Another feature I would like if I click on a variable's name it jumps to where it's declared with even if it's declared in a different JSP.IDEA can do this too.
I have a simple solution for the first one but I can't add more functionality to it as I'm not familiar with the eclipse plugin system and RCP and I don't really have time to learn it.
And please don't tell me to use IDEA because unfortunately that's not an option at work.
I am trying to develop a JSP application using Eclipse 3.6 Helios. Now I have defined a Tag Library Definition called DiceFunctions.tld inside the WEB-INF folder, and then declared this in a jsp page like this -
<%#taglib prefix="mine" uri="DiceFunctions"%>
When I write en EL function call inside that JSP, I don't get any auto-complete/intellisense for the prefix mine, which means if I add 10-20 tag libraries in a page, then I will have to remember each one of their names so that I can call their methods. Also the method signature's auto-complete isn't working properly, I mean when I type ${mine: } the IDE sometimes doesn't provide any suggestions for the functions defined inside that TLD. I need eclipse to provide intellisense for the tag library prefixes that I define and also for the functions defined within those TLDs. Also I couldn't find any way to create Tag Library Descriptor files (.tld) in eclipse. I had to create a general file and rename it so that it's extension becomes .tld.
Is there any way to modify eclipse to achieve those supports ? Is there a plugin which will be helpful ?
I have not used it myself but there is a plugin as part of the myeclipse suite which I have heard others rave about. They have a try-before-buy option. See http://www.myeclipseide.com/module-htmlpages-display-pid-11.html
This also looks promising: http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor
I was wondering whether it was possible for projects in Eclipse to have multiple languages associated with them, specifically PHP and Java. The purpose of this is that I'd like a common 'properties' file for the two projects.
If instead there's a way to hold a relative reference to a file so that both projects can reference the properties file, that will work too.
Part one of the question
whether it was possible for projects
in Eclipse to have multiple languages
associated with them, specifically PHP
and Java
No, a project in eclipse is language dependent. You could technically write some source in another language and then use another build method to compile from the secondary language - Not recommended !!!
For the second part of the question ...
Common Property files
Create another project and in that project put a java properties file.
Have both projects (Java and PHP) read the property file from here (In Java just add where you put the file as part of the classpath)
In PHP use this Java properties reader
If you are careful on how you write the Java properties file you could also use parse_ini_file
You could just place the properties you want the two languages to share into a plain text file. Then code a PHP file to read the plain text file, and code a Java file to read the plain text file. Be careful if you plan on having your two projects edit said-file though. If there's any chance that both of them could be editing the file at the same time, you're in trouble.
Apologies if this is a rehash of an earlier question that I can't find, but is there any way to stop eclipse (ganymede irc) flagging unresolved java references as a problem?
I have a web app that I want to deploy via eclipse in order to debug. However, it contains .jsp files including other .jsp files, which reference java objects defined in the includer e.g. (writing this from memory so the syntax will be all over the place):
includer.jsp:
<%String myname="bob"%>
<jsp:include check.jsp>
then
check.jsp contains
<% if ( myname.equals("bob") ..... etc
eclipse is validating check.jsp in isolation, doesn't like it, won't let me deploy.
I'm sure if I changed the filetype of check.jsp I could get it to work, but it's not my app and there load of other's like it that I'd rather not have to edit.
So, is there any way to configure the eclipse jsp validation to ignore the unresolved reference?
In your specific case Eclipse is quite right. The include page doesn't have any access to the scriptlet local variable of the parent page. Better use request attributes, you can use JSTL's c:set or a Servlet for this.
As to configuring the JSP validator of Eclipse, I've answered similar question shortly back. I wonder if you didn't see this topic in the list of possibly matched topics which popped up while you entered this question? Here it is: JSP EL (Expression Language) causing problems in Eclipse
Not to mention that using scriptlets is a bad practice. If you can, immediately stop using it and go ahead with taglibs/EL in JSP. It also less or more automagically forces you to write clean JSP code according the MVC ideology.