facebook

Incorrect line break syntax when creating Struts JSP

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

    mbagai
    Member

    Hello,

    In 3.8.2 on OS X 10.3, I used the “New form bean, action and JSP” wizard. The JSP that is created uses an incorrect line break syntax. Line breaks are coded as “</br>” where they should be “<br/>”.

    At least the validator caught it 🙂

    /Morten

    #216826 Reply

    Riyad Kalla
    Member

    Morten what is the content of the generated page? I just tried the same thing and have no <br> elements in my page.

    
     
    <%@ page language="java"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
     
    <html> 
        <head>
            <title>JSP for logoffForm form</title>
        </head>
        <body>
            <html:form action="/logoff">
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>
    
    
    #216833 Reply

    mbagai
    Member

    This is what I got when I opened the auto-generated JSP:

    <%@ page language="java"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
     
    <html> 
        <head>
            <title>JSP for loginForm form</title>
        </head>
        <body>
            <html:form action="/login">
                userName : <html:text property="userName"/><html:errors property="userName"/></br>
                userPassword : <html:text property="userPassword"/><html:errors property="userPassword"/></br>
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>

    Maybe the reason you didn’t get any line breaks is because you only had one element?

    Thanks,

    Morten

    #216834 Reply

    Riyad Kalla
    Member

    Yep that’s exactly it, I was able to reproduce this. Thanks!

    #216835 Reply

    Riyad Kalla
    Member

    If you are interested in working around this manuall until its fixed in 3.8.3, you can edit the following file:
    <myeclipse dir>\eclipse\plugins\com.genuitec.eclipse.cross.easystruts.eclipse_3.8.2\xslt\JspForm.xsl

    And change its contents to this:

    
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="text" />
    
    <!-- jsp element -->
    <xsl:template match="bean"> 
    <%@ page language="java"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
     
    <html> 
        <head>
            <title>JSP for <xsl:value-of select="form-name"/> form</title>
        </head>
        <body>
            <html:form action="<xsl:value-of select="path"/>"><xsl:apply-templates select="attribute">
        <xsl:sort select="name"/>
    </xsl:apply-templates>
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>
    </xsl:template>
    
    <!-- attribute element -->
    <xsl:template match="attribute"><xsl:text>
                </xsl:text><xsl:value-of select="label"/> : <html:<xsl:value-of select="tag"/> property="<xsl:value-of select="name"/>"/><html:errors property="<xsl:value-of select="name"/>"/><br/></xsl:template>
    
    </xsl:stylesheet>
    

    That will use <br/> instead.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Incorrect line break syntax when creating Struts JSP

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