Sunday, March 1, 2009

WebSphere Portal : How to get the generated java source for a JSP file

When debugging problems related to JSP files, it is often important to get the generated Java™ source for the JSP. This document describes various techniques in getting the Java source generated for the JSP file.

Resolving the problem
Depending on where you are in the J2EE Application Life Cycle, you can do this using various methods. In the cases below, the generated Java source for all newly compiled JSP files will be stored in the JSP scratch directory, which by default is the WebSphere_Home/temp folder. For more information, search for keepgenerated in the appropriate version of the WebSphere® Application Server Information Center.
If you are in development phase and using tools like WebSphere Studio Application Developer or Rational® Application Developer:
Open the deployment descriptor for the WebApplication.
Go to Extensions tab.
Add a new jsp attribute with name="keepgenerated" and value="true".
Save all changes.

If you have already deployed your application and are using JSPBatchCompiler to compile JSPs, then you can specify the keep generated option for the JSP batch compiler:

JspBatchCompiler enterprise_app_name web_module_name cell_name node_name server_name [-filename jsp_name] -keepgenerated true

If the application is already deployed and you do not want to use the JSP Batch compiler, you can modify the configuration file to do the same as in step 1, above:
Edit the ibm-web-ext.xmi located in WEB-INF file for the installed Web application.
Edit file in WebSphere_Home/config folder
Do NOT edit the file in WebSphere_Home/InstalledApps.
Add the line as shown below, indicated by bold and underline, after the webApp element in the same file:


name="keepgenerated" value="true"/>