2 Replies Latest reply on Aug 19, 2007 5:10 PM by Yurii Kartsev

    <%= tag gives an exception. Why?

    Yurii Kartsev Apprentice

      Good afternoon, dear RichFaces gurus!

      I use richfaces 3.0.1 + JBoss 4.2.0 GA. I have such page:

      <?xml version="1.0" encoding="UTF-8"?>
      <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:jsp="http://java.sun.com/JSP/Page"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich">
      <jsp:directive.page import="netinfo.hrdslr.persistence.Employee"/>
      
       <jsp:directive.page contentType="text/html;charset=UTF-8"
       pageEncoding="UTF-8" />
       <jsp:text>
       <![CDATA[
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       ]]>
       </jsp:text>
      
       <f:view>
       <html>
       <head>
       <title>Celsius converter</title>
      
       </head>
       <body bgcolor="#B5CEFD">
      
       <h:form>
       <div>
      
       </div>
       <table width="100%" border="0" align="center"
       style="background-color: #B5CEFD" cellspacing="0" cellpadding="0">
       <tbody>
       <tr>
       <td align="center" valign="middle">
       <h:graphicImage url="images/logo_001.gif" rendered="true" />
       </td>
       <td align="center" valign="middle">
       <h:outputText value="NetInfo Personal Department and Salary" />
       </td>
       </tr>
       <tr>
       <td>
      
       </td>
       <td>
       <rich:toolBar>
       <rich:dropDownMenu value="Employes">
      
       <rich:menuItem submitMode="ajax" value="New">
       </rich:menuItem>
       <rich:menuItem submitMode="ajax" value="Edit" />
       <rich:menuGroup value="Go to...">
       <rich:menuItem submitMode="ajax" value="Reports" />
       <rich:menuItem submitMode="ajax" value="Tree" />
       </rich:menuGroup>
       <rich:menuItem submitMode="ajax" value="Close" />
       <rich:menuSeparator id="menuSeparator11" />
       <rich:menuItem submitMode="ajax" value="Exit" />
       </rich:dropDownMenu>
      
       <rich:dropDownMenu>
      
       <f:facet name="label">
       <h:panelGrid cellpadding="0" cellspacing="0" columns="2"
       style="vertical-align:middle">
       <h:graphicImage value="images/yellow_lamp.gif" />
       <h:outputText value="Salary" />
       </h:panelGrid>
       </f:facet>
      
       <rich:menuItem submitMode="none"
       onclick="document.location.href='http://labs.jboss.com/jbossrichfaces/'">
       <h:outputLink value="http://labs.jboss.com/jbossrichfaces/">
       <h:outputText value="Test"></h:outputText>
       </h:outputLink>
       </rich:menuItem>
       </rich:dropDownMenu>
       </rich:toolBar>
       <br />
       <rich:separator lineType="beveled" height="5" width="100%" />
       <br />
       </td>
       </tr>
       <tr>
       <td>
      
      <jsp:scriptlet>String a = new String("hello, test"); System.out.println(a); </jsp:scriptlet>
      
       <div class="sample-container">
       <rich:tree style="width:300px" value="#{library.data}"
       var="item" nodeFace="#{item.type}">
       <rich:treeNode type="library">
       <h:outputText value="#{item.type}" />
       </rich:treeNode>
       <rich:treeNode type="artist">
       <h:outputText value="#{item.name}" />
       </rich:treeNode>
       <rich:treeNode type="album">
       <h:outputText value="#{item.title}" />
       </rich:treeNode>
       <rich:treeNode type="song">
       <h:outputText value="#{item.title}" />
       </rich:treeNode>
       </rich:tree>
       </div>
       </td>
       <td valign="top">
       <rich:tabPanel switchType="client">
       <rich:tab label="Date personale">
       <table>
      
       <tbody>
       <tr>
       <td>
       <h:panelGrid>
       <h:outputText value="Date pasaportului" />
       <h:outputText value="Nr. document" />
       <h:inputText id="nrdocumentEdit"
       value="{employeeBean.documentNumber}" />
       <h:outputText value="Data" />
       <h:inputText id="dataEdit" value="#{bidbean.bidderName}" />
       <h:outputText value="Nr. matricol" />
       <h:inputText id="nrmatricolEdit"
       value="#{bidbean.bidderName}" />
       <h:outputText value="Departament" />
       <h:inputText id="departamentEdit"
       value="#{bidbean.bidderName}" />
       <h:outputText value="Nume" />
       <h:inputText id="numeEdit"
       value="#{employeeBean.lastName}" />
       <h:commandButton action="#{empactionbean.action}"></h:commandButton>
       </h:panelGrid>
       </td>
       <td>
       COLUMN 2
       </td>
       </tr>
       </tbody>
       </table>
       </rich:tab>
       <rich:tab label="???????? ???????">
       <h:outputText value="Job Name" />
       <h:inputText id="jnameEdit"
       value="#{jobBean.speciality}" />
       <h:commandButton action="#{jobactionbean.action}"></h:commandButton>
      
       <h:outputText value="#{employeeBean.jobs}"></h:outputText>
       </rich:tab>
       <rich:tab label="Third">
       Here is tab #3
       </rich:tab>
       </rich:tabPanel>
       </td>
       </tr>
       </tbody>
       </table>
      
       </h:form>
       </body>
       </html>
       </f:view>
      </jsp:root>


      It's an example, which is partially remade for use of EJB. It works well, but if only I add this: "<%= new java.util.Date() %>" after </jsp:scriptlet> tag, server gives me an exception:
      org.apache.jasper.JasperException: /test.jsp(87,2) The content of elements must consist of well-formed character data or markup.
       org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
       org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
       org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
       org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:214)
       org.apache.jasper.compiler.ParserController.doParse(ParserController.java:200)
       org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
       org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
       org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
       org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
       org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
       org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
       com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:439)
       com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:114)
       org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
       com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


      What can be wrong? Why JSP tag isn't working here?

      I'm beginner with JSF and RichFaces, so any help will be appreciated.

      Thank you in advance!

      P.S.: Sorry for a lot of code, it's for you to have all information to give me the right clue. Thanks again.