tomahawk t:saveState and HTTPSession

2012-03-08 Thread jacobpan

Hello,

I have added tomahawk t:saveState into my JSF code having page scope set as
request.

After adding tomahawk t:saveState I am getting error with HTTPSession 
like I am getting error with the following line

session = (HttpSession)context.getExternalContext().getSession(false);

What could be the reason for this?

Any help is highly appreciated.
-- 
View this message in context: 
http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465710.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.



Re: tomahawk t:saveState and HTTPSession

2012-03-08 Thread Anton Gavazuk
Hi Jacob,

can you show the exception and specify your environment details (version of
JSF, container...)

2012/3/8 jacobpan jacob.el...@gmail.com


 Hello,

 I have added tomahawk t:saveState into my JSF code having page scope set as
 request.

 After adding tomahawk t:saveState I am getting error with HTTPSession
 like I am getting error with the following line

 session = (HttpSession)context.getExternalContext().getSession(false);

 What could be the reason for this?

 Any help is highly appreciated.
 --
 View this message in context:
 http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465710.html
 Sent from the MyFaces - Users mailing list archive at Nabble.com.




MyFaces and CODI

2012-03-08 Thread José Luis Cetina
Hi im so excited to start and use MyFaces and CODI but i cant get any
good documentation in fact i only can get like 2 or 3 mini tutorial but
they are really incomplete, can somebody recommend me to some tutorial or
book to start with *CODI *y see this is an excellent extension, im moving
from mojarra and CDI to MyFaces and MyFaces extensions, please where i can
find value information

The only URL where i found a little info is this:
https://cwiki.apache.org/confluence/display/EXTCDI/Index

-- 
---
*SCJA. José Luis Cetina*
---


Re: MyFaces and CODI

2012-03-08 Thread Gerhard Petracek
hi jose,

first of all: welcome @ myfaces!

concrete questions are very welcome and we will improve the wiki based on
them.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/3/8 José Luis Cetina maxtorz...@gmail.com

 Hi im so excited to start and use MyFaces and CODI but i cant get any
 good documentation in fact i only can get like 2 or 3 mini tutorial but
 they are really incomplete, can somebody recommend me to some tutorial or
 book to start with *CODI *y see this is an excellent extension, im moving
 from mojarra and CDI to MyFaces and MyFaces extensions, please where i can
 find value information

 The only URL where i found a little info is this:
 https://cwiki.apache.org/confluence/display/EXTCDI/Index

 --
 ---
 *SCJA. José Luis Cetina*
 ---



Re: tomahawk t:saveState and HTTPSession

2012-03-08 Thread jacobpan

My JSF version 1.1 and I am running on Jdeveloper embedded OC4J 10.1.3
version.

Exception pasted below.

Caused by: java.lang.IllegalStateException
at
com.sun.faces.context.FacesContextImpl.assertNotReleased(FacesContextImpl.java:421)
at
com.sun.faces.context.FacesContextImpl.getExternalContext(FacesContextImpl.java:136)
at ManagedBean.getSelectItemsVehicleSuppliers(ManagedBean.java:828)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:99)

2012-03-08 19:02:59,556 ERROR
(com.sun.faces.lifecycle.ProcessValidationsPhase;103)
javax.faces.el.EvaluationException: Error getting property
'selectItemsVehicleSuppliers' from bean of type ManagedBean:
java.lang.IllegalStateException
javax.faces.el.EvaluationException: javax.faces.el.EvaluationException:
Error getting property 'selectItemsSuppliers' from bean of type ManagedBean:
java.lang.IllegalStateException
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:190)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:143)
at javax.faces.component.UISelectItems.getValue(UISelectItems.java:110)
at
javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:116)


-- 
View this message in context: 
http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465970.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.



Re: tomahawk t:saveState and HTTPSession

2012-03-08 Thread Anton Gavazuk
So you are using JSF RI 1.1 - can you verify that your tomahawk library is
compatible with JSF RI 1.1? Can you also verify that you have configured
all extensions in right way in web.xml? Also why do you call external
context in the  getSelectItemsVehicleSuppliers ?

2012/3/8 jacobpan jacob.el...@gmail.com


 My JSF version 1.1 and I am running on Jdeveloper embedded OC4J 10.1.3
 version.

 Exception pasted below.

 Caused by: java.lang.IllegalStateException
at

 com.sun.faces.context.FacesContextImpl.assertNotReleased(FacesContextImpl.java:421)
at

 com.sun.faces.context.FacesContextImpl.getExternalContext(FacesContextImpl.java:136)
at ManagedBean.getSelectItemsVehicleSuppliers(ManagedBean.java:828)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at

 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at

 com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:99)

 2012-03-08 19:02:59,556 ERROR
 (com.sun.faces.lifecycle.ProcessValidationsPhase;103)
 javax.faces.el.EvaluationException: Error getting property
 'selectItemsVehicleSuppliers' from bean of type ManagedBean:
 java.lang.IllegalStateException
 javax.faces.el.EvaluationException: javax.faces.el.EvaluationException:
 Error getting property 'selectItemsSuppliers' from bean of type
 ManagedBean:
 java.lang.IllegalStateException
at
 com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:190)
at
 com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:143)
at
 javax.faces.component.UISelectItems.getValue(UISelectItems.java:110)
at

 javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:116)


 --
 View this message in context:
 http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33465970.html
 Sent from the MyFaces - Users mailing list archive at Nabble.com.




Re: tomahawk t:saveState and HTTPSession

2012-03-08 Thread jacobpan

External content is used to make the session available like the following:
 session = (HttpSession)context.getExternalContext().getSession(false);

I have added all extensions in web.xml, copied from myfaces site. My web.xml
is pasted below.
My Tomahawk version is tomahawk-1.1.11 I guess it is compatible with JSF
1.1, correct me if I am wrong.

Web.xml

?xml version = '1.0' encoding = 'windows-1252'?
web-app 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
xmlns=http://java.sun.com/xml/ns/j2ee;
descriptionEmpty web.xml file for Web Application/description
filter  
filter-nameextensionsFilter/filter-name  
filter-class
org.apache.myfaces.component.html.util.ExtensionsFilter/filter-class  
init-param  
descriptionSet the size limit for uploaded files. Format: 10 -
10 bytes 10k - 10  
KB 10m - 10 MB 1g - 1 GB  
/description  
param-nameuploadMaxFileSize/param-name  
param-value100m/param-value  
/init-param  
init-param   
descriptionSet the threshold size - files below this limit are
stored in  
memory, files above this limit are stored on disk. Format:
10 - 10 bytes 10k -  
10 KB 10m - 10 MB 1g - 1 GB  
/description  
param-nameuploadThresholdSize/param-name  
param-value100k/param-value  
/init-param  
/filter   
filter-mapping  
filter-nameextensionsFilter/filter-name  
url-pattern*.jsf/url-pattern  
/filter-mapping   
filter-mapping  
filter-nameextensionsFilter/filter-name  
url-pattern/faces/*/url-pattern  
/filter-mapping   
filter-mapping  
filter-nameextensionsFilter/filter-name  
url-pattern/faces/myFacesExtensionResource/*/url-pattern  
/filter-mapping  
context-param
param-nameorg.apache.myfaces.redirectTracker.POLICY/param-name
   
param-valueorg.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy/param-value
/context-param
servlet
servlet-nameFaces Servlet/servlet-name
servlet-classjavax.faces.webapp.FacesServlet/servlet-class
load-on-startup1/load-on-startup
/servlet
servlet
servlet-nameLogin/servlet-name
servlet-classvms_proj.Login/servlet-class
/servlet
servlet-mapping
servlet-nameFaces Servlet/servlet-name
url-pattern/faces/*/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameLogin/servlet-name
url-pattern/login/url-pattern
/servlet-mapping
session-config
session-timeout35/session-timeout
/session-config
mime-mapping
extensionhtml/extension
mime-typetext/html/mime-type
/mime-mapping
mime-mapping
extensiontxt/extension
mime-typetext/plain/mime-type
/mime-mapping
welcome-file-list
welcome-fileindex.html/welcome-file
/welcome-file-list
jsp-config/
/web-app


-- 
View this message in context: 
http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33466274.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.



Re: tomahawk t:saveState and HTTPSession

2012-03-08 Thread Anton Gavazuk
Hi Jacob,

I dont know if tomahawk is compatible with your version, even more - I dont
know if this combination works fine in OC4J container which you are using -
its something that you need to verify.

Why do you need to get access to session in getter method? what are you
looking for in session and what makes you think that saveState component is
root cause of the issue?

Thanks,
Anton

2012/3/8 jacobpan jacob.el...@gmail.com


 External content is used to make the session available like the following:
  session = (HttpSession)context.getExternalContext().getSession(false);

 I have added all extensions in web.xml, copied from myfaces site. My
 web.xml
 is pasted below.
 My Tomahawk version is tomahawk-1.1.11 I guess it is compatible with JSF
 1.1, correct me if I am wrong.

 Web.xml

 ?xml version = '1.0' encoding = 'windows-1252'?
 web-app 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
 xmlns=http://java.sun.com/xml/ns/j2ee;
descriptionEmpty web.xml file for Web Application/description
filter
filter-nameextensionsFilter/filter-name
filter-class
 org.apache.myfaces.component.html.util.ExtensionsFilter/filter-class
init-param
descriptionSet the size limit for uploaded files. Format: 10 -
 10 bytes 10k - 10
KB 10m - 10 MB 1g - 1 GB
/description
param-nameuploadMaxFileSize/param-name
param-value100m/param-value
/init-param
init-param
descriptionSet the threshold size - files below this limit are
 stored in
memory, files above this limit are stored on disk. Format:
 10 - 10 bytes 10k -
10 KB 10m - 10 MB 1g - 1 GB
/description
param-nameuploadThresholdSize/param-name
param-value100k/param-value
/init-param
/filter
filter-mapping
filter-nameextensionsFilter/filter-name
url-pattern*.jsf/url-pattern
/filter-mapping
filter-mapping
filter-nameextensionsFilter/filter-name
url-pattern/faces/*/url-pattern
/filter-mapping
filter-mapping
filter-nameextensionsFilter/filter-name
url-pattern/faces/myFacesExtensionResource/*/url-pattern
/filter-mapping
context-param
param-nameorg.apache.myfaces.redirectTracker.POLICY/param-name


 param-valueorg.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy/param-value
/context-param
servlet
servlet-nameFaces Servlet/servlet-name
servlet-classjavax.faces.webapp.FacesServlet/servlet-class
load-on-startup1/load-on-startup
/servlet
servlet
servlet-nameLogin/servlet-name
servlet-classvms_proj.Login/servlet-class
/servlet
servlet-mapping
servlet-nameFaces Servlet/servlet-name
url-pattern/faces/*/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameLogin/servlet-name
url-pattern/login/url-pattern
/servlet-mapping
session-config
session-timeout35/session-timeout
/session-config
mime-mapping
extensionhtml/extension
mime-typetext/html/mime-type
/mime-mapping
mime-mapping
extensiontxt/extension
mime-typetext/plain/mime-type
/mime-mapping
welcome-file-list
welcome-fileindex.html/welcome-file
/welcome-file-list
jsp-config/
 /web-app


 --
 View this message in context:
 http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33466274.html
 Sent from the MyFaces - Users mailing list archive at Nabble.com.




Re: tomahawk t:saveState and HTTPSession

2012-03-08 Thread Leonardo Uribe
Hi

The report doesn't sounds like something related to tomahawk t:saveState.
Are you invalidating the session (logout or something like that)? If the session
is invalidated and then it is manipulated, an IllegalStateException
could happen.
In that case, a redirect could solve the problem.

regards,

Leonardo Uribe

2012/3/8 Anton Gavazuk antongava...@gmail.com:
 Hi Jacob,

 I dont know if tomahawk is compatible with your version, even more - I dont
 know if this combination works fine in OC4J container which you are using -
 its something that you need to verify.

 Why do you need to get access to session in getter method? what are you
 looking for in session and what makes you think that saveState component is
 root cause of the issue?

 Thanks,
 Anton

 2012/3/8 jacobpan jacob.el...@gmail.com


 External content is used to make the session available like the following:
  session = (HttpSession)context.getExternalContext().getSession(false);

 I have added all extensions in web.xml, copied from myfaces site. My
 web.xml
 is pasted below.
 My Tomahawk version is tomahawk-1.1.11 I guess it is compatible with JSF
 1.1, correct me if I am wrong.

 Web.xml

 ?xml version = '1.0' encoding = 'windows-1252'?
 web-app 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
 xmlns=http://java.sun.com/xml/ns/j2ee;
    descriptionEmpty web.xml file for Web Application/description
    filter
        filter-nameextensionsFilter/filter-name
        filter-class
 org.apache.myfaces.component.html.util.ExtensionsFilter/filter-class
        init-param
            descriptionSet the size limit for uploaded files. Format: 10 -
 10 bytes 10k - 10
                KB 10m - 10 MB 1g - 1 GB
            /description
            param-nameuploadMaxFileSize/param-name
            param-value100m/param-value
        /init-param
        init-param
            descriptionSet the threshold size - files below this limit are
 stored in
                memory, files above this limit are stored on disk. Format:
 10 - 10 bytes 10k -
                10 KB 10m - 10 MB 1g - 1 GB
            /description
            param-nameuploadThresholdSize/param-name
            param-value100k/param-value
        /init-param
    /filter
    filter-mapping
        filter-nameextensionsFilter/filter-name
        url-pattern*.jsf/url-pattern
    /filter-mapping
    filter-mapping
        filter-nameextensionsFilter/filter-name
        url-pattern/faces/*/url-pattern
    /filter-mapping
    filter-mapping
            filter-nameextensionsFilter/filter-name
            url-pattern/faces/myFacesExtensionResource/*/url-pattern
    /filter-mapping
    context-param
        param-nameorg.apache.myfaces.redirectTracker.POLICY/param-name


 param-valueorg.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy/param-value
    /context-param
    servlet
        servlet-nameFaces Servlet/servlet-name
        servlet-classjavax.faces.webapp.FacesServlet/servlet-class
        load-on-startup1/load-on-startup
    /servlet
    servlet
        servlet-nameLogin/servlet-name
        servlet-classvms_proj.Login/servlet-class
    /servlet
    servlet-mapping
        servlet-nameFaces Servlet/servlet-name
        url-pattern/faces/*/url-pattern
    /servlet-mapping
    servlet-mapping
        servlet-nameLogin/servlet-name
        url-pattern/login/url-pattern
    /servlet-mapping
    session-config
        session-timeout35/session-timeout
    /session-config
    mime-mapping
        extensionhtml/extension
        mime-typetext/html/mime-type
    /mime-mapping
    mime-mapping
        extensiontxt/extension
        mime-typetext/plain/mime-type
    /mime-mapping
    welcome-file-list
        welcome-fileindex.html/welcome-file
    /welcome-file-list
    jsp-config/
 /web-app


 --
 View this message in context:
 http://old.nabble.com/tomahawk-t%3AsaveState-and-HTTPSession-tp33465710p33466274.html
 Sent from the MyFaces - Users mailing list archive at Nabble.com.




Re: ExtVal BV question

2012-03-08 Thread Gerald Turner
Gerhard Petracek gerhard.petra...@gmail.com writes:
 please also describe the use-case for this feature.

I guess my Widget with option1 and option2 fields wasn't a very good
example.

I could conjure up a typical password + passwordVerify validation combo,
but that wouldn't be realistic for JPA (persistent Registration
entity?).

I'll give another example of a table I'm working with that functions
like a generic Map of name-value pairs.

There is an enum called Feature:

  enum Feature { Recording, MediaPreTransfer, MediaNoTransfer, ... }

There is a table called FeatureConfig that maps Features to String
values:

  @Entity
  @FeatureConfigValid
  class FeatureConfig {

@Column
@Enumerated
@NotNull
Feature feature;

@Column
@NotEmpty
String value;

  }

There is a JSF for creating or modifying FeatureConfig, the page
contains two components, a h:selectOneMenu for the 'feature' property
and a h:inputText for the 'value' property.  Both components have a
h:message, and the entire form has a h:messages with globalOnly=true.

  h:form
h:messages globalOnly=true/

h:selectOneMenu id=feature value=#{edit.config.feature}
  f:selectItems value=#{constants.features}/
/h:selectOneMenu
h:message for=feature/

h:inputText id=value value=#{edit.config.value}/
h:message for=value/

h:commandButton value=Submit actionListener=#{edit.save}/
  /h:form

The behavior should be that the message component for feature should
trigger if feature is not selected (@NotNull), and message should
trigger for value if value is empty (@NotEmpty), and furthermore message
for value should trigger for the following conditions:

  • Selected Feature is Recording, and Value is not an integer between 0
and 100.

  • Selected Feature is one of the Media* types, and Value is not a URL.

I would like a JSR303 multi-field ConstraintValidator called
FeatureConfigValid that has something like the following isValid
implementation:

  public boolean isValid(FeatureConfig config,
 ConstraintValidatorContext ctx) {
boolean valid = true;
String value = config.getConfig();
switch (config.getFeature()) {
  case Recording:
if (!isNumeric(value, 0, 100)) {
  ctx.disableDefaultConstraintViolation();
  ctx.buildConstraintViolationWithTemplate({must_be_numeric})
 .setNode(value)
 .addConstraintViolation();
  valid = false;
}
break;

  case MediaPreTransfer:
  case MediaNoTransfer:
if (!isURL(value)) {
  ctx.disableDefaultConstraintViolation();
  ctx.buildConstraintViolationWithTemplate({must_be_url})
 .setNode(value)
 .addConstraintViolation();
  valid = false;
}
break;
}
return valid;
  }

The behavior is that instead h:message for 'value' being triggered (via
ConstraintViolation propertPath linkage), the global h:messages is being
triggered.  Not too bad for this small example, but image a page full of
dozens of fields and more cross-field validations, it would put more
strain on the user to decipher the global messages and hunt down the
related fields (that aren't decorated as being invalid whatsoever).

-- 
Gerald Turner   Email: gtur...@unzane.com   JID: gtur...@unzane.com
GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5


pgpCpH67hrm1Y.pgp
Description: PGP signature


Re: ExtVal BV question

2012-03-08 Thread Gerald Turner
Rudy De Busscher rdebussc...@gmail.com writes:
 first, welcome to the mailing list.

Thanks!

 a) about the multifield ConstraintValidator.
 You see the messages twice since you set 2 ConstraintViolation on the
 context.  And to my knowledge there is no link between the
 propertyPath and the component the message is intended to.  Not in the
 JSR303 and thus not in the ExtVal support for it.  Can you please
 point us to the info (spec) if we are wrong.

In JSR303 § 4.2 ConstraintViolation, there is the following note:

  “From rootBean and propertyPath, it is possible to rebuild the
   context of the failure”

The chapter continues with several examples of these Node/Path objects.

Unfortunately the specification doesn't make any further statements
about how JSF or any other toolkits *should* infer what components are
in violation, but the spec is framework agnostic afterall…

 b) Validation in 2 phases
 This is due to the fact that you need all the field values in the
 model before you can do any multifield validation.

 Within the Process Validation phase, the JSF validations on a single
 field takes place (required, within limits, etc ...). ExtVal then also
 processes the BeanValidation annotations which are placed on the
 field/method like @Size, @NotNull etc ...

 But the multi field validation can't be performed at that moment
 because it requires that the screen values are propagated to the
 managedBean.  This is because the ConstraintValidator needs the object
 populated with the values to do his checks.  This means it can be only
 done after the 'update model values' phase and thus only performed
 when no problems are found yet.

 Hopes this clarifies the things a bit.

Yes this makes sense, I just wanted to clarify I wasn't doing something
wrong, missing configuration, etc.  I think it is acceptible for the
user interface that the more complex validations happen in a second
pass.

-- 
Gerald Turner   Email: gtur...@unzane.com   JID: gtur...@unzane.com
GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5


pgpYmsFmSqDik.pgp
Description: PGP signature


Re: ExtVal BV question

2012-03-08 Thread Gerhard Petracek
hi gerald,

we could refactor [1] to support it. this add-on also performs the whole
validation in the validation-phase (similar to the cross-validation
module of extval itself).

regards,
gerhard

[1]
http://os890.blogspot.com/2010/06/multi-field-form-validation-with-jsr.html

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/3/8 Gerald Turner gtur...@unzane.com

 Gerhard Petracek gerhard.petra...@gmail.com writes:
  please also describe the use-case for this feature.

 I guess my Widget with option1 and option2 fields wasn't a very good
 example.

 I could conjure up a typical password + passwordVerify validation combo,
 but that wouldn't be realistic for JPA (persistent Registration
 entity?).

 I'll give another example of a table I'm working with that functions
 like a generic Map of name-value pairs.

 There is an enum called Feature:

  enum Feature { Recording, MediaPreTransfer, MediaNoTransfer, ... }

 There is a table called FeatureConfig that maps Features to String
 values:

  @Entity
  @FeatureConfigValid
  class FeatureConfig {

@Column
@Enumerated
@NotNull
Feature feature;

@Column
@NotEmpty
String value;

  }

 There is a JSF for creating or modifying FeatureConfig, the page
 contains two components, a h:selectOneMenu for the 'feature' property
 and a h:inputText for the 'value' property.  Both components have a
 h:message, and the entire form has a h:messages with globalOnly=true.

  h:form
h:messages globalOnly=true/

 h:selectOneMenu id=feature value=#{edit.config.feature}
  f:selectItems value=#{constants.features}/
/h:selectOneMenu
h:message for=feature/

h:inputText id=value value=#{edit.config.value}/
h:message for=value/

h:commandButton value=Submit actionListener=#{edit.save}/
  /h:form

 The behavior should be that the message component for feature should
 trigger if feature is not selected (@NotNull), and message should
 trigger for value if value is empty (@NotEmpty), and furthermore message
 for value should trigger for the following conditions:

  • Selected Feature is Recording, and Value is not an integer between 0
and 100.

  • Selected Feature is one of the Media* types, and Value is not a URL.

 I would like a JSR303 multi-field ConstraintValidator called
 FeatureConfigValid that has something like the following isValid
 implementation:

  public boolean isValid(FeatureConfig config,
 ConstraintValidatorContext ctx) {
boolean valid = true;
String value = config.getConfig();
switch (config.getFeature()) {
  case Recording:
if (!isNumeric(value, 0, 100)) {
  ctx.disableDefaultConstraintViolation();
  ctx.buildConstraintViolationWithTemplate({must_be_numeric})
 .setNode(value)
 .addConstraintViolation();
  valid = false;
}
break;

  case MediaPreTransfer:
  case MediaNoTransfer:
if (!isURL(value)) {
  ctx.disableDefaultConstraintViolation();
  ctx.buildConstraintViolationWithTemplate({must_be_url})
 .setNode(value)
 .addConstraintViolation();
  valid = false;
}
break;
}
return valid;
  }

 The behavior is that instead h:message for 'value' being triggered (via
 ConstraintViolation propertPath linkage), the global h:messages is being
 triggered.  Not too bad for this small example, but image a page full of
 dozens of fields and more cross-field validations, it would put more
 strain on the user to decipher the global messages and hunt down the
 related fields (that aren't decorated as being invalid whatsoever).

 --
 Gerald Turner   Email: gtur...@unzane.com   JID: gtur...@unzane.com
 GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5



Re: ExtVal BV question

2012-03-08 Thread Gerald Turner
Gerhard Petracek gerhard.petra...@gmail.com writes:
 we could refactor [1] to support it. this add-on also performs the whole
 validation in the validation-phase (similar to the cross-validation
 module of extval itself).

I'm confused.  What does this add-on do that isn't builtin to bean-val?

Sorry but my exposure to ExtVal and MyFaces for that matter is very
limited.

The other day I ran across a stackoverflow¹ question that succinctly
asks the same thing I am looking for.  Somebody commented that ExtVal
handles this use-case.

Trying to figure out how to activate ModelValidation wasn't very easy,
until I found the slides² you wrote, I don't know German³, page 32 with
“@BeanValidation(modelValidation = @ModelValidation(isActive = true))”
was the big AHA! moment and ExtVal-BV was working :)  However back to
the stackoverflow question: it doesn't seem to take advantage of the
ConstraintViolation propertyPath.

¹ http://stackoverflow.com/questions/5639088
² http://www.slideshare.net/os890/metadatenbasierte-validierung
³ Life-goal: learn German; Then I can geek out on many terabytes of
  ccc.de lectures I'm missing out on!

-- 
Gerald Turner   Email: gtur...@unzane.com   JID: gtur...@unzane.com
GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5


pgpScmUYAA5GH.pgp
Description: PGP signature


Re: ExtVal BV question

2012-03-08 Thread Gerhard Petracek
hi gerald,

the comment on stackoverflow might be about the property-validation module
which supports cross-validation (without bv).
you can get further details e.g. at the extval-chapter [1].
or they wrote a custom extval add-on (maybe based on my add-on).

in the bv-module of extval we could forward the needed information to the
model-validation, but the possible support can get complicated (for users).
(e.g. because you can have errors which can't be mapped back to a
component.)

regards,
gerhard

[1] http://s.apache.org/EXTVAL_Chapter

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


2012/3/8 Gerald Turner gtur...@unzane.com

 Gerhard Petracek gerhard.petra...@gmail.com writes:
  we could refactor [1] to support it. this add-on also performs the whole
  validation in the validation-phase (similar to the cross-validation
  module of extval itself).

 I'm confused.  What does this add-on do that isn't builtin to bean-val?

 Sorry but my exposure to ExtVal and MyFaces for that matter is very
 limited.

 The other day I ran across a stackoverflow¹ question that succinctly
 asks the same thing I am looking for.  Somebody commented that ExtVal
 handles this use-case.

 Trying to figure out how to activate ModelValidation wasn't very easy,
 until I found the slides² you wrote, I don't know German³, page 32 with
 “@BeanValidation(modelValidation = @ModelValidation(isActive = true))”
 was the big AHA! moment and ExtVal-BV was working :)  However back to
 the stackoverflow question: it doesn't seem to take advantage of the
 ConstraintViolation propertyPath.

 ¹ http://stackoverflow.com/questions/5639088
 ² http://www.slideshare.net/os890/metadatenbasierte-validierung
 ³ Life-goal: learn German; Then I can geek out on many terabytes of
  ccc.de lectures I'm missing out on!

 --
 Gerald Turner   Email: gtur...@unzane.com   JID: gtur...@unzane.com
 GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5



Re: MyFaces and CODI

2012-03-08 Thread Stephen More
I too am trying to get a simple example working. I have put together
this project: http://maven-examples.googlecode.com/svn/trunk/jsf-codi/

mvn jetty:run-war   results in

SEVERE: Unable to create JettyWeldInjector. CDI injection will not be
available in Servlets, Filters or Listeners

What else do I need to get this simple example working ?

-Thanks

On Thu, Mar 8, 2012 at 11:07 AM, Gerhard Petracek
gerhard.petra...@gmail.com wrote:
 hi jose,

 first of all: welcome @ myfaces!

 concrete questions are very welcome and we will improve the wiki based on
 them.

 regards,
 gerhard

 http://www.irian.at

 Your JSF/JavaEE powerhouse -
 JavaEE Consulting, Development and
 Courses in English and German

 Professional Support for Apache MyFaces



 2012/3/8 José Luis Cetina maxtorz...@gmail.com

 Hi im so excited to start and use MyFaces and CODI but i cant get any
 good documentation in fact i only can get like 2 or 3 mini tutorial but
 they are really incomplete, can somebody recommend me to some tutorial or
 book to start with *CODI *y see this is an excellent extension, im moving
 from mojarra and CDI to MyFaces and MyFaces extensions, please where i can
 find value information

 The only URL where i found a little info is this:
 https://cwiki.apache.org/confluence/display/EXTCDI/Index

 --
 ---
 *SCJA. José Luis Cetina*
 ---