vendredi 20 mars 2015



Hello there Im developing in JSF with Primefaces 4.0. I start the application and everything is well. But time session is expired with spring and the page redirects to login. When I acces again, the view state is still expired or something weird because it doesnt write the html, just a partial response. Here is my code



WEB.xml

`<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<servlet>
<servlet-name>reconciliation-dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/conf/spring/vpm-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:security-entry-point-web.xml
/WEB-INF/conf/spring/vpm-servlet.xml</param-value>
</context-param>



<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>




<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>

<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>

<servlet-mapping>
<servlet-name>reconciliation-dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/views/</url-pattern>
</servlet-mapping>


<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<session-config>
<session-timeout>40</session-timeout>
</session-config>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>

<error-page>
<exception-type>javax.faces.application.ViewExpiredException
</exception-type>
<location>/index.jsp</location>
</error-page>

</web-app>`

<!-- begin snippet-->


And heres is the XHTML



<html xmlns="http://ift.tt/lH0Osb"
xmlns:h="http://ift.tt/HjFrZb"
xmlns:f="http://ift.tt/HcrI1S"
xmlns:ui="http://ift.tt/KsEgXx"
xmlns:p="http://ift.tt/HjFrZc"
xmlns:fn="http://ift.tt/1lpNXqs">


<f:view transient="true">
<h:head>
<h:outputStylesheet library="styles" name="styleT.css" />
<h:outputStylesheet library="styles" name="PrimeFaces.css" />
<h:outputStylesheet library="styles/modal" name="modals2.css" />
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head"/>
<h:outputScript library="js" name="FloatDialog.js" target="head" />
<h:outputScript library="js" name="FormValidations.js" target="head" />
<script type="text/javascript">
//<![CDATA[

//]]>
</script>

</h:head>


<h:body styleClass="bodyStyle">

<header>
<h:graphicImage library="images" name="logoAA.png"
id="logo" />
<h1>Vehicle Processing Management</h1>

<ul id="setbuttons">
<li><h:graphicImage library="images" name="bellico.png" /></li>
<li><h:graphicImage library="images" name="logoutIco.png" /></li>
</ul>
</header>

<section id="wrapper">

<aside>
<h:form id="formModules" prependId="false">
<ul class="navigator">

<li class="vehicleBactive">
<p:commandLink id="modulePendingAssignments" action="#{repossessionApprovals.switchModule}" ajax="true" update=":panelPendingAssignments" >
<span>Pending Assignments</span>
</p:commandLink>
</li>

<li class="recoveryB">
<p:commandLink id="moduleRecoveryAgent" action="#{repossessionApprovals.switchModule}" ajax="true" update=":panelPendingAssignments" >
<span>Recovery Agent Management</span>
</p:commandLink>
</li>



<li class="auctionB"><a href="#"><span>Vehicles assigned to an Auction House</span></a></li>
<li class="invoiceB"><a href="#"><span>Recovery Agency Invoice</span></a></li>
<li class="proceedsB"><a href="#"><span>Auction House Proceeds</span></a></li>
</ul>
</h:form>
</aside>



<section id="container">

<!-- ****************************************Growl Messages************************************************** -->
<p:growl id="msg" life="7000" showDetail="true" escape="false" widgetVar="msgGrowl" globalOnly="true" />

<!-- ******************************************************* PANEL DIVISION ************************************************************************ -->




<p:outputPanel id="panelPendingAssignments" rendered="#{repossessionApprovals.renderPanel == 1 ? true:false}">

<h2>Pending Assignments</h2>
<h:graphicImage library="images" name="bigShadow.png" class="bigshadow" style="margin-top:-8px;" />
<div class="myInfo">
<div class="subTexty"></div>
</div>

<div class="contentTabla859">

<div class="tablaProcess">
<div class="tablaProcessTitleRow">
<div class="tableProcessCell row10"></div>
<div class="tableProcessCell row15"></div>
<div class="tableProcessCell row5">
<h:graphicImage id="filtersIco" library="images" name="filtersIco.png"
onclick="openDialog('filter_dialog',$(this), 'bottom_left');"/>
</div>
</div>
</div>

<div class="contenedorinterno" style="height: 520px;">

<ui:repeat var="pendingA" value="#{repossessionApprovals.pendingAssignments}" varStatus="index">
<div class="tablaProcessRow">
<div class="tableProcessCell row10">
<h:graphicImage library="images" name="alertaIco.png" />
</div>
<div class="tableProcessCell01 row15">
<ul>
<li><strong>
#{pendingA.vehicleStatusId == 8 ? "Repossession Recovery Agent Assignment":
pendingA.vehicleStatusId == 5 ? "Repossession Auction House Assignment":
pendingA.vehicleStatusId == 3 ? "Voluntary Surrender - Recovery Agent or Auction House Assignment":
pendingA.vehicleStatusId == 2 ? "Abandon - Recovery Agent or Auction House Assignment":
"Not available or wrong status"}
</strong></li>
<br />

<li>Vehicle Status: #{pendingA.vehicleStatus} #{pendingA.vehicleStatusId}</li>
<li>Loan Numbers (s): #{pendingA.loanId}</li>
<li>Creation Date: #{pendingA.createdDate.split('/')[1]}/#{pendingA.createdDate.split('/')[0]}/#{pendingA.createdDate.split('/')[2].split(' ')[0]}</li>
</ul>
</div>
<div class="tableProcessCell row5">
<p:commandLink action="#{repossessionApprovals.GetAssignmentsInformationDetails(repossessionApprovals.pendingAssignments.indexOf(pendingA))}"
ajax="true" update=":panelPendingAssignments" >
<!-- onComplete="preAdjustPositionning($('#dialogDock'), $('#optionsDialog'));"> -->
<h:graphicImage library="images" name="checksRight.png" />
</p:commandLink>
</div>
</div>
</ui:repeat>

</div>

</div>
<div class=" spaceMicr"></div>

</p:outputPanel>
</section>
</section>

<div id="img-out"></div>

<footer>©Copyright</footer>



</h:body>
</f:view>
</html>

<!-- end snippet -->

Here is my bean







import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import org.primefaces.context.RequestContext;


@ManagedBean
@ViewScoped
public class RepossessionApprovals {


}

enter code here







And when I run again it brings me something like:





<partial-response>
<changes>
<update id="javax.faces.ViewState">234065619769382809:-4498953143834600826</update>
</changes>
</partial-response>







>

So I tried to catch this on Phase Listener, With a filter and even with a view expired exception and it catch the error but when finished do not redirect and show the partial response.


If you want that I post the Phase listener and the filter and the view expired exception I will. But do you have an idea of what is happening? Thankyou!




Aucun commentaire:

Enregistrer un commentaire