The JSP formatter and indentation has a bunch of problems.
Here is one easy to describe. If I have some java code inside <% %> block that is
enclosed by <script> tag, then the java formatter and indenter does nothing. There is no indentation.
If I reformat, the formatter leaves the lines as is.
JSP
<html>
<body>
<script type="text/javascript">
var a = 1;
var b = 2;
<%
String url = "...";
Boolean c = (Boolean) session.getAttribute("c");
if (c.booleanValue()) {
response.sendRedirect(url);
} else {
// continue..
}
%>
</script>
</body>
</html>
Description
The JSP formatter and indentation has a bunch of problems.
Here is one easy to describe. If I have some java code inside <% %> block that is
enclosed by <script> tag, then the java formatter and indenter does nothing. There is no indentation.
If I reformat, the formatter leaves the lines as is.
JSP
<html>
<body>
<script type="text/javascript">
var a = 1;
var b = 2;
<%
String url = "...";
Boolean c = (Boolean) session.getAttribute("c");
if (c.booleanValue()) {
response.sendRedirect(url);
} else {
// continue..
}
%>
</script>
</body>
</html>
Slightly different behavior in 4125, but still has a bug. After reformat, the <% %> block is indented one level below
<script> tag. But the java code is still not being formatted.
This new behavior is actually unwanted. I would like <% and %> to always be in column 1.
<html>
<body>
<script type="text/javascript">
var a = 1;
var b = 2;
<%
String url = "...";
Boolean c = (Boolean) session.getAttribute("c");
if (c.booleanValue()) {
response.sendRedirect(url);
} else {
// continue..
}
%>
</script>
</body>
</html>
AlexL - 25 Jan 06 04:21 Slightly different behavior in 4125, but still has a bug. After reformat, the <% %> block is indented one level below
<script> tag. But the java code is still not being formatted.
This new behavior is actually unwanted. I would like <% and %> to always be in column 1.
<html>
<body>
<script type="text/javascript">
var a = 1;
var b = 2;
<%
String url = "...";
Boolean c = (Boolean) session.getAttribute("c");
if (c.booleanValue()) {
response.sendRedirect(url);
} else {
// continue..
}
%>
</script>
</body>
</html>
<script> tag. But the java code is still not being formatted.
This new behavior is actually unwanted. I would like <% and %> to always be in column 1.
<html> <body> <script type="text/javascript"> var a = 1; var b = 2; <% String url = "..."; Boolean c = (Boolean) session.getAttribute("c"); if (c.booleanValue()) { response.sendRedirect(url); } else { // continue.. } %> </script> </body> </html>