1

I recently encounter some problems with compiling JSP to Servlets. The reason I want to convert JSP to servlets is that I want to do static analysis on the Java code.

I got the compiled Java files in Tomcat (i.e., I know where Tomcat keeps the Java files compiled from JSP), but the compiled files lost the actual Object names.

For example, it is what I saw from the Tomcat compiled servlet java file:

 private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fdatatables_005ftable_0026_005ftheme_005frow_005fpaginate_005finfo_005fid_005fexport_005fdata_005fcssClass_005fcdn;

Is there any way that I can remove the Jasper abstraction and find the actual Object type?

Thank you very much for your help in advance.

user17109
  • 11
  • 1
  • 4
  • You can also find the generated .java files, see [here](http://stackoverflow.com/questions/8701699/where-are-the-generated-jsp-class-files-located). And then there are separate JSP compilers to precompile in the IDE; in Stack Overflow too. – Joop Eggen Aug 01 '13 at 17:25
  • `/work/Catalina/localhost//org/apache/jsp/` – Ravi K Thapliyal Aug 01 '13 at 17:34
  • JSP to servlets like bytecode to java, if you want servlets then write it by hand. – Roman C Aug 01 '13 at 17:53
  • Still not quite understanding what you want. I would say that `TagHandlerPool` *is* the actual object type (it's part of Jasper's implementation of JSP), and `_005fjspx_005ftagPool_005fdatatables_005ftable_0026_005ftheme_005frow_005fpaginate_005finfo_005fid_005fexport_005fdata_005fcssClass_005fcdn` is the name of the variable. Which one are you having trouble with? – erickson Aug 01 '13 at 18:04
  • Or maybe you are trying to find the implementation class of the tag that is pooled in this object? In that case, I'd look for a downcast at the point where an instance is retrieved from the pool. – erickson Aug 01 '13 at 18:11
  • @erickson Sorry for the confusion. I want to see if it is possible to get the Object name/mapping of the implementation class. So, for example, I want to know if I can map `private org.apache.jasper.runtime.TagHandlerPool` to org.myPackage.User (a User object defined in the application). – user17109 Aug 01 '13 at 18:19
  • I'm not familiar with Jasper's name mangling, but what you have here is a reference to a pool of JSP tags. I think the tag in question is `datatables:table`, with `theme`, `row`, `paginate`, etc. attributes set. Are you putting your `User` object into the request attributes? You should search the generated code for corresponding `getAttribute()` calls. – erickson Aug 01 '13 at 19:12

0 Answers0