RE: [Addendum]: Myfaces 1.2 upgrading

2007-07-20 Thread Cormier, Matthieu
Hello Matthias,

We are using facelets instead of jsp, and the following xhtml file does
reproduce it for me:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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;
xml:lang=#{view.locale.language} lang=#{view.locale.language} 
f:view
h:form
h:outputText value=#{beany.date}
f:convertDateTime type=both
dateStyle=#{beany.style}/
/h:outputText
/h:form
/f:view
/html

Matthieu 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Matthias Wessendorf
Sent: Thursday, July 19, 2007 3:48 PM
To: MyFaces Discussion
Subject: Re: [Addendum]: Myfaces 1.2 upgrading

Hi Matthieu,

regarding #2.
I can't reproduce it.

faces-config:
managed-bean
managed-bean-namebeany/managed-bean-name

managed-bean-classorg.apache.myfaces.blank.SessionBean/managed-bean-c
lass
managed-bean-scopesession/managed-bean-scope
managed-property
property-namestyle/property-name
valueshort/value
/managed-property 
/managed-bean

JSP-file:
%@ taglib uri=http://java.sun.com/jsf/html; prefix=h %
%@ taglib uri=http://java.sun.com/jsf/core; prefix=f%
f:view
h:form

h:outputText value=#{beany.date}
 f:convertDateTime   type=both dateStyle=#{beany.style} /
/h:outputText
/h:form
/f:view

Bean
package org.apache.myfaces.blank;

import java.util.Date;

public class SessionBean {

  private Date date = new Date();
  private String style;
  public Date getDate() {
return date;
  }
  public void setDate(Date date) {
this.date = date;
  }
  public String getStyle() {
System.out.println(getStyle called);
return style;
  }
  public void setStyle(String style) {
this.style = style;
  }

}

and the system.out is called, when I access the webpage

-Matthias
On 7/19/07, Cormier, Matthieu [EMAIL PROTECTED] wrote:




 Hello all,



 My original hypothesis for issue 2 was incorrect.  The issue is
actually
 caused from the tag

 f:convertDateTime  which we have embedded in an h:outputText.  We
use a
 bean to contain the configuration items for data display.  The invalid
style
 message is coming from this:



  f:convertDateTime type=both

 dateStyle=#{LocaleBean.dateStyle}

 ...



 The bean is of type session and I have verfified that the proper value
is
 set in the bean.

 ...

 managed-property

 property-namedateStyle/property-name

 valueshort/value

 /managed-property



 However the get method for the property is never called and the
exception
 stack trace below occurs.



 This code worked fine in 1.1 but no longer works in 1.2.



 Matthieu





 From: Cormier, Matthieu [mailto:[EMAIL PROTECTED]
  Sent: Thursday, July 19, 2007 9:55 AM
  To: MyFaces Discussion
  Subject: Myfaces 1.2 upgrading



 Hello all,



 I am attempting to upgrade our application to Myfaces 1.2 and have
come
 across 2 interesting issues.  Bot have workarounds but I was wondering
if
 they are bugs or not.



 1.  The names of facets for tomahawk tree2 must be hardcoded and
cannot come
 from a bean.



 So facet name=#{someBean.rootNodeType} will not work but

 facet name=root will.



 2.  Definition of a StyleClass can fail with the following exception:

 javax.faces.convert.ConverterException: invalid style ''

 at

javax.faces.convert.DateTimeConverter.calcStyle(DateTimeConverter.java:2
03)

 at

javax.faces.convert.DateTimeConverter.getDateFormat(DateTimeConverter.ja
va:166)

 at

javax.faces.convert.DateTimeConverter.getAsString(DateTimeConverter.java
:125)



 This was discovered because we use a conditional in our tree to define
 styles dependant on the selected node.

 styleClass=#{t.nodeSelected || node.container eq selectedContainer ?
 'selectedContainer' : '' }

 The workaround is to define the empty style to a style that is not
defined.

 styleClass=#{t.nodeSelected || node.container eq selectedContainer ?
 'selectedContainer' : 'nullStyle'}

 Are these bugs or spec changes from 1.1 to 1.2?

 --

 Matthieu Cormier

 Abridean Inc.

 T: 902-442-5122 x 5145

 F: 902-442-5101

 www.abridean.com

 This e-mail is intended solely for the person or entity to which it is
 addressed and may contain confidential and/or privileged information.
Any
 review, dissemination, copying, printing or other use of this e-mail
by
 persons or entities other than the addressee is prohibited. If you
have
 received this e-mail in error, please contact the sender immediately
and
 delete the material from any computer


-- 
Matthias Wessendorf

further stuff:
blog: http

Re: [Addendum]: Myfaces 1.2 upgrading

2007-07-19 Thread Matthias Wessendorf

Hi Matthieu,

regarding #2.
I can't reproduce it.

faces-config:
managed-bean
managed-bean-namebeany/managed-bean-name

managed-bean-classorg.apache.myfaces.blank.SessionBean/managed-bean-class
managed-bean-scopesession/managed-bean-scope
   managed-property
   property-namestyle/property-name
   valueshort/value
   /managed-property
/managed-bean

JSP-file:
%@ taglib uri=http://java.sun.com/jsf/html; prefix=h %
%@ taglib uri=http://java.sun.com/jsf/core; prefix=f%
f:view
h:form

h:outputText value=#{beany.date}
f:convertDateTime   type=both dateStyle=#{beany.style} /
/h:outputText
/h:form
/f:view

Bean
package org.apache.myfaces.blank;

import java.util.Date;

public class SessionBean {

 private Date date = new Date();
 private String style;
 public Date getDate() {
   return date;
 }
 public void setDate(Date date) {
   this.date = date;
 }
 public String getStyle() {
   System.out.println(getStyle called);
   return style;
 }
 public void setStyle(String style) {
   this.style = style;
 }

}

and the system.out is called, when I access the webpage

-Matthias
On 7/19/07, Cormier, Matthieu [EMAIL PROTECTED] wrote:





Hello all,



My original hypothesis for issue 2 was incorrect.  The issue is actually
caused from the tag

f:convertDateTime  which we have embedded in an h:outputText.  We use a
bean to contain the configuration items for data display.  The invalid style
message is coming from this:



 f:convertDateTime type=both

dateStyle=#{LocaleBean.dateStyle}

…



The bean is of type session and I have verfified that the proper value is
set in the bean.

…

managed-property

property-namedateStyle/property-name

valueshort/value

/managed-property



However the get method for the property is never called and the exception
stack trace below occurs.



This code worked fine in 1.1 but no longer works in 1.2.



Matthieu





From: Cormier, Matthieu [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 19, 2007 9:55 AM
 To: MyFaces Discussion
 Subject: Myfaces 1.2 upgrading



Hello all,



I am attempting to upgrade our application to Myfaces 1.2 and have come
across 2 interesting issues.  Bot have workarounds but I was wondering if
they are bugs or not.



1.  The names of facets for tomahawk tree2 must be hardcoded and cannot come
from a bean.



So facet name=#{someBean.rootNodeType} will not work but

facet name=root will.



2.  Definition of a StyleClass can fail with the following exception:

javax.faces.convert.ConverterException: invalid style ''

at
javax.faces.convert.DateTimeConverter.calcStyle(DateTimeConverter.java:203)

at
javax.faces.convert.DateTimeConverter.getDateFormat(DateTimeConverter.java:166)

at
javax.faces.convert.DateTimeConverter.getAsString(DateTimeConverter.java:125)



This was discovered because we use a conditional in our tree to define
styles dependant on the selected node.

styleClass=#{t.nodeSelected || node.container eq selectedContainer ?
'selectedContainer' : '' }

The workaround is to define the empty style to a style that is not defined.

styleClass=#{t.nodeSelected || node.container eq selectedContainer ?
'selectedContainer' : 'nullStyle'}

Are these bugs or spec changes from 1.1 to 1.2?

--

Matthieu Cormier

Abridean Inc.

T: 902-442-5122 x 5145

F: 902-442-5101

www.abridean.com

This e-mail is intended solely for the person or entity to which it is
addressed and may contain confidential and/or privileged information. Any
review, dissemination, copying, printing or other use of this e-mail by
persons or entities other than the addressee is prohibited. If you have
received this e-mail in error, please contact the sender immediately and
delete the material from any computer



--
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org