You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Bryan Basham <bb...@stillsecure.com> on 2007/08/03 22:08:25 UTC

JSPX syntax delima

Hi all,

I am using JSPX syntax for my JSF pages.  I occasionally need to use
raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
a problem with the Jasper compiler of these verbatim tags break the
start/end tags of the HTML.

Here's an example:

<f:verbatim>
   <div class="addItemTable">
      <ul class="addItem">
         <li></f:verbatim>
             <h:commandLink action="#{globalOptionsMgr.addOption}" 
value="LABEL" />
         <f:verbatim></li>
      </ul>
   </div>
</f:verbatim>

The Jasper error I get is:
org.apache.jasper.JasperException: 
/dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be 
terminated by the matching end-tag "</li>".
        at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
        at 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
        at 
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
        at 
org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)

Does anyone know how to work around this problem?

Thanks,
Bryan


Re: JSPX syntax delima

Posted by Andrew Robinson <an...@gmail.com>.
Use facelets as you think it *should* look:

<div class="addItemTable">
   <ul class="addItem">
      <li><h:commandLink action="#{globalOptionsMgr.addOption}"
value="LABEL" /></li>
   </ul>
</div>

Since it doesn't use JSP and therefore JSP tags, there is no need for
verbatim components, as all the source is JSF source.

There are many advantages to facelets. The 3 biggest IMO are
performance, no verbatim tags needed and templating.

Since HTML is really XML (well XHTML is at least), it should not be
necessary to relax the XML parser.

-Andrew

On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> Thanks for the suggestion.  I've never used facelets, so would you
> be willing to sketch how this chunk of code would look using that
> technology?
>
> Is there any other solution without using facelets?  For example, is
> there a JSP (or Jasper) configuration that will relax the parser?
>
> Thanks,
> Bryan
>
> Andrew Robinson wrote:
> > Use Facelets instead of JSP. You will not need verbatim tags anymore with it
> >
> > On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> >
> >> Hi all,
> >>
> >> I am using JSPX syntax for my JSF pages.  I occasionally need to use
> >> raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
> >> a problem with the Jasper compiler of these verbatim tags break the
> >> start/end tags of the HTML.
> >>
> >> Here's an example:
> >>
> >> <f:verbatim>
> >>    <div class="addItemTable">
> >>       <ul class="addItem">
> >>          <li></f:verbatim>
> >>              <h:commandLink action="#{globalOptionsMgr.addOption}"
> >> value="LABEL" />
> >>          <f:verbatim></li>
> >>       </ul>
> >>    </div>
> >> </f:verbatim>
> >>
> >> The Jasper error I get is:
> >> org.apache.jasper.JasperException:
> >> /dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be
> >> terminated by the matching end-tag "</li>".
> >>         at
> >> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
> >>         at
> >> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
> >>         at
> >> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
> >>         at
> >> org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)
> >>
> >> Does anyone know how to work around this problem?
> >>
> >> Thanks,
> >> Bryan
> >>
> >>
> >>
>
>

Re: JSPX syntax delima

Posted by simon <si...@chello.at>.
On Fri, 2007-08-03 at 14:31 -0600, Bryan Basham wrote:
> Thanks for the suggestion.  I've never used facelets, so would you
> be willing to sketch how this chunk of code would look using that
> technology?
> 
> Is there any other solution without using facelets?  For example, is
> there a JSP (or Jasper) configuration that will relax the parser?

Yep, it's called JSP (not JSPX) :-)

That's the point of JSPX - that the input is valid XML. And that means
the tags must be balanced.

There is a JSF tag library that provides a JSF equivalent for every html
tag, so you can write
  h:ul
    h:ui
etc and then you don't need f:verbatim. However that's not a very
efficient solution; a JSF component gets created for each such element
rather than treating the embedded html as simply raw text. See:
  http://jsftutorials.net/htmLib/

Regards,

Simon


Re: JSPX syntax delima

Posted by Martin Marinschek <ma...@gmail.com>.
There is one thing that has been left out of the list of helpful
suggestions so far:

you can also just use JSF 1.2, without facelets, and won't need
f:verbatim-tags anymore!

regards,

Martin

On 8/3/07, Andrew Robinson <an...@gmail.com> wrote:
> el-api.jar & el-impl.jar from the facelets download.
>
> If you switch to JSF 1.2, use the version from your container (tomcat
> at least comes with an el jar).
>
> On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> > Thanks everyone for the helpful suggestions so far.
> >
> > I decided to try facelets.  I have walked through the setup
> > in section 1.4 of the facelets.dev.java.net docbook.  But I
> > immediately hit the following error:
> >
> > [03 Aug 2007 14:09:58,648] ERROR [http-443-Processor24]
> > (StandardWrapperValve.java:253) - Servlet.service() for servlet Faces
> > Servlet threw exception
> > java.lang.NoClassDefFoundError: javax/el/ELException
> >         at
> > com.sun.facelets.tag.AbstractTagLibrary.addTagHandler(AbstractTagLibrary.java:469)
> >         at
> > com.sun.facelets.tag.jstl.core.JstlCoreLibrary.<init>(JstlCoreLibrary.java:32)
> >         at
> > com.sun.facelets.tag.jstl.core.JstlCoreLibrary.<clinit>(JstlCoreLibrary.java:27)
> >
> > My environment is based on JSF v1.1 (MyFaces v1.1.5):
> > jsf-facelets.jar  (v1.1.13)
> > jstl-1.1.0.jar
> > commons-el-1.0.jar
> > myfaces-api-1.1.5.jar
> > myfaces-impl-1.1.5.jar
> >
> > Do I need to migrate to JSF v1.2?  Or is there some other JAR
> > file that I need?
> >
> > Thanks,
> > Bryan
> >
> > Mike Kienenberger wrote:
> > > It would look like this:
> > >
> > >
> > >   <div class="addItemTable">
> > >      <ul class="addItem">
> > >         <li>
> > >             <h:commandLink action="#{globalOptionsMgr.addOption}"
> > > value="LABEL" />
> > >         </li>
> > >      </ul>
> > >   </div>
> > >
> > > [ie, what you had without any verbatim tags]
> > >
> > > I think your only other option would be to xml-escape all of the tags
> > > enclosed in your verbatim tags.
> > >
> > > On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> > >
> > >> Thanks for the suggestion.  I've never used facelets, so would you
> > >> be willing to sketch how this chunk of code would look using that
> > >> technology?
> > >>
> > >> Is there any other solution without using facelets?  For example, is
> > >> there a JSP (or Jasper) configuration that will relax the parser?
> > >>
> > >> Thanks,
> > >> Bryan
> > >>
> > >> Andrew Robinson wrote:
> > >>
> > >>> Use Facelets instead of JSP. You will not need verbatim tags anymore with it
> > >>>
> > >>> On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> > >>>
> > >>>
> > >>>> Hi all,
> > >>>>
> > >>>> I am using JSPX syntax for my JSF pages.  I occasionally need to use
> > >>>> raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
> > >>>> a problem with the Jasper compiler of these verbatim tags break the
> > >>>> start/end tags of the HTML.
> > >>>>
> > >>>> Here's an example:
> > >>>>
> > >>>> <f:verbatim>
> > >>>>    <div class="addItemTable">
> > >>>>       <ul class="addItem">
> > >>>>          <li></f:verbatim>
> > >>>>              <h:commandLink action="#{globalOptionsMgr.addOption}"
> > >>>> value="LABEL" />
> > >>>>          <f:verbatim></li>
> > >>>>       </ul>
> > >>>>    </div>
> > >>>> </f:verbatim>
> > >>>>
> > >>>> The Jasper error I get is:
> > >>>> org.apache.jasper.JasperException:
> > >>>> /dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be
> > >>>> terminated by the matching end-tag "</li>".
> > >>>>         at
> > >>>> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
> > >>>>         at
> > >>>> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
> > >>>>         at
> > >>>> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
> > >>>>         at
> > >>>> org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)
> > >>>>
> > >>>> Does anyone know how to work around this problem?
> > >>>>
> > >>>> Thanks,
> > >>>> Bryan
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>
> >
> >
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: JSPX syntax delima

Posted by Andrew Robinson <an...@gmail.com>.
el-api.jar & el-impl.jar from the facelets download.

If you switch to JSF 1.2, use the version from your container (tomcat
at least comes with an el jar).

On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> Thanks everyone for the helpful suggestions so far.
>
> I decided to try facelets.  I have walked through the setup
> in section 1.4 of the facelets.dev.java.net docbook.  But I
> immediately hit the following error:
>
> [03 Aug 2007 14:09:58,648] ERROR [http-443-Processor24]
> (StandardWrapperValve.java:253) - Servlet.service() for servlet Faces
> Servlet threw exception
> java.lang.NoClassDefFoundError: javax/el/ELException
>         at
> com.sun.facelets.tag.AbstractTagLibrary.addTagHandler(AbstractTagLibrary.java:469)
>         at
> com.sun.facelets.tag.jstl.core.JstlCoreLibrary.<init>(JstlCoreLibrary.java:32)
>         at
> com.sun.facelets.tag.jstl.core.JstlCoreLibrary.<clinit>(JstlCoreLibrary.java:27)
>
> My environment is based on JSF v1.1 (MyFaces v1.1.5):
> jsf-facelets.jar  (v1.1.13)
> jstl-1.1.0.jar
> commons-el-1.0.jar
> myfaces-api-1.1.5.jar
> myfaces-impl-1.1.5.jar
>
> Do I need to migrate to JSF v1.2?  Or is there some other JAR
> file that I need?
>
> Thanks,
> Bryan
>
> Mike Kienenberger wrote:
> > It would look like this:
> >
> >
> >   <div class="addItemTable">
> >      <ul class="addItem">
> >         <li>
> >             <h:commandLink action="#{globalOptionsMgr.addOption}"
> > value="LABEL" />
> >         </li>
> >      </ul>
> >   </div>
> >
> > [ie, what you had without any verbatim tags]
> >
> > I think your only other option would be to xml-escape all of the tags
> > enclosed in your verbatim tags.
> >
> > On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> >
> >> Thanks for the suggestion.  I've never used facelets, so would you
> >> be willing to sketch how this chunk of code would look using that
> >> technology?
> >>
> >> Is there any other solution without using facelets?  For example, is
> >> there a JSP (or Jasper) configuration that will relax the parser?
> >>
> >> Thanks,
> >> Bryan
> >>
> >> Andrew Robinson wrote:
> >>
> >>> Use Facelets instead of JSP. You will not need verbatim tags anymore with it
> >>>
> >>> On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> >>>
> >>>
> >>>> Hi all,
> >>>>
> >>>> I am using JSPX syntax for my JSF pages.  I occasionally need to use
> >>>> raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
> >>>> a problem with the Jasper compiler of these verbatim tags break the
> >>>> start/end tags of the HTML.
> >>>>
> >>>> Here's an example:
> >>>>
> >>>> <f:verbatim>
> >>>>    <div class="addItemTable">
> >>>>       <ul class="addItem">
> >>>>          <li></f:verbatim>
> >>>>              <h:commandLink action="#{globalOptionsMgr.addOption}"
> >>>> value="LABEL" />
> >>>>          <f:verbatim></li>
> >>>>       </ul>
> >>>>    </div>
> >>>> </f:verbatim>
> >>>>
> >>>> The Jasper error I get is:
> >>>> org.apache.jasper.JasperException:
> >>>> /dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be
> >>>> terminated by the matching end-tag "</li>".
> >>>>         at
> >>>> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
> >>>>         at
> >>>> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
> >>>>         at
> >>>> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
> >>>>         at
> >>>> org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)
> >>>>
> >>>> Does anyone know how to work around this problem?
> >>>>
> >>>> Thanks,
> >>>> Bryan
> >>>>
> >>>>
> >>>>
> >>>>
> >>
>
>

ReturnListener With Dialog Framework not working ?????

Posted by "Sengupta, Saikat - OCI" <Sa...@oci.state.wi.us>.
Hello,

 

I am trying to use the TRINIDAD Dialog Framework and I am using the same
Demo application, somehow when I am returning from the Dialog to the
Main page , it's not calling the ReturnListener method. Any body who can
help on this , I will appreciate.

 

I am enclosed the code whhich copied from the Developers Guide . Am I
missing something ????

 

 

Thanks

 

Sen

LaunchDialog.jsp

----------------

<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>

<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>

<jsp:directive.page contentType="text/html;charset=utf-8"/>

<f:view>

  

      <tr:document title="Dialog Demo" >

      <tr:form>

         <!-- The field for the value;  we point partialTriggers

              at the button to ensure it gets redrawn when we return -->

         <tr:inputText label="Pick a number:" value="(Empty)"

                       partialTriggers="buttonId"

                       binding="#{launchDialog.input}"/>

         <!-- The button for launching the dialog:  we've also

              configured the width and height of that window -->

         <tr:commandButton text="Add" id="buttonId"

                          windowWidth="300" windowHeight="200"

                          partialSubmit="true" useWindow="true"

                          returnListener="#{launchDialog.returned}"
action="dialog:chooseInteger"/>

         <h:commandButton  action="chooseInteger" 

                          id="buttonJSF" value="JSF"/>

 

       </tr:form>

    </tr:document>

 </f:view>

 

 

ChooseInteger.jsp

------------------

 

<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>

<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>

<jsp:directive.page contentType="text/html;charset=utf-8"/>

<f:view>

  <trh:body>

    <tr:document title="Add dialog">

      <tr:form>

         <!-- Two input fields -->

         <h:panelGrid >

           <tr:inputText  label="Number 1:"
value="#{chooseInteger.value1}"

                         required="true" />

           <tr:inputText label="Number 2:"
value="#{chooseInteger.value2}"

                         required="true" />

         </h:panelGrid>

         

         <!-- Two buttons -->

          <h:panelGroup>

           <tr:commandButton text="Submit"
action="#{chooseInteger.select}"/>

           <tr:commandButton text="Cancel" immediate="true"

                             action="#{chooseInteger.cancel}"/>

          </h:panelGroup>

      </tr:form>

    </tr:document>

  </trh:body>

 </f:view>

 

ChooseIntegerBean.java

----------------------

 

package org.apache.myfaces.trindaddemo;

 

import org.apache.myfaces.trinidad.context.RequestContext;

 

public class ChooseIntegerBean

{

  public Integer getValue1()

  {

    return _value1;

  }

 

  public void setValue1(Integer value1)

  {

    _value1 = value1;

  }

 

  public Integer getValue2()

  {

    return _value2;

  }

 

  public void setValue2(Integer value2)

  {

    _value2 = value2;

  }

 

 

  public String cancel()

  {

    RequestContext.getCurrentInstance().returnFromDialog(null, null);

    return null;

  }

 

  public String select()

  {

    Integer value = new Integer(getValue1().intValue() +

                                getValue2().intValue());

    RequestContext.getCurrentInstance().returnFromDialog(value, null);

    return null;

  }

 

  private Integer _value1=new Integer(10);

  private Integer _value2=new Integer(10);

}

 

 

LaunchDialogBean.java

----------------------

 

package org.apache.myfaces.trindaddemo.dialog;

 

import org.apache.myfaces.trinidad.component.UIXInput;

import org.apache.myfaces.trinidad.event.ReturnEvent;

 

public class LaunchDialogBean

{

  public UIXInput getInput()

  {

    return _input;

  }

 

  public void setInput(UIXInput input)

  {

    _input = input;

  }

 

  public void returned(ReturnEvent event)

  {

      System.out.println("Hello1");

        if (event.getReturnValue() != null)

    {

      getInput().setSubmittedValue(null);

      System.out.println("Hello");

      getInput().setValue(event.getReturnValue());

    }

  }

  

  public String showDialog()

  {

        System.out.println("Calling showDialog Method !");

        return "dialog:chooseInteger";

  }

 

  private UIXInput _input;

}

 

Faces-Config.xml

----------------

 

 

<?xml version="1.0"?>

<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.0//EN"

 
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

 <managed-bean>

  <managed-bean-name>chooseInteger</managed-bean-name>

 
<managed-bean-class>org.apache.myfaces.trindaddemo.ChooseIntegerBean</ma
naged-bean-class>

  <managed-bean-scope>request</managed-bean-scope>

 </managed-bean>

 <managed-bean>

  <managed-bean-name>launchDialog</managed-bean-name>

 
<managed-bean-class>org.apache.myfaces.trindaddemo.dialog.LaunchDialogBe
an</managed-bean-class>

  <managed-bean-scope>request</managed-bean-scope>

 </managed-bean>

 <navigation-rule>

  <from-view-id>/LaunchDialog.jsp</from-view-id>

  <navigation-case>

   <from-outcome>dialog:chooseInteger</from-outcome>

   <to-view-id>/chooseInteger.jsp</to-view-id>

  </navigation-case>

  <navigation-case>

   <from-outcome>chooseInteger</from-outcome>

   <to-view-id>/faces/chooseInteger.jsp</to-view-id>

  </navigation-case>

 </navigation-rule>

 <application>

  <!-- Use the Trinidad RenderKit -->

 
<default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-
kit-id>

  <!-- DEFAULT/SUPPORTED LOCALE/S FOR THE DEMO -->

  <locale-config>

   <default-locale>en</default-locale>

   <supported-locale>ru</supported-locale>

  </locale-config>

 </application>

</faces-config>

 

 

Web.xml

---------

 

<?xml version="1.0"?>

<!--

 * Copyright 2004 The Apache Software Foundation.

 *

 * Licensed under the Apache License, Version 2.0 (the "License");

 * you may not use this file except in compliance with the License.

 * You may obtain a copy of the License at

 *

 *      http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

-->

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

 <display-name>JSF Testing</display-name>

 <context-param>

  <description>State saving method: "client" or "server" (= default)

            See JSF Specification 2.5.2</description>

  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

  <param-value>server</param-value>

 </context-param>

 <context-param>

  <description>This parameter tells MyFaces if javascript code should be
allowed in the

            rendered HTML output.

            If javascript is allowed, command_link anchors will have
javascript code

            that submits the corresponding form.

            If javascript is not allowed, the state saving info and
nested parameters

            will be added as url parameters.

            Default: "true"</description>

  <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>

  <param-value>true</param-value>

 </context-param>

 <context-param>

  <description>This parameter tells MyFaces if javascript code should be
allowed in the

            rendered HTML output.

            If javascript is allowed, command_link anchors will have
javascript code

            that submits the corresponding form.

            If javascript is not allowed, the state saving info and
nested parameters

            will be added as url parameters.

            Default: "false"

 

            Setting this param to true should be combined with
STATE_SAVING_METHOD "server" for

            best results.

 

            This is an EXPERIMENTAL feature. You also have to enable the
detector filter/filter mapping below to get

            JavaScript detection working.</description>

  <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>

  <param-value>false</param-value>

 </context-param>

 <context-param>

  <description>If true, rendered HTML code will be formatted, so that it
is "human readable".

            i.e. additional line separators and whitespace will be
written, that do not

            influence the HTML code.

            Default: "true"</description>

  <param-name>org.apache.myfaces.PRETTY_HTML</param-name>

  <param-value>true</param-value>

 </context-param>

 <context-param>

  <description>If true, a javascript function will be rendered that is
able to restore the

            former vertical scroll on every request. Convenient feature
if you have pages

            with long lists and you do not want the browser page to
always jump to the top

            if you trigger a link or button action that stays on the
same page.

            Default: "false"</description>

  <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>

  <param-value>true</param-value>

 </context-param>

 <context-param>

 
<param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</para
m-name>

  <param-value>false</param-value>

 </context-param>

 <context-param>

 
<param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-na
me>

  <param-value>com.sun.facelets.FaceletViewHandler</param-value>

 </context-param>

 <context-param>

 
<param-name>org.apache.myfaces.trinidadinternal.DISABLE_CONTENT_COMPRESS
ION</param-name>

  <param-value>true</param-value>

 </context-param>

 <!-- WelcomeFile Filter 

 

    <filter>

        <filter-name>WelcomeFile Filter</filter-name>

 
<filter-class>org.apache.myfaces.webapp.filter.WelcomeFileFilter</filter
-class>

        <description>

            Due to the manner in which the JSP / servlet lifecycle

            functions, it is not currently possible to specify default

            welcome files for a web application and map them to the

            MyFacesServlet.  Normally they will be mapped to the

            default servlet for the JSP container.  To offset this

            shortcoming, we utilize a servlet Filter which examines

            the URI of all incoming requests.

        </description>

    </filter>

    

 JavaScriptDetector Filter 

    <filter>

        <filter-name>javascriptDetector</filter-name>

 
<filter-class>org.apache.myfaces.webapp.filter.JavaScriptDetectorFilter<
/filter-class>

    </filter>

 Extensions Filter -->

 <filter>

  <filter-name>extensionsFilter</filter-name>

 
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</f
ilter-class>

  <init-param>

   <description>Set the size limit for uploaded files.

                Format: 10 - 10 bytes

                        10k - 10 KB

                        10m - 10 MB

                        1g - 1 GB</description>

   <param-name>uploadMaxFileSize</param-name>

   <param-value>100m</param-value>

  </init-param>

  <init-param>

   <description>Set the threshold size - files

                    below this limit are stored in memory, files above

                    this limit are stored on disk.

 

                Format: 10 - 10 bytes

                        10k - 10 KB

                        10m - 10 MB

                        1g - 1 GB</description>

   <param-name>uploadThresholdSize</param-name>

   <param-value>100k</param-value>

  </init-param>

  <!--        <init-param>

            <param-name>uploadRepositoryPath</param-name>

            <param-value>/temp</param-value>

            <description>Set the path where the intermediary files will
be stored.

            </description>

        </init-param>-->

 </filter>

 <filter>

  <filter-name>trinidad</filter-name>

 
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-
class>

 </filter>

 <filter>

  <filter-name>MyFacesExtensionsFilter</filter-name>

 
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-
class>

  <init-param>

   <param-name>maxFileSize</param-name>

   <param-value>20m</param-value>

  </init-param>

 </filter>

 <filter>

  <display-name>Ajax4jsf Filter</display-name>

  <filter-name>ajax4jsf</filter-name>

  <filter-class>org.ajax4jsf.Filter</filter-class>

 </filter>

 <!-- Filter Mappings 

 see MyFaces Filter above for a description 

 

    <filter-mapping>

        <filter-name>WelcomeFile Filter</filter-name>

        <url-pattern>/*</url-pattern>

    </filter-mapping>

    

    <filter-mapping>

        <filter-name>javascriptDetector</filter-name>

        <url-pattern>/_javascriptDetector_</url-pattern>

    </filter-mapping>-->

 <filter-mapping>

  <filter-name>extensionsFilter</filter-name>

  <url-pattern>/faces/*</url-pattern>

 </filter-mapping>

 <filter-mapping>

  <filter-name>trinidad</filter-name>

  <servlet-name>faces</servlet-name>

 </filter-mapping>

 <filter-mapping>

  <filter-name>MyFacesExtensionsFilter</filter-name>

  <servlet-name>Faces Servlet</servlet-name>

 </filter-mapping>

 <filter-mapping>

  <filter-name>MyFacesExtensionsFilter</filter-name>

  <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>

 </filter-mapping>

 <filter-mapping>

  <filter-name>MyFacesExtensionsFilter</filter-name>

  <url-pattern>/faces/*</url-pattern>

 </filter-mapping>

 <filter-mapping>

  <filter-name>ajax4jsf</filter-name>

  <servlet-name>Faces Servlet</servlet-name>

  <dispatcher>REQUEST</dispatcher>

  <dispatcher>FORWARD</dispatcher>

  <dispatcher>INCLUDE</dispatcher>

 </filter-mapping>

 <!-- Listener, that does all the startup work (configuration, init).
-->

 <listener>

 
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener<
/listener-class>

 </listener>

 <!-- Faces Servlet -->

 <servlet>

  <servlet-name>Faces Servlet</servlet-name>

  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

  <load-on-startup>1</load-on-startup>

 </servlet>

 <servlet>

  <servlet-name>resources</servlet-name>

 
<servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servl
et-class>

 </servlet>

 <!-- Faces Servlet Mapping 

 virtual path mapping 

 

    <servlet-mapping>

        <servlet-name>Faces Servlet</servlet-name>

        <url-pattern>/faces/*</url-pattern>

    </servlet-mapping>

    

 extension mapping -->

 <servlet-mapping>

  <servlet-name>Faces Servlet</servlet-name>

  <url-pattern>/faces/*</url-pattern>

 </servlet-mapping>

 <servlet-mapping>

  <servlet-name>resources</servlet-name>

  <url-pattern>/adf/*</url-pattern>

 </servlet-mapping>

 <login-config>

  <auth-method>BASIC</auth-method>

 </login-config>

</web-app>

 

 


Re: JSPX syntax delima

Posted by Bryan Basham <bb...@stillsecure.com>.
Thanks everyone for the helpful suggestions so far.

I decided to try facelets.  I have walked through the setup
in section 1.4 of the facelets.dev.java.net docbook.  But I
immediately hit the following error:

[03 Aug 2007 14:09:58,648] ERROR [http-443-Processor24] 
(StandardWrapperValve.java:253) - Servlet.service() for servlet Faces 
Servlet threw exception
java.lang.NoClassDefFoundError: javax/el/ELException
        at 
com.sun.facelets.tag.AbstractTagLibrary.addTagHandler(AbstractTagLibrary.java:469)
        at 
com.sun.facelets.tag.jstl.core.JstlCoreLibrary.<init>(JstlCoreLibrary.java:32)
        at 
com.sun.facelets.tag.jstl.core.JstlCoreLibrary.<clinit>(JstlCoreLibrary.java:27)

My environment is based on JSF v1.1 (MyFaces v1.1.5):
jsf-facelets.jar  (v1.1.13)
jstl-1.1.0.jar
commons-el-1.0.jar
myfaces-api-1.1.5.jar
myfaces-impl-1.1.5.jar

Do I need to migrate to JSF v1.2?  Or is there some other JAR
file that I need?

Thanks,
Bryan

Mike Kienenberger wrote:
> It would look like this:
>
>
>   <div class="addItemTable">
>      <ul class="addItem">
>         <li>
>             <h:commandLink action="#{globalOptionsMgr.addOption}"
> value="LABEL" />
>         </li>
>      </ul>
>   </div>
>
> [ie, what you had without any verbatim tags]
>
> I think your only other option would be to xml-escape all of the tags
> enclosed in your verbatim tags.
>
> On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
>   
>> Thanks for the suggestion.  I've never used facelets, so would you
>> be willing to sketch how this chunk of code would look using that
>> technology?
>>
>> Is there any other solution without using facelets?  For example, is
>> there a JSP (or Jasper) configuration that will relax the parser?
>>
>> Thanks,
>> Bryan
>>
>> Andrew Robinson wrote:
>>     
>>> Use Facelets instead of JSP. You will not need verbatim tags anymore with it
>>>
>>> On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
>>>
>>>       
>>>> Hi all,
>>>>
>>>> I am using JSPX syntax for my JSF pages.  I occasionally need to use
>>>> raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
>>>> a problem with the Jasper compiler of these verbatim tags break the
>>>> start/end tags of the HTML.
>>>>
>>>> Here's an example:
>>>>
>>>> <f:verbatim>
>>>>    <div class="addItemTable">
>>>>       <ul class="addItem">
>>>>          <li></f:verbatim>
>>>>              <h:commandLink action="#{globalOptionsMgr.addOption}"
>>>> value="LABEL" />
>>>>          <f:verbatim></li>
>>>>       </ul>
>>>>    </div>
>>>> </f:verbatim>
>>>>
>>>> The Jasper error I get is:
>>>> org.apache.jasper.JasperException:
>>>> /dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be
>>>> terminated by the matching end-tag "</li>".
>>>>         at
>>>> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
>>>>         at
>>>> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
>>>>         at
>>>> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
>>>>         at
>>>> org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)
>>>>
>>>> Does anyone know how to work around this problem?
>>>>
>>>> Thanks,
>>>> Bryan
>>>>
>>>>
>>>>
>>>>         
>>     


Re: JSPX syntax delima

Posted by Mike Kienenberger <mk...@gmail.com>.
It would look like this:


  <div class="addItemTable">
     <ul class="addItem">
        <li>
            <h:commandLink action="#{globalOptionsMgr.addOption}"
value="LABEL" />
        </li>
     </ul>
  </div>

[ie, what you had without any verbatim tags]

I think your only other option would be to xml-escape all of the tags
enclosed in your verbatim tags.

On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> Thanks for the suggestion.  I've never used facelets, so would you
> be willing to sketch how this chunk of code would look using that
> technology?
>
> Is there any other solution without using facelets?  For example, is
> there a JSP (or Jasper) configuration that will relax the parser?
>
> Thanks,
> Bryan
>
> Andrew Robinson wrote:
> > Use Facelets instead of JSP. You will not need verbatim tags anymore with it
> >
> > On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> >
> >> Hi all,
> >>
> >> I am using JSPX syntax for my JSF pages.  I occasionally need to use
> >> raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
> >> a problem with the Jasper compiler of these verbatim tags break the
> >> start/end tags of the HTML.
> >>
> >> Here's an example:
> >>
> >> <f:verbatim>
> >>    <div class="addItemTable">
> >>       <ul class="addItem">
> >>          <li></f:verbatim>
> >>              <h:commandLink action="#{globalOptionsMgr.addOption}"
> >> value="LABEL" />
> >>          <f:verbatim></li>
> >>       </ul>
> >>    </div>
> >> </f:verbatim>
> >>
> >> The Jasper error I get is:
> >> org.apache.jasper.JasperException:
> >> /dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be
> >> terminated by the matching end-tag "</li>".
> >>         at
> >> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
> >>         at
> >> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
> >>         at
> >> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
> >>         at
> >> org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)
> >>
> >> Does anyone know how to work around this problem?
> >>
> >> Thanks,
> >> Bryan
> >>
> >>
> >>
>
>

Re: JSPX syntax delima

Posted by simon <sk...@apache.org>.
On Fri, 2007-08-03 at 14:31 -0600, Bryan Basham wrote:

> Is there any other solution without using facelets?  For example, is
> there a JSP (or Jasper) configuration that will relax the parser?

Yep, it's called JSP (not JSPX) :-)

That's the point of JSPX - that the input is valid XML. And that means
the tags must be balanced.

There is a JSF tag library that provides a JSF equivalent for every html
tag, so you can write
  h:ul
    h:ui
etc and then you don't need f:verbatim. However that's not a very
efficient solution; a JSF component gets created for each such element
rather than treating the embedded html as simply raw text. See:
  http://jsftutorials.net/htmLib/

Regards,

Simon



Re: JSPX syntax delima

Posted by Bryan Basham <bb...@stillsecure.com>.
Thanks for the suggestion.  I've never used facelets, so would you
be willing to sketch how this chunk of code would look using that
technology?

Is there any other solution without using facelets?  For example, is
there a JSP (or Jasper) configuration that will relax the parser?

Thanks,
Bryan

Andrew Robinson wrote:
> Use Facelets instead of JSP. You will not need verbatim tags anymore with it
>
> On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
>   
>> Hi all,
>>
>> I am using JSPX syntax for my JSF pages.  I occasionally need to use
>> raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
>> a problem with the Jasper compiler of these verbatim tags break the
>> start/end tags of the HTML.
>>
>> Here's an example:
>>
>> <f:verbatim>
>>    <div class="addItemTable">
>>       <ul class="addItem">
>>          <li></f:verbatim>
>>              <h:commandLink action="#{globalOptionsMgr.addOption}"
>> value="LABEL" />
>>          <f:verbatim></li>
>>       </ul>
>>    </div>
>> </f:verbatim>
>>
>> The Jasper error I get is:
>> org.apache.jasper.JasperException:
>> /dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be
>> terminated by the matching end-tag "</li>".
>>         at
>> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
>>         at
>> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
>>         at
>> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
>>         at
>> org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)
>>
>> Does anyone know how to work around this problem?
>>
>> Thanks,
>> Bryan
>>
>>
>>     


Re: JSPX syntax delima

Posted by Andrew Robinson <an...@gmail.com>.
Use Facelets instead of JSP. You will not need verbatim tags anymore with it

On 8/3/07, Bryan Basham <bb...@stillsecure.com> wrote:
> Hi all,
>
> I am using JSPX syntax for my JSF pages.  I occasionally need to use
> raw HTML surrounded by <f:verbatim> tags.  However, I am hitting
> a problem with the Jasper compiler of these verbatim tags break the
> start/end tags of the HTML.
>
> Here's an example:
>
> <f:verbatim>
>    <div class="addItemTable">
>       <ul class="addItem">
>          <li></f:verbatim>
>              <h:commandLink action="#{globalOptionsMgr.addOption}"
> value="LABEL" />
>          <f:verbatim></li>
>       </ul>
>    </div>
> </f:verbatim>
>
> The Jasper error I get is:
> org.apache.jasper.JasperException:
> /dhcp/ConfigureServerOptions.jspx(86,14) The element type "li" must be
> terminated by the matching end-tag "</li>".
>         at
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
>         at
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
>         at
> org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:211)
>
> Does anyone know how to work around this problem?
>
> Thanks,
> Bryan
>
>

Re: JSPX syntax delima

Posted by Bryan Basham <bb...@stillsecure.com>.
Thanks for the replies, everyone.

After wrestling with facelets for several hours, I gave up.
I don't have time right now to fit yet another technology
into our already complex mix.  Likewise, it is not the right
time for my project to migrate to JSF v1.2.

What I did discover is that you can use CDATA blocks inside
of the verbatim tags to tell XML parser to ignore the HTML tags.

Here's this solution:
<f:verbatim><![CDATA[
   <div class="addItemTable">
      <ul class="addItem">
         <li>]]></f:verbatim><h:commandLink 
action="#{globalOptionsMgr.addOption}" 
value="#{messages['dhcp.ConfigureServerOptions.addOptionButton.Label']}" 
/><f:verbatim><![CDATA[</li>
      </ul>
   </div>]]>
</f:verbatim>

Cheers,
Bryan