facebook

JSP Validation do not recognize html error [Closed]

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #214319 Reply

    blinner
    Member

    Another try.. (my post got lost when pressing preview..)

    Hi all!

    Sorry, if this problem is not a new one, I have searched the forum a bit but found nothing equivalent.

    The problem: Missing “>” is not recognized in tag </html when validating JSP

    I have the following JSP:

    ——————————————————————-
    <!DOCTYPE HTML PUBLIC “-//w3c//dtd html 4.0 transitional//en”>
    <html>
    <head>
    <!–meta http-equiv=”refresh” content=”10″></meta–>
    <title>JSF Testseite</title>
    </head>
    <body>
    <%@ taglib uri=”http://java.sun.com/jsf/html&#8221; prefix=”h” %>
    <%@ taglib uri=”http://java.sun.com/jsf/core&#8221; prefix=”f” %>

    <f:view>
    <table border=1>
    <tr>
    <td>Memory current</TD>
    <td><h:outputText value=”#{status.currentMemory}” /></TD>
    </tr>
    <tr>
    <td>Memory maximum</TD>
    <td><h:outputText value=”#{status.maxMemory}” /></TD>
    </tr>
    <tr>
    <td>DB-Sessions</TD>
    <td><h:outputText value=”#{status.sessionCount}” /></TD>
    </tr>
    </table>
    </f:view>
    </body>
    </html <—- MISSING “>” !!!!
    ———————————————————–

    When validating JSP no error is shown, but when I deploy, I got the following error:

    org.apache.jasper.JasperException: Unable to compile class for JSP
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:520)

    with root cause:
    java.lang.ArrayIndexOutOfBoundsException: 760
    org.apache.jasper.compiler.JspReader.peekChar(JspReader.java:164)
    org.apache.jasper.compiler.JspReader.isSpace(JspReader.java:357)
    org.apache.jasper.compiler.JspReader.isDelimiter(JspReader.java:440)
    org.apache.jasper.compiler.JspReader.parseToken(JspReader.java:405)

    It took a while to “see” the missing “>” because I thought everything is ok in my JSP (no error when validating).

    I have enabled “Incremental HTML Validation” in Preferences and use MyEclipse 3.8 Beta2

    Best regards,
    Birgit

    #214424 Reply

    Riyad Kalla
    Member

    Birgit… this is a tricky problem, because your page IS a valid JSP page, but an invalid HTML page… consider this:

    
    <a href="">blah blah<%= "</a>" %>
    

    Is a valid JSP page, but invalid HTML. So when we validate JSP pages, we have to only validate the JSP portion of them, the HTML will almost never be validate (includes, partial tags, taglibs, etc.)

    #214453 Reply

    blinner
    Member

    Hi Riyad!
    Thanks for your answer!

    I understand, that validating JSP does not mean validating HTML, too.
    Is there any possibility to validate the html? Do I have to enable a feature?

    I thought, that validating JSP mean nothing else than temporarily compiling a JSP with the jasper compiler. But this compiler throws the error when calling the JSP page after deployment. So, shouldn`t it occure also when validating JSP in Eclipse?

    Best regards,

    Birgit

    #214476 Reply

    Riyad Kalla
    Member

    Birgit,
    Ahh yes you are correct that is what validating does (compiles the page). However if you don’t have javac.exe in your path, then ME is unable to compile the JSP page. Make sure you launch Eclipse with the -vm arguments and point it to a JDK on your system like so:

    eclipse.exe -vm c:\j2sdk1.4.2_04\bin\javaw.exe -vmargs <whatever>

    This way ME will be able to find the javac.exe file and compile the JSP page. You can verify that this iw hat is going wrong by checking your log file (<workspace dir>\.metadata\.log) you should have errors about not being able to start process or something to that extent.

    #214752 Reply

    blinner
    Member

    Hi Riyad,
    It makes no difference if I add the -vm parameter and I have no error in my log files (with the exception of “JSP Compiler broken” and “OutOfMemory”, which seems to be a problem of eclipse 3.0).
    When validating JSPs I also get some Warnings for the resulting Java code, so there seems to happen something.

    Just to clarify:
    Validating JSP = Compiling JSP.
    Calling a JSP in browser = Compiling JSP to tomcat work directory

    –> Errors occurring when compiling JSP to tomcat work directory should also occur when validating JSP with MyEclipse. Is this right?

    Only to know whats going on, if I have the time to try out the stuff a little bit more.

    Best regards,
    Birgit

    #214769 Reply

    Riyad Kalla
    Member

    Birgit,
    You are exactly right. In another thread Scott pointed out to me that javac.exe actually needs to be in your environment variable “PATH” and adding -vm doesn’t give MyEclipse the access to javac.exe that it needs. Can you try adding your jdk’s bin directory to your PATH environment variable and restart Eclipse and see if that fixes it?

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: JSP Validation do not recognize html error [Closed]

You must be logged in to post in the forum log in