Re: Primefaces FileUpload and Prettfaces Error

Splash Forums PrettyFaces Users Primefaces FileUpload and Prettfaces Error Re: Primefaces FileUpload and Prettfaces Error

#20316

kency
Participant

i use JSF 2.0,Mojarra 2.0.2, GF v3 and NetBeans 6.9.1

PrettyFaces Config

=================================================================

<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.1.0
http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.1.0.xsd">

<!-- Begin RewriteRules -->

<rewrite match="(?i)^(.*);jsessionid=w+(.*)" substitute="$1$2" redirect="chain" />
<!-- Begin UrlMappings -->

<url-mapping id="home">
<pattern value="/" />
<view-id>/faces/index.xhtml</view-id>
</url-mapping>

<url-mapping id="adminindex">
<pattern value="/admin/index" />
<view-id>/faces/admin/index.xhtml</view-id>
</url-mapping>

<url-mapping id="adminlogin">
<pattern value="/admin/login" />
<view-id>/faces/admin/login.xhtml</view-id>
</url-mapping>

<url-mapping id="mainRegister">
<pattern value="/index/register" />
<view-id>/faces/com/content/register/chinhreg.xhtml</view-id>
</url-mapping>

<url-mapping id="registerPage">
<pattern value="/index/register/procedure" />
<view-id>/faces/com/content/register/register.xhtml</view-id>
</url-mapping>

<url-mapping id="registerMessage">
<pattern value="/index/register/success" />
<view-id>/faces/com/content/register/success.xhtml</view-id>
</url-mapping>

<url-mapping id="homeLogin">
<pattern value="/index/login" />
<view-id>/faces/com/content/login/login.xhtml</view-id>
</url-mapping>

<url-mapping id="loginError">
<pattern value="/index/login/error" />
<view-id>/faces/com/content/login/error.xhtml</view-id>
</url-mapping>

<url-mapping id="about">
<pattern value="/index/about" />
<view-id>/faces/com/content/about/about.xhtml</view-id>
</url-mapping>

<url-mapping id="itemslist">
<pattern value="/index/category/#{catItemsListController.subDetails.subcatName}" />
<view-id>/faces/com/content/items/itemlist.xhtml</view-id>
</url-mapping>

<url-mapping id="itemdetails">
<pattern value="/index/items/#{catItemsListController.itemsDetails.itemid}" />
<view-id>/faces/com/content/items/itemdetails.xhtml</view-id>
</url-mapping>

<url-mapping id="cart">
<pattern value="/index/cart/#{memberLoginController.user.username}" />
<view-id>/faces/com/content/items/cart.xhtml</view-id>
</url-mapping>

</pretty-config>

=================

in Web.xml i config

<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>

and my xhtml code

<h:form  id="addItemForm"  enctype="multipart/form-data">

<h:panelGrid columns="2" id="addItemPanel">
<h:outputLabel value="ProductName" for="itemName" />
<h:inputText id="itemName" value="#{itemStatusController.item.itemName}" title="ItemName" required="true" requiredMessage="The ItemName field is required."/>
<h:outputLabel value="Describe" for="itemDescribe" />
<h:inputText id="itemDescribe" value="#{itemStatusController.item.itemDescribe}" title="ItemDescribe" />
<h:outputLabel value="Details" for="itemDetail" />
<p:editor id="itemDetail" value="#{itemStatusController.item.itemDetail}" widgetVar="addItemEditor"/>
<h:outputLabel value="Img" for="imgAvatar" />
<p:fileUpload fileUploadListener="#{itemStatusController.handleFileUpload}" update="growl1,imgAvatar" />
<h:outputLabel value="Thumbnail" />
<h:graphicImage value="/item/#{itemStatusController.name}" id="imgAvatar" />
<h:outputLabel value="Instock" for="instock" />
<h:inputText id="instock" value="#{itemStatusController.item.instock}" title="Instock" required="true" requiredMessage="The Instock field is required."/>
<h:outputLabel value="Price" for="price" />
<h:inputText id="price" value="#{itemStatusController.item.price}" title="Price" required="true" requiredMessage="The Price field is required."/>
<h:outputLabel value="fine" for="fine" />
<h:inputText id="fine" value="#{itemStatusController.item.fine}" title="Fine" required="true" requiredMessage="The Fine field is required."/>
<h:outputLabel value="DateExp" for="dateexp" />
<h:inputText id="dateexp" value="#{itemStatusController.item.dateexp}" title="Dateexp" required="true" requiredMessage="The Dateexp field is required."/>
<h:outputLabel value="Author" for="author" />
<h:inputText id="author" value="#{itemStatusController.item.author}" title="Author" />
<h:outputLabel value="Status:" for="status" />
<h:selectOneMenu id="status" value="#{itemStatusController.item.status}" title="SubCat" required="true" requiredMessage="The SubCat field is required.">
<!-- TODO: update below reference to list of available items-->
<f:selectItems value="#{itemStatusController.enumStatus}"/>

</h:selectOneMenu>
<h:outputLabel value="Category" for="subCat" />
<h:selectOneMenu id="subCat" value="#{itemStatusController.item.subCat}" title="SubCat" required="true" requiredMessage="The SubCat field is required.">
<!-- TODO: update below reference to list of available items-->
<f:selectItems value="#{itemStatusController.allSubCat}"/>
</h:selectOneMenu>

</h:panelGrid>
<p:commandButton onclick="addItemEditor.saveHTML()" style="float: right" update="itemlistForm:itemlistTable,growl1" action="#{itemStatusController.addNewItem}" value="Add" />

</h:form>