You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Boris Kovalenko <bo...@tagnet.ru> on 2006/07/22 11:42:03 UTC

Am I crazy? (or converters problems)

Hello!

	myfaces-core-1.1.4-snap, tomahawk 1.3, facelets 1.1.11. I'm getting 
troubles with this code (see below). When I pressing save button I get 
conversation error messages,

javax.faces.component.UIInput.CONVERSION for t:inputText and 
javax.faces.component.UISelectOne.INVALID for t:selectOneMenu

even I do not try to change any values!!! Is this know bug or I'm crazy?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:t="http://myfaces.apache.org/tomahawk">

<ui:composition template="/layouts/mainlayout.xhtml">
<ui:define name="body">

<t:saveState value="#{serivceform}" id="saved_form"/>
<h:form>
     <h:panelGrid columns="1" width="200px" border="0" cellspacing="2" 
cellpadding="0">
         <t:messages layout="table" styleClass="beMessage" 
replaceIdWithLabel="true" showDetail="true" showSummary="false"/>
         <h:panelGrid id="edit" columns="2" width="100%" border="0"
             cellspacing="0" cellpadding="2"
             columnClasses="nbColumnRight, nbColumnLeft"
             >
             <h:outputLabel for="code" value="#{bundle['titles.code']}"/>
             <t:inputText id="code" value="#{serviceform.service.code}" 
maxlength="6" size="6" styleClass="input" required="true"/>

             <h:outputLabel for="name" 
value="#{bundle['titles.description']}"/>
             <t:inputText id="name" value="#{serviceform.service.name}" 
maxlength="64" styleClass="input" size="32" required="true"/>

             <h:outputLabel for="service_type" 
value="#{bundle['titles.type']}"/>
             <t:selectOneMenu id="service_type" 
value="#{serviceform.service.serviceType}" readonly="#{not 
serviceform.newService}" required="true">
                 <f:selectItems value="#{serviceform.serviceTypesList}"/>
                 <f:convertNumber/>
             </t:selectOneMenu>

             <h:outputLabel for="currency_id" 
value="#{bundle['titles.currency']}"/>
             <t:selectOneMenu id="currency_id" 
value="#{serviceform.service.currencyId}" required="true">
                 <f:selectItems value="#{currencyform.currenciesAbbrList}"/>
                 <f:convertNumber/>
             </t:selectOneMenu>
         </h:panelGrid>
         <h:panelGrid width="100%" columns="2" 
columnClasses="nbColumnLeft, nbColumnRight">
             <h:commandButton action="cancel@services" 
value="#{bundle['buttons.cancel']}" immediate="true" styleClass="button" />
             <h:commandButton action="#{serviceform.save}" 
value="#{bundle['buttons.save']}" styleClass="button" />
         </h:panelGrid>
     </h:panelGrid>
</h:form>
</ui:define>
</ui:composition>
</html>


public class Service implements java.io.Serializable {

     // public constants
     public static final int
             SERVICE_TYPE_INDIVIDIAL = 0,
             SERVICE_TYPE_PERIODIC = 1,
             SERVICE_TYPE_DIALUP = 2,
             SERVICE_TYPE_IPTRAFFIC = 3,
             SERVICE_TYPE_VOIP = 4;
     //
     private Integer id;
     private String  code;
     private String  name;
     private Integer serviceType;
     private Integer currencyId;

     public Service() {
     }

     public Service(Integer id, String code, String name, Integer 
serviceType, Integer currencyId) {
         this.id = id;
         this.code = code;
         this.name = name;
         this.serviceType = serviceType;
         this.currencyId = currencyId;
     }

     public Integer getId() {
         return id;
     }

     public void setId(Integer id) {
         this.id = id;
     }

     public String getCode() {
         return code;
     }

     public void setCode(String code) {
         this.code = code;
     }

     public String getName() {
         return name;
     }

     public void setName(String name) {
         this.name = name;
     }

     public Integer getServiceType() {
         return serviceType;
     }

     public void setServiceType(Integer serviceType) {
         this.serviceType = serviceType;
     }

     public Integer getCurrencyId() {
         return currencyId;
     }

     public void setCurrencyId(Integer currencyId) {
         this.currencyId = currencyId;
     }
}

With respect,
	Boris

Re: Am I crazy? (or converters problems)

Posted by Boris Kovalenko <bo...@tagnet.ru>.
Hello!

	I found the problem, that was my misunderstanding how t:saveState works...

Boris Kovalenko wrote:
> Hello!
> 
>     What's the mystic! Tried differed versions of MyFaces & Facelets... 
> same result... seemed like I'm really crazy and can't see something 
> significant. Help me please!
> 
> With respect,
>      Boris
> 
> 
With respect,
	Boris

Re: Am I crazy? (or converters problems)

Posted by Boris Kovalenko <bo...@tagnet.ru>.
Hello!

	What's the mystic! Tried differed versions of MyFaces & Facelets... 
same result... seemed like I'm really crazy and can't see something 
significant. Help me please!

With respect,
      Boris