Categories
Java

Eclipse not showing you pop-up JavaDoc?

If you are using Eclipse and it does not show you the JavaDoc information as you would have expected it to, maybe it is using the wrong Java Runtime (JRE).

To fix this open Eclipse’s Preferences (under the Window menu). Click on + sign next to ‘Java’ and click on ‘Installed JREs’. Now, click ‘Add’ and a window will open. From it, click ‘Browse’ next to the box saying ‘JRE Home directory’ and in the window that will open, traverse the directory structure and select the root folder for your installation of your Java SDK. Select it and click OK. The rest of the form in the window will be populated automatically and your JavaDocs will suddenly be more helpful.

Kudos to Rob for finding this one.

Share
Categories
Java

JSP and dynamic page includes

Coming from the warm sticky confines of ColdFusion development, one gets used to a nifty – and at the time – natural – way of including code dynamically within one’s application. What I am talking about is the ability to tell the server to include a file using a variable name. The server then reads the file, interprets and executes its contents and you separate as friends. In ColdFusion, it looks like this:

<cfinclude url="#var_with_name_of_file_to_include_and_run#">

JSPs have three facitilities to try and do the same thing:
<%@include ... > allows you to include a file statically and have it run. This means that when the JSP is loaded for the first time, and is compiled into a servlet, the include is dropped into the JSP prior to compilation and is compiled into the resulting servlet. If you change the included file, the change will not be reflected. The problem with this otherwise great option is that it cannot get the name of the included file dynamically, as in a variable, as it needs to know the name of the file to include and compile.

Facility number two: <jsp:include ... > does a similar thing: it includes the file into the JSP code but does so every time from scratch, when the page is loaded. If the included file is chagned, the change will be reflected. You can even specify the name of the file dynamically. Problem here is that the included file, even if it is a JSP, will not be executed or parsed and will appear in source form inside the enclosing JSP. This sucks.

The third facility addresses a deficiency that apparently really bothered someone: <jsp:include ... > does not allow you to include files from other contexts, but only files that can be referred to relatively. So when JSTL came into being, its core library’s import tag allows that access to outside-of-context files. But neither can this newer tag offer the dynamic inclusion and execution of files.

The outcome, we found a different path to rendering our pages dynamically, where instead of putting the dynamic content inside the navigation and graphics, we put the navigation into the file we intended to include. Getting there, though, was frustrating and this feels like somewhat of a glaring shortcoming of JSP.

Share
Categories
Java Web Development

MyEclipse Headache – Removing WebProject Capabilities

After braving the upgrade to Eclipse 3.0 and installing MyEclipse we felt like we enjoyed using it and that it was benficial, especially its very very very cool ability to edit and text-complete JavaScript and HTML.
Still, we are unable to make it work properly with JSTL tags, which it could in previous releases.

So I went ahead and clicked on ‘Add WebProject Capabilities’ to the project from the MyEclipse context menu (right-clicking the project folder). This did not help. Worse, it forced me to have a WEB-INF folder no matter what. I would delete it and it would reappear. Grrrreat.

There is no way to remove WebProject Capabilities either. You gotta love one-way settings. After 20 aggravating minutes, the following surgery did the job:

1. Close Eclipse.
2. Edit the .project file and remove any elements that mention of Genuitec (the company builds MyEclipse).
3. Edit the .classpath file and remove WEB-INF from the classpath.
4. Restart Eclipse and right click the project folder
5. In the ‘Java Build Path’ screen, remove WEB-INF from the Output Folder settings and choose a different destination.
6. Delete the WEB-INF folder.

Phew!

Share
Share