This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 163560 - indenation doesn't work in java section defined by jsp tags
Summary: indenation doesn't work in java section defined by jsp tags
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: Sun Linux
: P3 blocker (vote)
Assignee: issues@javaee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-24 10:23 UTC by Jindrich Sedek
Modified: 2015-09-17 13:10 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jindrich Sedek 2009-04-24 10:23:51 UTC
use scriptlet defined using JSP tags:
--------------------
        <jsp:scriptlet>
            int i = 0;
            int j = 10;
        </jsp:scriptlet>
--------------------
press Enter enywhere inside scriptlet - cursor is always moved at the begging of a line and it's not indented at all
reformatting works well, indenation works well in scriptlets defined using <% ... %>

the same problem si for <jsp:expression> and <jsp:declaration>
Comment 1 Marek Fukala 2009-04-24 11:24:15 UTC
The lexical content of the <jsp:scritlet> area and <% %> is the same, other features works. Seems to be indentation issue.
Comment 2 David Konecny 2009-04-28 04:59:54 UTC
Marek,

code handling this involves JspSyntaxSupport which I know very little about. Placing some code dumps I can see that
given code example is translated into following TokenIDs:

'<', tokenID=symbol, tcp=|<JspTagTokenContext><JspMultiTokenContext>|, offset=0

'\n            int i = 0;\n            int j = 10;\n', tokenID=text, tcp=|<HtmlTokenContext><JspMultiTokenContext>|,
offset=15

'>', tokenID=symbol, tcp=|<JspTagTokenContext><JspMultiTokenContext>|, offset=14

'</', tokenID=symbol, tcp=|<JspTagTokenContext><JspMultiTokenContext>|, offset=63

'\n', tokenID=text, tcp=|<HtmlTokenContext><JspMultiTokenContext>|, offset=79

'>', tokenID=symbol, tcp=|<JspTagTokenContext><JspMultiTokenContext>|, offset=78

what? where? and how is this done??? Problem is that Java code is not properly identified and is treated as HTML. (if I
understand it well)

Comment 3 Marek Fukala 2009-04-28 08:33:59 UTC
If you depend on JspSyntaxSupport you are out of luck. The JSPSS is built on top of old syntax (predecessor of lexer).
This old syntax (see JspMultiSyntax class in o.n.m.web.core.syntax.deprecated) doesn't recognize the <jsp:scriptlet>
sections as java code so the content appears as html text. These classes are already replaced by the jsp lexer, but some
parts of the jsp code still depends on them.

I won't definitely do any fix in the old syntax classes, I hope that if I did the jsp module migration to parsing.api in
next version I would also get rid of the JspSyntaxSupport and all deprecated classes.

So for now I recommend to put this off to the next release, or you can migrate the code so it doesn't depend on
JspSyntaxSupport but directly on jsp lexer (which shouldn't be that big deal)
Comment 4 David Konecny 2009-04-28 21:06:33 UTC
The source of problem is there is no formatter for Java embedded in JSP and so old
org.netbeans.editor.ext.java.JavaFormatter using JspSyntaxSupport must be still used. Sounds like this never worked
before so I'm lowering priority.
Comment 5 Petr Jiricka 2009-11-06 10:38:46 UTC
Not doable for 6.8 based on the comments above. For the purpose of next releases planning, is it enough if we do these
changes in the JSP editor side? Or are there changes on the Java side required too?
Comment 6 David Konecny 2010-10-05 19:22:41 UTC
(In reply to comment #5)
> Not doable for 6.8 based on the comments above. For the purpose of next
> releases planning, is it enough if we do these
> changes in the JSP editor side? Or are there changes on the Java side required
> too?

I think it needs to be fixed on Java side first.
Comment 7 Martin Balin 2015-09-17 13:10:16 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.