7 Replies Latest reply on Oct 26, 2009 6:17 AM by nbelaevski

    Question to include jsp pages

    debolina123

      I am trying to include a jsp file and also pass a value to the jsp file.
      I am using jsp:include and jsp:param for it.
      The inclusion of the jsp files depends on a condition. So I have added the jsp:include inside a
      h:panelGroup which is inside a a4j panel.
      I have a rerender section which rerenders the a4j panel and then check for the value in the h:panel by the rendered
      attribute.

      <a4j:panel id="rerenderthisportion">
      <h:panelGroup rendered=#{test.value}>
      <jsp:include page="scripts/login.jsp">
      <jsp:param name="parameterName" value="test />
      </jsp:include>
      </h:panelGroup>
      </a4j:panel>

      The code I have does not work. However, if i try a simple h:outputText it does updates the value depending on the rendered attributes.

      Is there any other way to include the jsp page and pass a value to it using richfaces?

      Thanks,

      Deb

        • 1. Re: Question to include jsp pages
          nbelaevski

          Hi Deb,

          Please clarify - what's exactly not working?

          • 2. Re: Question to include jsp pages
            faisalgeek

             

            "debolina123" wrote:
            I am trying to include a jsp file and also pass a value to the jsp file.
            I am using jsp:include and jsp:param for it.
            The inclusion of the jsp files depends on a condition. So I have added the jsp:include inside a
            h:panelGroup which is inside a a4j panel.
            I have a rerender section which rerenders the a4j panel and then check for the value in the h:panel by the rendered
            attribute.

            <a4j:panel id="rerenderthisportion">
            <h:panelGroup rendered=#{test.value}>
            <jsp:include page="scripts/login.jsp">
            <jsp:param name="parameterName" value="test />
            </jsp:include>
            </h:panelGroup>
            </a4j:panel>

            The code I have does not work. However, if i try a simple h:outputText it does updates the value depending on the rendered attributes.

            Is there any other way to include the jsp page and pass a value to it using richfaces?

            Thanks,

            Deb


            It (jsp include) will not work proper under JSF pages, try to use
            <a4j:include viewId="scripts/login.jsp"></a4j:include>



            • 3. Re: Question to include jsp pages
              debolina123

              By not working I mean, if I use the renedered attribute in the h:panelGroup the jsp pages are not getting included.
              Also if I use a4j:include , how do I pass a paramter to the jsp page?
              Thanks,
              Deb

              • 4. Re: Question to include jsp pages
                nbelaevski

                 

                "debolina123" wrote:
                By not working I mean, if I use the renedered attribute in the h:panelGroup the jsp pages are not getting included.

                What if you use rendered="true", not "#{test.value}"?

                • 5. Re: Question to include jsp pages
                  debolina123

                  I have tried renedered = true. It still does not include the jsp pages. Only if I do not use the rendered attribute atall, the pages gets included.
                  Thanks,
                  D

                  • 6. Re: Question to include jsp pages
                    ilya_shaikovsky

                    test bean should be session scoped. possible problem with conditional rendering described at:
                    http://livedemo.exadel.com/richfaces-demo/richfaces/keepAlive.jsf (the same evaluation problem but for disabled attribute)

                    • 7. Re: Question to include jsp pages
                      nbelaevski

                      Deb,

                      This works ok for me:

                      <?xml version="1.0" encoding="ISO-8859-1"?>
                      
                      <jsp:root version="2.1" xmlns:jsp="http://java.sun.com/JSP/Page"
                       xmlns:c="http://java.sun.com/jsp/jstl/core"
                       xmlns:f="http://java.sun.com/jsf/core"
                       xmlns:h="http://java.sun.com/jsf/html"
                       xmlns:rich="http://richfaces.org/rich"
                       xmlns:a4j="http://richfaces.org/a4j">
                      
                       <jsp:directive.page contentType="text/html" pageEncoding="ISO-8859-1" />
                       <jsp:output omit-xml-declaration="yes" doctype-root-element="html"
                       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
                       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
                      
                       <f:view>
                       <html xmlns="http://www.w3.org/1999/xhtml">
                       <head><title>Page</title></head>
                       <body>
                      
                       <a4j:outputPanel id="rerenderthisportion">
                       <h:panelGroup rendered="true">
                       <jsp:include page="forum5_incl.jspx">
                       <jsp:param name="parameterName"
                       value="test" />
                       </jsp:include>
                       </h:panelGroup>
                       </a4j:outputPanel>
                       </body>
                       </html>
                       </f:view>
                      </jsp:root>


                      <?xml version="1.0" encoding="ISO-8859-1"?>
                      
                      <jsp:root version="2.1" xmlns:jsp="http://java.sun.com/JSP/Page"
                       xmlns:c="http://java.sun.com/jsp/jstl/core"
                       xmlns:f="http://java.sun.com/jsf/core"
                       xmlns:h="http://java.sun.com/jsf/html"
                       xmlns:rich="http://richfaces.org/rich"
                       xmlns:a4j="http://richfaces.org/a4j">
                      
                       <f:subview id="subview">
                       Subview
                       </f:subview>
                      </jsp:root>


                      Probably, this issue can be the cause: https://jira.jboss.org/jira/browse/RF-7947