5 Replies Latest reply on Oct 22, 2008 4:20 AM by Zhivko Asenov

    problems while testing drag drop sample with richfaces

    Zhivko Asenov Newbie

      Hi,
      i am trying to deploy on a tomcat 6.0 a sample for drag and drop with richfaces and i am using only the code of the archive what i've downloaded. I am always getting this:
      index.jsp(57,38) #{..} is not allowed in template text at the places where is called <rich:dragSupport .... or <rich:dropSupport

      How to get rid of these errors?

      Thanks

        • 1. Re: problems while testing drag drop sample with richfaces
          Nick Belaevski Master

          Hi,

          Probably you are using EL expressions (#{...}) outside of JSF tags and JSP doesn't like that. Can you please post page source here?

          • 2. Re: problems while testing drag drop sample with richfaces
            Zhivko Asenov Newbie

            here the code, what actually comes from the richfaces samples:

            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>




            .dropzoneDecoration {
            width: 100px; height: 100px; border: 2px dotted navy;
            }

            .accept {
            border: 3px dotted green;
            padding: 10px;
            }

            .reject {
            border: 3px dashed red;
            padding: 10px;
            }




            //DnD.CLIENT_VALIDATION_OFF = true;


            <f:view>
            <h:form id="form">
            <h:selectOneRadio binding="#{skinBean.component}" />
            <h:commandLink action="#{skinBean.change}" value="set skin" />

            <h:panelGroup id="dragValueText">
            <h:outputText value="#{bean.dragValue}" />
            </h:panelGroup>

            <h:panelGrid columns="3">
            <h:dataTable var="type" value="#{bean.types}">
            <h:column>
            <h:panelGrid styleClass="dropzoneDecoration" id="drop1">
            <h:outputText value="#{type} - drop" />


            </h:panelGrid>
            </h:column>
            </h:dataTable>

            <h:dataTable var="type" value="#{bean.types}">
            <h:column>
            <h:panelGrid styleClass="dropzoneDecoration" id="drag1">
            <h:outputText value="#{type} - drag" />

            <rich:dragSupport dragType="#{type}" dragValue="#{type} - value" action="#{bean.dragAction}" dragListener="#{bean.processDrag}">
            <a4j:actionparam value="#{type} - test drag param" assignTo="#{bean.testParam}" />
            </rich:dragSupport>
            </h:panelGrid>
            </h:column>
            </h:dataTable>

            <h:dataTable var="type" value="#{bean.types}">
            <h:column>
            <h:panelGrid styleClass="dropzoneDecoration" id="drop2">
            <h:outputText value="#{type} - drop" />

            <rich:dropSupport reRender="dragValueText" action="#{bean.dropAction}" acceptedTypes="#{type}" dropListener="#{bean.processDrop}" dropValue="#{type} - value">
            </rich:dropSupport>
            </h:panelGrid>
            </h:column>
            </h:dataTable>
            </h:panelGrid>

            <rich:dragIndicator id="indicator" acceptClass="accept" rejectClass="reject" style="width: 500px;">
            <f:facet name="single">
            <f:verbatim>
            {marker} {testDrag} {label}
            </f:verbatim>
            </f:facet>

            <rich:dndParam name="accept" value="ACCEPT:" />

            <rich:dndParam name="reject">
            <f:verbatim>
            REJECT:
            </f:verbatim>
            </rich:dndParam>
            </rich:dragIndicator>

            <h:panelGrid columns="1" style="position: relative; left: 140px;">
            <h:panelGrid columns="1" style="position: absolute; top: 30px; left: 300px;">
            <rich:dragIndicator id="defaultIndicator" style="width: 400px;">
            </rich:dragIndicator>
            </h:panelGrid>
            </h:panelGrid>

            <h:panelGrid columns="4" cellspacing="20">
            <h:panelGrid styleClass="dropzoneDecoration" id="grid1">
            <f:verbatim>
            Accepts file & folder... Customizes
            </f:verbatim>

            <rich:dropSupport id="zone1" ondrop="var zone = document.getElementById('form:grid1'); zone.style.borderColor= 'red'; setTimeout( function() { this.style.borderColor= 'navy'; }.bind(zone), 300);" acceptedTypes="file, folder" typeMapping="{file: testDrop}">
            <rich:dndParam name="testDrop">
            <h:graphicImage height="16" width="16" value="/images/file-manager.png" />
            </rich:dndParam>

            </rich:dropSupport>
            </h:panelGrid>


            <h:panelGrid styleClass="dropzoneDecoration" id="grid2">
            <f:verbatim>
            Accepts none
            </f:verbatim>

            <rich:dropSupport>
            </rich:dropSupport>
            </h:panelGrid>

            <h:panelGrid styleClass="dropzoneDecoration" id="grid3">
            <f:verbatim>
            Accepts none... Customizes
            </f:verbatim>

            <rich:dropSupport typeMapping="{file: testDrop}">
            <rich:dndParam name="testDrop">
            <h:graphicImage height="16" width="16" value="/images/file-manager-reject.png" />
            </rich:dndParam>

            </rich:dropSupport>
            </h:panelGrid>

            <h:panelGrid styleClass="dropzoneDecoration" id="grid4">
            <f:verbatim>
            Accepts file & folder
            </f:verbatim>
            <rich:dropSupport acceptedTypes="file, folder">
            <rich:dndParam name="testDrop" value="testDropValue" />

            </rich:dropSupport>
            <h:selectOneMenu>
            <f:selectItem itemValue="test1" itemLabel="TEST1"/>
            <f:selectItem itemValue="test2" itemLabel="TEST2"/>
            <f:selectItem itemValue="test3" itemLabel="TEST3"/>
            <f:selectItem itemValue="test4" itemLabel="TEST4"/>
            <f:selectItem itemValue="test5" itemLabel="TEST5"/>
            </h:selectOneMenu>
            </h:panelGrid>

            <h:panelGrid id="grid5">
            <rich:dragSupport dragType="file">
            <rich:dndParam name="label" value="Label" />
            <rich:dndParam name="testDrag" value="testDragValue" />

            </rich:dragSupport>
            <f:verbatim>File Draggable - no indicator</f:verbatim>
            </h:panelGrid>

            <h:panelGrid id="grid6">
            <rich:dragSupport dragType="file" dragIndicator="indicator">
            <rich:dndParam name="label" value="Label" />
            <rich:dndParam name="testDrag" value="testDragValue" />

            </rich:dragSupport>
            <f:verbatim>File Draggable with indicator</f:verbatim>
            </h:panelGrid>

            <h:panelGrid id="grid7">
            <rich:dragSupport dragType="folder" dragIndicator="indicator">
            <rich:dndParam name="label" value="Label" />
            <rich:dndParam name="testDrag" value="testDragValue for Folder" />

            </rich:dragSupport>
            <f:verbatim>Folder Draggable with indicator</f:verbatim>
            </h:panelGrid>

            <h:outputText />

            <h:panelGrid id="grid8">
            <rich:dragSupport dragType="folder">
            <rich:dndParam name="label" value="Label" />
            <rich:dndParam name="testDrag" value="testDragValue for Folder" />

            </rich:dragSupport>
            <f:verbatim>Folder Draggable - no indicator</f:verbatim>
            </h:panelGrid>

            <h:panelGrid id="grid9">
            <rich:dragSupport dragType="file" dragIndicator="defaultIndicator">
            <rich:dndParam name="testDrag" type="drop" value="testDragValue" />

            <rich:dndParam name="marker" value="testMarkerValue" />
            <rich:dndParam name="label" value="testDragValue" />

            </rich:dragSupport>
            <f:verbatim>File Draggable with defaultIndicator</f:verbatim>
            </h:panelGrid>

            <h:panelGrid id="grid10">
            <rich:dragSupport dragType="folder" dragIndicator="defaultIndicator">
            <rich:dndParam name="label" value="testDragValue for Folder" />

            </rich:dragSupport>
            <f:verbatim>Folder Draggable with defaultIndicator</f:verbatim>
            </h:panelGrid>

            <h:outputText />

            </h:panelGrid>

            <h:selectOneMenu>
            <f:selectItem itemValue="test1" itemLabel="TEST1"/>
            <f:selectItem itemValue="test2" itemLabel="TEST2"/>
            <f:selectItem itemValue="test3" itemLabel="TEST3"/>
            <f:selectItem itemValue="test4" itemLabel="TEST4"/>
            <f:selectItem itemValue="test5" itemLabel="TEST5"/>
            </h:selectOneMenu>

            <h:panelGrid id="renderedId">
            <rich:dragSupport dragType="file" dragIndicator="defaultIndicator">
            <rich:dndParam name="marker" value="testMarkerValue" />
            <rich:dndParam name="label" value="testDragValue" />
            </rich:dragSupport>

            <h:graphicImage id="dragImage" value="/images/file-manager.png" width="48" />
            <f:verbatim>
            dragSupport
            </f:verbatim>
            </h:panelGrid>

            <h:panelGroup id="group">
            <f:verbatim>
            PanelGroup
            </f:verbatim>
            <rich:dropSupport acceptedTypes="file" dropListener="#{bean.processDrop}" />
            </h:panelGroup>

            <h:panelGrid id="renderedIdII" style="border: 1px solid red;">
            <rich:dropSupport acceptedTypes="file" dropListener="#{bean.processDrop}" />
            <f:verbatim>

            dropSupport

            </f:verbatim>
            </h:panelGrid>

            <a4j:status startText="...request..." stopText="stop" />
            <a4j:outputPanel ajaxRendered="true">
            <h:messages />
            </a4j:outputPanel>

            <h:outputText>
            <rich:dropSupport acceptedTypes="file" />
            </h:outputText>

            <h:outputText>
            <rich:dragSupport dragType="file" />
            </h:outputText>


            </h:form>
            </f:view>


            • 3. Re: problems while testing drag drop sample with richfaces
              Zhivko Asenov Newbie

              and the error message now is different:

              org.apache.jasper.JasperException: javax.servlet.ServletException: Servlet execution threw an exception
              org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:486)
              org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
              org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
              org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
              javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
              com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
              com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
              org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
              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.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
              org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
              org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)

              root cause

              javax.servlet.ServletException: Servlet execution threw an exception
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
              com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
              com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
              com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
              org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
              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.webapp.BaseFilter.doFilter(BaseFilter.java:522)
              com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
              com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
              com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
              org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
              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.webapp.BaseFilter.doFilter(BaseFilter.java:522)
              com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
              com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
              com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
              org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
              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.webapp.BaseFilter.doFilter(BaseFilter.java:522)
              com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
              com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
              com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
              org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
              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.webapp.BaseFilter.doFilter(BaseFilter.java:522)
              com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
              com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
              com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
              org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
              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.webapp.BaseFilter.doFilter(BaseFilter.java:522) ........

              it seems to me that the code generally wants to work :(
              any ideas?

              PS: to the error message what i was describing before it was missing tag "rich". At the beginning it stood in the jsp-page
              <%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/drag-drop" prefix="dnd" %> but then i've got that this url is not resolveable and i changed it to the rich prefix everywhere in code where stood dnd, but i have forgotten to add the uri. And after adding the taglib for rich prefix i am getting the error messege above.

              • 4. Re: problems while testing drag drop sample with richfaces
                Nick Belaevski Master

                Stack trace you've posted is not very useful because it is missing information about real cause: what exception happened and where :( Can you please check Tomcat logs for full stack trace?

                • 5. Re: problems while testing drag drop sample with richfaces
                  Zhivko Asenov Newbie

                  hi,

                  mmm sorry for losing your time with my post. I haven't imported precisely the whole package and that's why i had so many error messages. Now everything starts as it should be. Thanks a lot for the replies.

                  Bests,