facebook

Static includes for JSP validation

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #217232 Reply

    hurffwebb
    Member

    I am getting JSP validation errors reported when validating JSP’s with static (pre-Compile) include directives. It seems like MyEclipse is not reading in the contents of the includes before validating the JSP.

    Here is my example:

    Main.jsp

    
    <%@ page import="com.domain.config.ConfigurationManager" %>
    
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    
    <%@ taglib uri="/WEB-INF/hw-framework.tld" prefix="framework" %>
    
    <%@ include file="UtilHeader.inc" %>
    
    <div align="center">
    
    <framework:title>Welcome To MyApplication</framework:title>
    <br>
    <table class="Content" width="100%" cellpadding="2" cellspacing="0">
    <tr><td>
    
    Website Content
    
    </td></tr>
    </table>
    
    </div>
    
    <%@ include file="UtilFooter.inc" %>
    

    I include the files UtilHeader.inc and UtilFooter.inc which consist of the following:

    UtilHeader.inc

    
    <%@ page import="com.domain.config.*" %>
    <%@ page import="com.domain.PGConstants" %>
    
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    
    <%@ include file="tools/BaseURI.jsp" %>
    
    <%
        ConfigurationManager cmHead = ConfigurationManager.getInstance();
        String sCSS = null;
        try {
            sCSS = cmHead.getProperty(PGConstants.CSS);
        } catch (ConfigurationNotFoundException e) {
        }
    %>
    
    <html:html>
    <head>
        <title>App Name</title>
        <link rel="stylesheet" href="<%=sCSS%>" type="text/css">
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <html:base/>
    </head>
    <script language="javascript">
        var bChanged = false;
        
        function checkChanged() {
            if (bChanged) {
                return confirm("You have unsaved changes.\nIf you leave click 'OK' you will lose your work.");
            }
            
            return false;
        }
    </script>
    <body>
    

    UtilFooter.inc

    
    </body>
    </html:html>
    

    These are the messages generated by the JSP validator

    Severity    Description    Resource    In Folder    Location    Creation Time
    2    The end tag "</html:html" is unbalanced    Main.jsp    ProjectName/docroot    line 2    October 8, 2004 10:10:31 AM
    2    Unterminated <html:html tag    Main.jsp    ProjectName/docroot    line 37    October 8, 2004 10:10:31 AM

    The page compiles and works properly in my target environment which is Weblogic 8.1 SP1.

    Is this a bug or do I need to change the myEclipse settings?

    Thanks in advance!

    #217255 Reply

    Riyad Kalla
    Member

    If you move the open/close HTML tags into Main, do the problems go away?

    #217257 Reply

    hurffwebb
    Member

    Yes, If I replace the UtilHeader and UtilFooter includes with

    <html:html>
    <body>

    and

    </body>
    </html:html>

    repectively, the JSP reports as being valid.

    #217262 Reply

    Riyad Kalla
    Member

    1) Can you open a console window and type “javac”, does it wokr? Does the compiler give you your help menu?
    2) Where are these “errors” being displayed? In the problems view OR in the right margin?
    3) Did you add .inc as a JSP fragment type? Window > Prefs > MyEclipse > Editors > JSP > “JSP Fragment Extensions” (e.g. something like: “jspf, inc”, w/o quotes).
    4) Do you actually have mappings in your web.xml file that map those taglib URIs to the actual location of the TLD files? Please see this FAQ entry explaining URIs in more detail: http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-31.html#251 (if you intentionally mapped the path-looking-URI to the actual URI, then its fine… just making sure you know how it works).

    #217267 Reply

    hurffwebb
    Member

    @support-rkalla wrote:

    1) Can you open a console window and type “javac”, does it wokr? Does the compiler give you your help menu?

    Yes it works and gives my the help.

    @support-rkalla wrote:

    2) Where are these “errors” being displayed? In the problems view OR in the right margin?

    In the problems window and the red indicators are in the right margin too.

    @support-rkalla wrote:

    3) Did you add .inc as a JSP fragment type? Window > Prefs > MyEclipse > Editors > JSP > “JSP Fragment Extensions” (e.g. something like: “jspf, inc”, w/o quotes).

    Yes, it is set to “jspf, inc” (without the quotes)

    @support-rkalla wrote:

    4) Do you actually have mappings in your web.xml file that map those taglib URIs to the actual location of the TLD files?

    Yes. The tld files are in the /WEBROOT/WEB-INF directory. Here is the sniplet from my web.xml.

    
        <taglib>
          <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
          <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
        </taglib>
    
        <taglib>
          <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
          <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
    
        <taglib>
          <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
          <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
        </taglib>
    
        <taglib>
          <taglib-uri>/WEB-INF/hw-framework.tld</taglib-uri>
          <taglib-location>/WEB-INF/hw-framework.tld</taglib-location>
        </taglib>
    
        <taglib>
          <taglib-uri>/WEB-INF/pg-security.tld</taglib-uri>
          <taglib-location>/WEB-INF/pg-security.tld</taglib-location>
        </taglib>
    
    #217271 Reply

    Riyad Kalla
    Member

    I have reproduced this using your example and have filed it as a bug internally, thank you.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Static includes for JSP validation

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