views:

44

answers:

1

If you work in netbeans you pretty much know the context menu entry "view servlet" on an jsp file. What it does is show you the generated servlet java code from the jsp.

Is there something similar in eclipse?

A: 

Is there something similar in eclipse? Well, yes and no.

To detail a little bit. When you have a project with JSP files and you also have a "Server view" (I will refer to Tomcat since that is what I have used a lot, not sure about other types of servers but the same principle should apply), the generated servlets for JSP files are located in the workspace folder, under:

WorkspaceFolder\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\[yourAppName]\org\apache\jsp\

If you have a standalone Tomcat server, you will find these in the work forder, under:

tomcatFolder\work\Catalina\localhost\[yourAppName]\org\apache\jsp\

These folders are not visible in the Eclipse project but you can browse them on disk. The JSP name is somewhat preserver so it is easy to find them (index.jsp is usually retainded as index_jsp.java, paths are preserved).

You can also see these files in Eclipse with the proper plugin installed. For example, I once used the Sysdeo Eclipse Tomcat Launcher plugin for that. This simple plugin shows the content of the work folder inside the Eclipse project and you can browse the servlets directly in Eclipse but this is only available if you have a "Tomcat project" setup.

Hope this helps. Cheers.

dpb