can I control eclipse jsp validation? - eclipse

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.

Related

Eclipse plugin for better JSP support

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.

JSF Managed Bean Code Assist Eclipse

Is there a way within Eclipse (MyEclipse specifically) to have code assist functionality within a JSF (or XHTML, or JSP, etc) file where I am attempting to access managed bean properties?
See section 8.1.2.1.2.2. Content Assist Based on Project Data # http://docs.jboss.org/tools/2.0.0.GA/jsf/en/html/jbds_editors.html for clarification.
The docs you referenced are a perfect way to achieve way you need. Contrary to what its name may suggest, JBossTools is universally useable without the need to deploy to JBoss or otherwise have any JBoss specific things in your code.
The only thing is that MyEclipse, being a massively modified Eclipse, will probably not work together with JBossTools (but actually it is supposed to offer exactly this kind of functionality already).

JSP: Tag library Intellisense problem in Eclipse

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

Eclipse JSP editing with WTP doesn't find variable and class definitions

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.

Eclipse - Is it possible to link to a file from within a Java comment?

I am looking for a way to link from a comment inside a .java file to another file somewhere in the project folder (like CMD-clicking a Java Type links to the Type declaration). In my case I am working on a (Spring Roo backed) web application, so I have controllers and view files.
What I have in mind may look like this (Javadoc-oriented but of course not parsed but used directly as a link):
public String orderlist(ModelMap modelMap){
modelMap.addAttribute("orders", Order.findAllOrders());
// #link("/WEB-INF/views/order/list.jspx")
return "order/list";
}
I want to CMD-click on the comment link to open the file.
I am heavily using Working Sets, filters and of course CMD+SHIFT+R ("Open Resource"), which are all great, but this might come in handy working on a controller and the corresponding view (especially in a team). Is this possible somehow, a basic feature that I missed completely so far or even total nonsense for some reason? I realize that those links should be considered when, for example, refactor|move the view file.
The feature you're describing is Eclipse's hyperlink detectors: http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_workbench_texteditor_hyperlinkDetectors.html. Unfortunately I'm not sure an implementation as you're describing is likely available.
There's an URLHyperlinkDetector that can pick up URLs, so you could potentially put a file:// URL in a comment and link to that, but I think that Eclipse is hard-wired to assume it's something that can be opened in it's browser. It's worth a shot, but of course the absolute paths would break sharing across teams/machines.
You could try your hand at contributing your own via a plugin that your team could install. Here's an implementation we created in Aptana Studio for picking up relative URIs in files and opening them in editors if possible: https://github.com/aptana/studio3/blob/development/plugins/com.aptana.editor.common/src/com/aptana/editor/common/text/hyperlink/HyperlinkDetector.java