3 Replies Latest reply on Feb 7, 2008 12:50 PM by peterj

    deploy jsp-jsf

    giuseppe.sassone

      - I have one file named index.jsp in principal root of my application
      - with button i go in WEB-INF/result/success.jsp
      - in this page (success.jsp) there is that code row:
      Please try again.
      on http://localhost:8080/miaCartella is ok but in http://localhost:8080/portal open success.jsp at button click but not return in index.jsp with link <a href ...>

      why ?

        • 1. Re: deploy jsp-jsf
          peterj

          If I understand you question correctly, you have deployed a war containing two jsps (index.jsp and success.jsp). You are able to access index,jsp using the web application context (.../miaCartella), but you are not able to access the application via the portal.

          Have you written a portlet? (You never mentioned if you did.) If you have written a portlet, what are the contents of the portlet and the portlet.xml, portlet-instences.xml ,and *-object.xml descriptors?

          • 2. Re: deploy jsp-jsf
            giuseppe.sassone

            sorry and thanks for replay,
            I open the application under JBoss Portal like portlet correctly. The first page call me a string in a textfield, I click the button and it go at success.jsp correctly. Then I click "try again" (code on jsp success.jsp= try again ) and not return on register.jsp instead if I try application not a like a portlet but directory on the AS (http://localhost:8080/JSFDynamic) the navigation throws the pages is correct.

            I have this directory structure:
            register.jsp
            WEB-INF
            ->result/success.jsp
            ->result/bad-address.jsp
            ->result/bad-password.jsp

            under WEB-INF there are my xml files:
            FACES-CONFIG.XML
            <?xml version='1.0' encoding='UTF-8'?>
            <!DOCTYPE faces-config PUBLIC
            "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
            "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

            <faces-config>
            <managed-bean>
            <managed-bean-name>registrationBean</managed-bean-name>
            <managed-bean-class>coreservlets.RegistrationBean</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
            </managed-bean>
            <navigation-rule>
            <from-view-id>/register.jsp</from-view-id>
            <navigation-case>
            <from-outcome>bad-address</from-outcome>
            <to-view-id>/WEB-INF/results/bad-address.jsp</to-view-id>
            </navigation-case>
            <navigation-case>
            <from-outcome>bad-password</from-outcome>
            <to-view-id>/WEB-INF/results/bad-password.jsp</to-view-id>
            </navigation-case>
            <navigation-case>
            <from-outcome>success</from-outcome>
            <to-view-id>/WEB-INF/results/success.jsp</to-view-id>
            </navigation-case>
            </navigation-rule>
            </faces-config>

            JSFDYNAMIC-OBJECT.XML
            <?xml version="1.0" encoding="UTF-8"?>


            <if-exists>overwrite</if-exists>
            <parent-ref>default.default</parent-ref>

            <window-name>JSFDynamicPortletWindow</window-name>
            <instance-ref>JSFDynamicPortletInstance</instance-ref>
            center
            1




            PORTLET.XML
            <?xml version="1.0" encoding="UTF-8"?>
            <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
            version="1.0">

            <portlet-name>JSFDynamicPortlet</portlet-name>
            <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
            <init-param>
            default-view
            /register.jsp
            </init-param>

            <mime-type>text/html</mime-type>
            <portlet-mode>VIEW</portlet-mode>

            <portlet-info>
            ESEMPIO DI JSF DINAMICO
            </portlet-info>

            </portlet-app>

            PORTLET-INSTANCE.XML
            <?xml version="1.0" standalone="yes"?>



            <instance-id>JSFDynamicPortletInstance</instance-id>
            <portlet-ref>JSFDynamicPortlet</portlet-ref>




            WEB.XML
            <?xml version="1.0"?>
            <web-app 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"
            version="2.4">

            <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>server</param-value>
            </context-param>

            <context-param>
            <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
            <param-value>true</param-value>
            </context-param>
            <!-- Faces Servlet
            Marty Hall: changed .jsf back to standard of .faces -->

            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>

            <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.faces</url-pattern>
            </servlet-mapping>



            <!-- Added a filter that redirects all requests sent to blah.jsp to
            blah.faces instead. This assumes that there are no non-JSF
            JSP pages in the entire Web application. See code for other
            assumptions and restrictions.
            From http://www.coreservlets.com/JSF-Tutorial/.-->
            <!-- Register the name "faces-redirect-filter" for FacesRedirectFilter. -->

            <filter-name>faces-redirect-filter</filter-name>
            <filter-class>coreservlets.FacesRedirectFilter</filter-class>

            <!-- Apply the faces redirect filter to all JSP pages. -->
            <filter-mapping>
            <filter-name>faces-redirect-filter</filter-name>
            <url-pattern>*.jsp</url-pattern>
            </filter-mapping>

            <!-- Welcome files -->
            <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>index.html</welcome-file>
            </welcome-file-list>

            </web-app>

            Must I change my configuration files to deploy this applicationa as a portlet ?

            Thank you

            • 3. Re: deploy jsp-jsf
              peterj

              OK, so you are saying that JSF navigation links are not correctly working when you deploy your app as a portlet. I will let someone else answer as I have not used JSF within portlets.