DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17997>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17997 JspC's webapp switch does not expand package names Summary: JspC's webapp switch does not expand package names Product: Tomcat 4 Version: 4.1.18 Platform: All OS/Version: All Status: NEW Severity: Minor Priority: Other Component: Jasper AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I've noticed that when using JspC with the -webapp switch with a web application containing code in subdirectories, JspC places the generated java files in the correct subdirectory beneath the given output directory. For example: If I run: JspC -p com.company.myapp -d ./src/com/company/myapp -webapp ./jsp/myapp For file: myapp/mysubdir/myfile.jsp this file is generated: ./src/com/company/myapp/mysubdir/myfile_jsp.java but the package name is still: com.company.myapp rather than what I expected: com.company.myapp.musubdir This is fine and dandy so long as I don't also have a file named myfile.jsp in the myapp directory or the myapp/myothersubdir directory. Is there a reason that I'm overlooking as to why this should work this way? I've applied the following changes to my copy of JspC.java to discover whether the package name needs extending similarly to the output directory. Let me know what you guys think about this change. thanks, Stephen Aument This refers to the JspC in 4.1.12. 522,532d521 < public static String getPackageSuffix( String jspUri ) { < StringBuffer suffix = new StringBuffer(); < int lastIndex = jspUri.lastIndexOf( '/' ); < if ( lastIndex > 0 ) { < suffix.append( "." ); < suffix.append( jspUri.substring( 1, lastIndex ) ); < } < < return suffix.toString(); < } < 539,540c528 < this.setOutputDir( baseDir < + jspUri.substring( 0, jspUri.lastIndexOf( '/' ) ) ); --- > this.setOutputDir( baseDir + jspUri.substring( 0, jspUri.lastIndexOf( '/' ) ) ); 549,564c537,539 < < /* < * Here's what's different from the base class. We generate a < * tmpTargetPackage name from the targetPackage and the uri of the < * jsp page and set that as the servlet package name. < */ < String tmpTargetPackage < = targetPackage + getPackageSuffix( jspUri ); < < if (tmpTargetPackage != null) { < clctxt.setServletPackageName(tmpTargetPackage); < } < /* < * End of changes. < */ < --- > if (targetPackage != null) { > clctxt.setServletPackageName(targetPackage); > } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]