For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 7 replies, 2 voices, and was last updated 20 years, 11 months ago by
rogue_dev.
-
AuthorPosts
-
rogue_devMemberWe are using several JSP fragments to organize our JSP pages. When I press CTRL-SHIFT-F (format) in the body JSP file, the formatter deletes the lines containing the include statements and replaces them with a single letter. In the test case below, the letter is ‘j’. In our production code the letter is ‘c’. The test case is a stripped down versino of the files we use.
The file “_setup.jspf”
<%@ page language="java" import="java.util.HashMap" %> <% // try to prevent all caching! response.addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT"); response.addHeader("Cache-Control","no-store, no-cache, must-revalidate"); response.addHeader("Cache-Control","post-check=0, pre-check=0"); response.addHeader("Cache-Control","private"); response.addHeader("Pragma","no-cache"); %>The file “_header.jspf”
<%@ page import="javax.servlet.http.HttpSession"%> <%@ page import="java.util.Iterator"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Strict//EN" SYSTEM "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-strict.dtd"> <html> <head> <title><%= pageTitle %></title> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="Author" content="RCMP" /> <meta name="Copyright" content="CopyRight" /> </head> <body onload="app_page_setup()"> <center> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><!-- content starts --> <table border="0" width="100%"> <tr> <td> <!-- content starts -->The file “_footer.jspf”
<!-- content ends --> </td> </tr> </table> </td> </tr> </table> </body> </html>The file “test.jsp”
<%@ include file="_setup.jspf"%> <% String pageTitle = "Page Title"; %> <%@ include file="_header.jspf" %> The page title is <%= pageTitle %> <%@ include file="_footer.jspf"%>Place all the files in their own directory, open test.jsp, then format the code.
August 31, 2005 at 5:02 pm #236292
Brian FernandesModeratorrogue_dev,
We fixed this issue in ME 4.0GA which was released on 29th of August. Are you using 4.0GA?
For those who aren’t using 4.0GA, the work around is to include each import directive on a separate line.
dont’ use
<%@ page language="java" import="java.util.HashMap" %>use
<%@ page language="java" %> <% import="java.util.HashMap" %>instead.
You seem to be already doing this for _header.jspf, are you sure you experience issues with that document as well?
Hope this helps, let us know if you experience further issues,
Best,
Brian.August 31, 2005 at 6:15 pm #236293
rogue_devMemberOk, d/l 4.0GA, uninstalled 4.0M3, deleted \eclipse 3.1.
unzipped Eclipse 3.1, installed MyEcplise 4.0GA
Opened the test.jsp, then did a format. The result is:
java.util.HashMap <% String pageTitle = "Page Title"; %> javax.servlet.http.HttpSession The page title is <%= pageTitle %> <%@ include file="_footer.jspf"%>August 31, 2005 at 6:21 pm #236294
rogue_devMemberFound another problem.
In the file _header.jspf, the last line does not have a cr/lf after it:
<!-- content starts -->If I do a format on it, the line becomes:
<!-- content starts -- >If I add a blank line after it:
<!-- content starts -->then it formats OK.
September 1, 2005 at 12:11 am #236312
Brian FernandesModeratorrogue_dev,
I was able to easily replicate the issue when the file did not terminate with a newline.
I could not replicate the <% include %> problem, but we have opened the issue for internal investigation.
I’m sorry I misread your original post as “imports being truncated” instead of “includes being truncated” becuase we fixed the former in 4.0GA.
In the meanwhile, you can right click the file in the Package Explorer, and choose Format from the MyEclipse context menu. Does that work for you?
Sorry for the inconvenience,
Regards,
Brian.September 1, 2005 at 9:30 am #236358
rogue_devMember@Support-Brian wrote:
In the meanwhile, you can right click the file in the Package Explorer, and choose Format from the MyEclipse context menu.
Interesting.
– RMB in the editor does not give any options to format the code.
– CTRL-SHIFT-F while the editor has focus causes the problem
– Choosing the menu item Source > Format > Document causes the problem
– RMB on the file in Package Explorer, then MyEcplise > Format document opens a dialog stating that the format was successful, and the file is properly formatted.So it appears that if I invoke the formatter using the Ecplise “path”, that is CTRL-SHIFT-F or Source > Format > Document , then the error appears, but if I explicitly call the MyEcplise formatter, then it works.
September 1, 2005 at 9:43 am #236363
Brian FernandesModeratorrogue_dev,
Yes, that’s becuase two different formatters are involved 🙂
CTRL+SHIFT+F and Source > Format > Document use the same formatter, but the one in the Package Explorer is another formatter. Both are MyEclipse formatters though.
Are you satisfied with the formatting that the working formatter performs? I found the former better in some ways (except for this bug, of course), but maybe that’s just me.
The matter is under investigation already,
Regards,
Brian.September 6, 2005 at 9:12 am #236675
rogue_devMemberAre you satisfied with the formatting that the working formatter performs?
Sort of. I try not to use the formatter in JSP’s as it changes indenting, etc. It is NOT a big deal for me.
However, I almost always hit CTRL-SHIFT-F, CTRL-SHIT-S int he Java code (format, save all). This has become somewhat of a “finger-macro” for me. So when I am in a JSP, the same finger actions occur. And code gets deleted, and I am really thankful for CTRL-Z 🙂
I had assumed that since I am using the MyEclipse JSP editor, that the MyEclipse JSP formatter would be invoked.
Ok, now I understand where the errors are coming from. Thanks.
-
AuthorPosts
