Re: Hibernate: 1-to-many -- struggling

2005-09-15 Thread Werner Punz

Duncan Krebs wrote:

Hey,
Here are my two cents. The biggest obstacle with Hibernate is figuring out
how to correctly map the stupid collections and relationships that are
modeled in your object model. I did not take the time to look at all your
code but maybe this will help you out:


The mapping is one obstacle, the other one is dealing correctly
with the dreaded m:n relations, there is a huge lack of good
documentation in this area, I hope the next release
of Hibernate in action will resolve that...

Hibernate is not a toy but it is harder to grasp in some areas than a 
straight database approach via jdbc.
I am just wondering all the time when I am banging my head again for 
hours against some weirdness which was caused mostly by a mistake of 
mine, due to lack of understanding / documentation in a certain area, if 
there cannot be a sane middleground somewhere.



now it is getting really off topic ;-)



Is there anybody out there?

2005-09-15 Thread Enrique Medina
Hi,

Could you please vote this JIRA issue, so it can be given some priority? It has not even been assigned to anyone :-(

http://issues.apache.org/jira/browse/MYFACES-522

Thanks.


RE: Form data passing problem

2005-09-15 Thread Matthias Klein
Thanks. It works now.
Matt 

-Original Message-
From: Volker Weber [mailto:[EMAIL PROTECTED] 
Sent: Mittwoch, 14. September 2005 14:47
To: MyFaces Discussion
Subject: Re: Form data passing problem

Hi,

you must remove the immediate=true form your submit button!

this skips the updatemodel phase.

Matthias Klein wrote:
 I have written a simple JSF-page which contains only one single inputText:
 
 %@ taglib uri=http://java.sun.com/jsf/html; prefix=h % %@ taglib 
 uri=http://java.sun.com/jsf/core; prefix=f %
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
   
 f:view
   f:loadBundle
 basename=ca.gc.nrc.iit.toml.frontend.bundles.RateCourse
 var=MessageBundle/
   html
   head
   link href=css/stylesheet.css rel=stylesheet
 type=text/css/
   title
   h:outputText
 value=#{MessageBundle.dialogtitle} /
   /title
   /head
 
   body
   h:form id=RateCourseForm
   h:panelGrid id=grid columns=4
   h:outputText
 value=#{MessageBundle.dialogtitle} /
   h:inputText id=test
 value=#{RateCourseBackingBean.evaluation} required=true /
 
   h:commandButton id=submit
 action=#{RateCourseBackingBean.submit}
 value=#{MessageBundle.submitbuttonlabel} immediate=true /
   h:commandButton id=cancel
 action=#{RateCourseBackingBean.cancel}
 value=#{MessageBundle.cancelbuttonlabel} immediate=true /
   /h:panelGrid
   /h:form
   /body
   /html
 /f:view
 
 
 The Backing Bean looks like
 
 package ca.gc.nrc.iit.toml.frontend;
 
 //import javax.faces.model.*;
 
 public class RateCourseBackingBean {
   
   private String evaluation = test;
 
   public String submit() {
   System.out.println(this.evaluation);
   return submit;
   }
   
   public String cancel() {
   return cancel;
   }
 
   public String getEvaluation() {
   return evaluation;
   }
 
   public void setEvaluation(String evaluation) {
   this.evaluation = evaluation;
   }
 }
 
 It works so far but the System.out.println() in submit() only ever 
 prints test on the console.
 
 And I don't know why.
 
 Did I make a mistake in the nesting of the tags of the JSF-page?
 (What is the official nesting of elements? The JSF-Spec does not seem 
 to state what an empty JSF-page should look like and how the elements 
 are to be
 nested.)
 
 Do you have any idea where that mistake is?
 
 Thanks
 
 Matt
 

--
-
Volker WeberDietrichsweg 38a 26127 Oldenburg Germany
MAILTO:[EMAIL PROTECTED]   HTTP://www.weber-oldenburg.de




Re: Providing bugfix: Firefox body onload= tag - Re: x:inputCalendar - popup hidden by other elements

2005-09-15 Thread Bruno Aranda
Thanks Paul, but could you please open a JIRA issue with the problem
and upload the patch there? Then this will be tested :-) We have to
keep the bugs under control...

Regards,

Bruno

2005/9/15, Paul Klaer [EMAIL PROTECTED]:
 Hi,
 
 this is definitly a bug. So, here I provide the solution. Can someone
 test and commit the files please?
 
 I saw the mail in the dev list from Zhong Li:
 ---
 I found how it happened. I have onload on body tag, even with simplest
 one, something like, body onload=alert('loading');
 ...
 Then the inputCalendar doesn't work, can't popup. so weired. 
 ---
 
 Since he had the same problem I checked the JavaScript behaviour in
 Firefox and debugged a little bit...
 
 This problem occures because the old JavaScript is executed in Firefox
 before the body tag onload is set during the render phase.
 So this variable var jscalendarOnloadBackup = window.onload; is only
 set to undefined and never with the old onload script.
 
 To solve this problem I rewrote the load script as a function in the
 popcalendar.js and this function is then called just before
 jscalendarSetImageDirectory is called inside the enclosing body
 element. At this time the onload tag of the body element is set.
 
 You can test this if you change the body element to body
 onload=alert('test body onload'); of the simple/calendar.jsp example..
 
 Regards,
 
 Paul
 
 
 Paul Klaer wrote:
  Thank you for your tipps and sorry for my late answer. I had much to do
  and wanted to check the code before I write something back.
  In the meantime we got a new CSS file and the calendar popups are
  working fine in IE after resetting some div...
 
  The examples out of the myfaces repository are working on both: Firefox
  and IE. There I had no problem with the js script.
 
  I think we have to be careful using css...
 
  But, I have now a problem with Firefox popups to display them and this
  is because we use the onload tag and some own javascript init
  functions for the page.
  Now I checked the popcalendar.js code and the function
  jscalendarInit() is only called if there is no window.onload (onload
  tag) in the browser specified if no IE is used. This is why the variable
  jscalendarBPageLoaded still remains with the default value false and
  Firefox never executes this:
 
  -
  function jscalendarPopUpCalendar(ctl, ctl2, format){
  if (jscalendarBPageLoaded){
  
  -
 
  Is this right that I can't use the onload tag using Firefox?
 
 
  Martin Marinschek wrote:
 
  this occurs with IE only, right?
 
  it's a known bug of the IE - you would need to go through the elements
  of the form and render them invisible while displaying the
  inputCalendar.
 
  If you prepare a patch for the javaScript of inputCalendar which works
  in IE and Firefox we would happily apply it!
 
  regards,
 
  Martin
 
  On 9/9/05, Paul Klaer [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I have a problem using the inputCalendar component. The popup window is
  shown correctly and works fine but if there are some buttons on my form
  the popup window is hidden by the buttons. The popup just appears in the
  background.
  How can I solve this problem? Using css and the z-index for the buttons
  option doesn't solve the problem. How can I set the calendar popup
  component to the foreground?
  Is it a bug of the inputCalendar component?
 
  Paul
 
 
 
 
 
 
 
 
 /*
  * Copyright 2004 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.apache.myfaces.custom.calendar;
 
 import org.apache.myfaces.component.html.ext.HtmlInputText;
 import org.apache.myfaces.component.html.util.AddResource;
 import org.apache.myfaces.renderkit.JSFAttr;
 import org.apache.myfaces.renderkit.RendererUtils;
 import org.apache.myfaces.renderkit.html.HTML;
 import org.apache.myfaces.renderkit.html.HtmlRenderer;
 import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
 import org.apache.myfaces.renderkit.html.util.JavascriptUtils;
 
 import javax.faces.application.Application;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
 import javax.faces.component.UIParameter;
 import javax.faces.component.html.HtmlCommandLink;
 import javax.faces.component.html.HtmlOutputText;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 

Re: Providing bugfix: Firefox body onload= tag - Re: x:inputCalendar - popup hidden by other elements

2005-09-15 Thread Paul Klaer

Done. :-)

http://issues.apache.org/jira/browse/MYFACES-569

Bruno Aranda wrote:

Thanks Paul, but could you please open a JIRA issue with the problem
and upload the patch there? Then this will be tested :-) We have to
keep the bugs under control...

Regards,

Bruno

2005/9/15, Paul Klaer [EMAIL PROTECTED]:


Hi,

this is definitly a bug. So, here I provide the solution. Can someone
test and commit the files please?

I saw the mail in the dev list from Zhong Li:
---
I found how it happened. I have onload on body tag, even with simplest
one, something like, body onload=alert('loading');
...
Then the inputCalendar doesn't work, can't popup. so weired. 
---

Since he had the same problem I checked the JavaScript behaviour in
Firefox and debugged a little bit...

This problem occures because the old JavaScript is executed in Firefox
before the body tag onload is set during the render phase.
So this variable var jscalendarOnloadBackup = window.onload; is only
set to undefined and never with the old onload script.

To solve this problem I rewrote the load script as a function in the
popcalendar.js and this function is then called just before
jscalendarSetImageDirectory is called inside the enclosing body
element. At this time the onload tag of the body element is set.

You can test this if you change the body element to body
onload=alert('test body onload'); of the simple/calendar.jsp example..

Regards,

Paul


Paul Klaer wrote:


Thank you for your tipps and sorry for my late answer. I had much to do
and wanted to check the code before I write something back.
In the meantime we got a new CSS file and the calendar popups are
working fine in IE after resetting some div...

The examples out of the myfaces repository are working on both: Firefox
and IE. There I had no problem with the js script.

I think we have to be careful using css...

But, I have now a problem with Firefox popups to display them and this
is because we use the onload tag and some own javascript init
functions for the page.
Now I checked the popcalendar.js code and the function
jscalendarInit() is only called if there is no window.onload (onload
tag) in the browser specified if no IE is used. This is why the variable
jscalendarBPageLoaded still remains with the default value false and
Firefox never executes this:

-
function jscalendarPopUpCalendar(ctl, ctl2, format){
   if (jscalendarBPageLoaded){
   
-

Is this right that I can't use the onload tag using Firefox?


Martin Marinschek wrote:



this occurs with IE only, right?

it's a known bug of the IE - you would need to go through the elements
of the form and render them invisible while displaying the
inputCalendar.

If you prepare a patch for the javaScript of inputCalendar which works
in IE and Firefox we would happily apply it!

regards,

Martin

On 9/9/05, Paul Klaer [EMAIL PROTECTED] wrote:



Hi,

I have a problem using the inputCalendar component. The popup window is
shown correctly and works fine but if there are some buttons on my form
the popup window is hidden by the buttons. The popup just appears in the
background.
How can I solve this problem? Using css and the z-index for the buttons
option doesn't solve the problem. How can I set the calendar popup
component to the foreground?
Is it a bug of the inputCalendar component?

Paul








/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.myfaces.custom.calendar;

import org.apache.myfaces.component.html.ext.HtmlInputText;
import org.apache.myfaces.component.html.util.AddResource;
import org.apache.myfaces.renderkit.JSFAttr;
import org.apache.myfaces.renderkit.RendererUtils;
import org.apache.myfaces.renderkit.html.HTML;
import org.apache.myfaces.renderkit.html.HtmlRenderer;
import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
import org.apache.myfaces.renderkit.html.util.JavascriptUtils;

import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UIParameter;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import java.io.IOException;
import java.text.DateFormat;
import java.text.DateFormatSymbols;
import 

Custom Component

2005-09-15 Thread Goyo Escobar Escalero

I've a problem extendign the UISelectOne component...

My classes:

package holderTagClasses;


import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
import javax.faces.event.ValueChangeEvent;
import javax.faces.webapp.UIComponentTag;
public class BDE_IAS_ComboTag extends UIComponentTag{

String lista;
String listaValores;
String value;
String valueChangeListener;

public String getValueChangeListener() {
   return valueChangeListener;
   }

   public void setValueChangeListener(String valueChangeListener) {
   this.valueChangeListener = valueChangeListener;
   }

public void setLista(String lista){
this.lista=lista;
}

public String getLista(){
return lista;
}

public void setListaValores(String lista){
this.listaValores=lista;
}

public String getListaValores(){
return listaValores;
}

public void setValue(String valor){
this.value=valor;
}

public String getValue(){
return value;
}

public void release() {
// the super class method should be called
super.release();
lista=null;
value=null;
valueChangeListener=null;
listaValores=null;
}

protected void setProperties(UIComponent component) {
super.setProperties(component);

if (lista != null) {
if (isValueReference(lista)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(lista);

component.setValueBinding(lista, vb);
} else {
if(lista.length()==0){
lista=null;
}
else{

component.getAttributes().put(lista,lista);
}
}
}

if (listaValores != null) {
if (isValueReference(listaValores)) {
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(listaValores);

component.setValueBinding(listaValores, vb);
} else {
if(listaValores.length()!=0){

component.getAttributes().put(listaValores,listaValores);
}
else{
if(lista!=null){
if(lista.length()0){
			ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(lista);


component.setValueBinding(listaValores, vb);
}
}
}
}
}

if (value!=null) {
if (isValueReference(value)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(value);

component.setValueBinding(value, vb);
}
else {
if(value.length()==0){
value=null;
}
else{

component.getAttributes().put(value,value);
}
}
}


if (valueChangeListener != null) {
   if (isValueReference(valueChangeListener)) {
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
   	MethodBinding mb = app.createMethodBinding(valueChangeListener, 
new Class[] { ValueChangeEvent.class });

component.getAttributes().put(valueChangeListener, mb);
   }
   }
}

public String getRendererType() { return combo; }
public String getComponentType() { return combo; }

}




package rendererClasses;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;


public class ComboRenderer extends Renderer{

	public void 

Re: Providing bugfix: Firefox body onload= tag - Re: x:inputCalendar - popup hidden by other elements

2005-09-15 Thread Bruno Aranda
Thanks! It is fixed now...

Bruno

2005/9/15, Paul Klaer [EMAIL PROTECTED]:
 Done. :-)
 
 http://issues.apache.org/jira/browse/MYFACES-569
 
 Bruno Aranda wrote:
  Thanks Paul, but could you please open a JIRA issue with the problem
  and upload the patch there? Then this will be tested :-) We have to
  keep the bugs under control...
 
  Regards,
 
  Bruno
 
  2005/9/15, Paul Klaer [EMAIL PROTECTED]:
 
 Hi,
 
 this is definitly a bug. So, here I provide the solution. Can someone
 test and commit the files please?
 
 I saw the mail in the dev list from Zhong Li:
 ---
 I found how it happened. I have onload on body tag, even with simplest
 one, something like, body onload=alert('loading');
 ...
 Then the inputCalendar doesn't work, can't popup. so weired. 
 ---
 
 Since he had the same problem I checked the JavaScript behaviour in
 Firefox and debugged a little bit...
 
 This problem occures because the old JavaScript is executed in Firefox
 before the body tag onload is set during the render phase.
 So this variable var jscalendarOnloadBackup = window.onload; is only
 set to undefined and never with the old onload script.
 
 To solve this problem I rewrote the load script as a function in the
 popcalendar.js and this function is then called just before
 jscalendarSetImageDirectory is called inside the enclosing body
 element. At this time the onload tag of the body element is set.
 
 You can test this if you change the body element to body
 onload=alert('test body onload'); of the simple/calendar.jsp example..
 
 Regards,
 
 Paul
 
 
 Paul Klaer wrote:
 
 Thank you for your tipps and sorry for my late answer. I had much to do
 and wanted to check the code before I write something back.
 In the meantime we got a new CSS file and the calendar popups are
 working fine in IE after resetting some div...
 
 The examples out of the myfaces repository are working on both: Firefox
 and IE. There I had no problem with the js script.
 
 I think we have to be careful using css...
 
 But, I have now a problem with Firefox popups to display them and this
 is because we use the onload tag and some own javascript init
 functions for the page.
 Now I checked the popcalendar.js code and the function
 jscalendarInit() is only called if there is no window.onload (onload
 tag) in the browser specified if no IE is used. This is why the variable
 jscalendarBPageLoaded still remains with the default value false and
 Firefox never executes this:
 
 -
 function jscalendarPopUpCalendar(ctl, ctl2, format){
 if (jscalendarBPageLoaded){
 
 -
 
 Is this right that I can't use the onload tag using Firefox?
 
 
 Martin Marinschek wrote:
 
 
 this occurs with IE only, right?
 
 it's a known bug of the IE - you would need to go through the elements
 of the form and render them invisible while displaying the
 inputCalendar.
 
 If you prepare a patch for the javaScript of inputCalendar which works
 in IE and Firefox we would happily apply it!
 
 regards,
 
 Martin
 
 On 9/9/05, Paul Klaer [EMAIL PROTECTED] wrote:
 
 
 Hi,
 
 I have a problem using the inputCalendar component. The popup window is
 shown correctly and works fine but if there are some buttons on my form
 the popup window is hidden by the buttons. The popup just appears in the
 background.
 How can I solve this problem? Using css and the z-index for the buttons
 option doesn't solve the problem. How can I set the calendar popup
 component to the foreground?
 Is it a bug of the inputCalendar component?
 
 Paul
 
 
 
 
 
 
 /*
  * Copyright 2004 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.apache.myfaces.custom.calendar;
 
 import org.apache.myfaces.component.html.ext.HtmlInputText;
 import org.apache.myfaces.component.html.util.AddResource;
 import org.apache.myfaces.renderkit.JSFAttr;
 import org.apache.myfaces.renderkit.RendererUtils;
 import org.apache.myfaces.renderkit.html.HTML;
 import org.apache.myfaces.renderkit.html.HtmlRenderer;
 import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
 import org.apache.myfaces.renderkit.html.util.JavascriptUtils;
 
 import javax.faces.application.Application;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
 import javax.faces.component.UIParameter;
 import javax.faces.component.html.HtmlCommandLink;
 import javax.faces.component.html.HtmlOutputText;
 import 

Re: Providing bugfix: Firefox body onload= tag - Re: x:inputCalendar - popup hidden by other elements

2005-09-15 Thread Paul Klaer

You're welcome! Thanks for the fast resolving :-)

Paul

Bruno Aranda wrote:

Thanks! It is fixed now...

Bruno

2005/9/15, Paul Klaer [EMAIL PROTECTED]:


Done. :-)

http://issues.apache.org/jira/browse/MYFACES-569

Bruno Aranda wrote:


Thanks Paul, but could you please open a JIRA issue with the problem
and upload the patch there? Then this will be tested :-) We have to
keep the bugs under control...

Regards,

Bruno

2005/9/15, Paul Klaer [EMAIL PROTECTED]:



Hi,

this is definitly a bug. So, here I provide the solution. Can someone
test and commit the files please?

I saw the mail in the dev list from Zhong Li:
---
I found how it happened. I have onload on body tag, even with simplest
one, something like, body onload=alert('loading');
...
Then the inputCalendar doesn't work, can't popup. so weired. 
---

Since he had the same problem I checked the JavaScript behaviour in
Firefox and debugged a little bit...

This problem occures because the old JavaScript is executed in Firefox
before the body tag onload is set during the render phase.
So this variable var jscalendarOnloadBackup = window.onload; is only
set to undefined and never with the old onload script.

To solve this problem I rewrote the load script as a function in the
popcalendar.js and this function is then called just before
jscalendarSetImageDirectory is called inside the enclosing body
element. At this time the onload tag of the body element is set.

You can test this if you change the body element to body
onload=alert('test body onload'); of the simple/calendar.jsp example..

Regards,

Paul


Paul Klaer wrote:



Thank you for your tipps and sorry for my late answer. I had much to do
and wanted to check the code before I write something back.
In the meantime we got a new CSS file and the calendar popups are
working fine in IE after resetting some div...

The examples out of the myfaces repository are working on both: Firefox
and IE. There I had no problem with the js script.

I think we have to be careful using css...

But, I have now a problem with Firefox popups to display them and this
is because we use the onload tag and some own javascript init
functions for the page.
Now I checked the popcalendar.js code and the function
jscalendarInit() is only called if there is no window.onload (onload
tag) in the browser specified if no IE is used. This is why the variable
jscalendarBPageLoaded still remains with the default value false and
Firefox never executes this:

-
function jscalendarPopUpCalendar(ctl, ctl2, format){
  if (jscalendarBPageLoaded){
  
-

Is this right that I can't use the onload tag using Firefox?


Martin Marinschek wrote:




this occurs with IE only, right?

it's a known bug of the IE - you would need to go through the elements
of the form and render them invisible while displaying the
inputCalendar.

If you prepare a patch for the javaScript of inputCalendar which works
in IE and Firefox we would happily apply it!

regards,

Martin

On 9/9/05, Paul Klaer [EMAIL PROTECTED] wrote:




Hi,

I have a problem using the inputCalendar component. The popup window is
shown correctly and works fine but if there are some buttons on my form
the popup window is hidden by the buttons. The popup just appears in the
background.
How can I solve this problem? Using css and the z-index for the buttons
option doesn't solve the problem. How can I set the calendar popup
component to the foreground?
Is it a bug of the inputCalendar component?

Paul







/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.myfaces.custom.calendar;

import org.apache.myfaces.component.html.ext.HtmlInputText;
import org.apache.myfaces.component.html.util.AddResource;
import org.apache.myfaces.renderkit.JSFAttr;
import org.apache.myfaces.renderkit.RendererUtils;
import org.apache.myfaces.renderkit.html.HTML;
import org.apache.myfaces.renderkit.html.HtmlRenderer;
import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
import org.apache.myfaces.renderkit.html.util.JavascriptUtils;

import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UIParameter;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import 

Re: Custom Component

2005-09-15 Thread Goyo Escobar Escalero

JAVA IS 1.4

I'm not using myFaces

Original Message Follows
From: Udo Schnurpfeil [EMAIL PROTECTED]
Reply-To: MyFaces Discussion users@myfaces.apache.org
To: MyFaces Discussion users@myfaces.apache.org
Subject: Re: Custom Component
Date: Thu, 15 Sep 2005 12:30:49 +0200

Hi!

What is the Java version?
What is the MyFaces version?

Udo

Goyo Escobar Escalero wrote:


I've a problem extendign the UISelectOne component...

My classes:

package holderTagClasses;


import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
import javax.faces.event.ValueChangeEvent;
import javax.faces.webapp.UIComponentTag;
public class BDE_IAS_ComboTag extends UIComponentTag{

String lista;
String listaValores;
String value;
String valueChangeListener;

public String getValueChangeListener() {
   return valueChangeListener;
   }

   public void setValueChangeListener(String valueChangeListener) {
   this.valueChangeListener = valueChangeListener;
   }

public void setLista(String lista){
this.lista=lista;
}

public String getLista(){
return lista;
}

public void setListaValores(String lista){
this.listaValores=lista;
}

public String getListaValores(){
return listaValores;
}

public void setValue(String valor){
this.value=valor;
}

public String getValue(){
return value;
}

public void release() {
// the super class method should be called
super.release();
lista=null;
value=null;
valueChangeListener=null;
listaValores=null;
}

protected void setProperties(UIComponent component) {
super.setProperties(component);

if (lista != null) {
if (isValueReference(lista)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(lista);


component.setValueBinding(lista, vb);
} else {
if(lista.length()==0){
lista=null;
}
else{
component.getAttributes().put(lista,lista);
}
}
}

if (listaValores != null) {
if (isValueReference(listaValores)) {
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(listaValores);


component.setValueBinding(listaValores, vb);
} else {
if(listaValores.length()!=0){

component.getAttributes().put(listaValores,listaValores);

}
else{
if(lista!=null){
if(lista.length()0){
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(lista);


component.setValueBinding(listaValores, vb);
}
}
}
}
}

if (value!=null) {
if (isValueReference(value)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(value);


component.setValueBinding(value, vb);
}
else {
if(value.length()==0){
value=null;
}
else{
component.getAttributes().put(value,value);
}
}
}


if (valueChangeListener != null) {
   if (isValueReference(valueChangeListener)) {
   FacesContext context = FacesContext.getCurrentInstance();
   Application app = context.getApplication();
   MethodBinding mb = 
app.createMethodBinding(valueChangeListener, new Class[] { 
ValueChangeEvent.class });

   component.getAttributes().put(valueChangeListener, mb);
   }
   }
}

public String getRendererType() { return combo; }
public String getComponentType() { return combo; }

}




package rendererClasses;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;


public class ComboRenderer extends Renderer{

public void encodeBegin(FacesContext context, UIComponent combo) 
throws IOException {

ResponseWriter writer = context.getResponseWriter();
char salto ='\n';

try{
//ArrayList lista = (ArrayList)getLista();
ArrayList lista = 
(ArrayList)combo.getAttributes().get(lista);

ArrayList listaValores= new ArrayList();;

Change Email-Address for mailing-lists

2005-09-15 Thread Hendrik Neumann
Hi everybody,

my email-address will change in a few days - how can I change it for the 
mailing-lists?

Greetings,
Hendrik


RE: Hibernate: 1-to-many -- struggling

2005-09-15 Thread Joshua Davis
Werner,

Since you have data associated with your many-to-many, you can simplify this
by making an entity in the middle, transforming your many-to-many in to a
many-to-one, one-to-many from the ORMs perspective.

We can continue this discussion on the Hibernate forum, if you like.  I'd be
glad to help you out.

[EMAIL PROTECTED]

 -Original Message-
 From: news [mailto:[EMAIL PROTECTED] On Behalf Of Werner Punz
 Sent: Thursday, September 15, 2005 2:54 AM
 To: users@myfaces.apache.org
 Subject: Re: Hibernate: 1-to-many -- struggling
 
 Well maybe the original guy did not use session.saveOrUpdate 
 on the parent element...
 
 I usually deal with 1:n which usually are far less 
 problematic then m:n (which is the case where you usually 
 sink 90% of the dev time banging your head and cursing 
 hibernate left and right) is to have a 1:n rel, with a set 
 mapping and to use cascade all with a save on the root element.
 That has worked best.
 
 The crux of hibernate is, you have so many ways to solve 
 things for everything around 100 ways, but 90 of them fail 
 with either no error or cryptic error messages once you have 
 to apply them, while there still is a huge lack of best 
 practices especially in the areas many-to-many and one-to-many
 
 I will give an example:
 Implicit mapping, not working if you have additional data in 
 your many to many binding table, now how do you resolve that 
 you can resolve it via an explicit binding object 
 declaration, the doc is very vague on this approach,
 
 you finally get it up and running, loading works, but 
 deleting utterly fails with a cascade error, no real help in 
 the forum, after banging your head for straight 8 hours you 
 finally know why this happens, you delete the objects with an 
 explicit delete and regenerate the binding objects, but the 
 binding table does not have a surrogate, you do that within 
 the same transaction.
 What wouldnt pose a problem in straight JDBC because you 
 clear the m:n elements out of the many to many table before 
 setting them anew, causes hibernate to choke.
 Solution, set the relational binding to lazy thus the objects 
 do not get marked as deleted before loading the parent object 
 and thus the setting works again.
 
 It is cases like that, which are very commmon where all the 
 documentation unfortunately utterly fails and where you can 
 sink hours into hibernate.
 
 Hibernate to my taste lacks a high level layer which resolves 
 such cases automatically, some kind of
 hibernatetool.resolveManyToManyBinding(BindingList) would 
 have helped a lot in this case.
 
 Before Hibernate 2 it also was the session handling which 
 lacked those tools, that fortunately is resolved now.
 
 
 
 Rafael Nami wrote:
  I'm not an expert in this, but I think if you use another type of
  collection, like a Set or a List, this behavior won't 
 occur. I usually
  use Sets to many to many and Lists to bidirecional relations.
  
  Hope that it helps
  
  Rafael Mauricio Nami
  
  2005/9/12, Dave [EMAIL PROTECTED]:
  
 I am struggling with Hibernate 1-to-many mapping(collection). 
 Could someone tell me how to manage the collection of 
 one-to-many mapping? a
 little code will be very helpful.
 
 I have a very simple one-to-many relationship: an Item has 
 many Picture(s). 
 
 ENTITY -- Item 
 @... 
 public class item { 
 private Collection pictures; 
 private Integer id; 
 
 // getter/setter for id and @Id(...) 
 
 
 @OneToMany(cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER,
 mappedBy=item) 
 public Collection getPictures() { 
 return pictures; 
 } 
 
 public void setPictures(Collection pictures) { 
 this.pictures = pictures; 
 } 
 
 public void addPicture(Picture p) { 
 
 if (pictures == null) 
 pictures = new ArrayList(); 
 pictures.add(p); 
 
 } 
 } 
 
 ENTITY Picture -- 
 @  
 public class Picture { 
 private Item item; 
 private Integer id; 
 
 // constructor 
 public Picture(Item item, ) { 
 this.item = item; 
  
 } 
 // getter/setter for id and @Id(...) 
 
 @ManyToOne 
 @JoinColumn(name=itemId) 
 public Item getItem() { 
 return item; 
 } 
 
 public void setItem(Item item) { 
 this.item = item; 
 } 
 } 
 
 I create an Item in persistence without any pictures. Then 
 use a session
 bean to add pictures to the item. 
 
 Session Bean -- 
 
 @Stateless 
 public class ItemManagerBean implements ItemManager { 
 
 public void addPictureToItem(Item item, Picture p) { 
 item.addPicture(p); 
 em.merge(item); 
 } 
 
 } 
 
 The merge() ignores those pictures that are already in persistence. 
 Add picture P1: --- persistence: P1, ( great!) 
 Add picture P2 --- persistence: P1, P1, P2 (P1 duplicated) 
 Add picture P3 --- persistence: P1, P1, P2, P1, P2, P3 
 
 Obviously, the merge() ignored what are already in 
 persistence. All pictures
 has Id. EM.merge() should be able to know P1 is already in 
 persistence when
 adding P2. 
 
 I f I do not call merge(), nothing will be persisted. 
 
 I do this from Web GUI. 

Re: commandLink with action inside Table

2005-09-15 Thread Mathias Brökelmann
the action of the commandlink is only executed if the rendered flag
for this and his parent component is true during the decode phase.

Can you post the surrounding datatable tag also?

2005/9/15, Christian Froelich [EMAIL PROTECTED]:
 Hello,
 
 I try to use a commandLink with an action inside a treeTable but it is
 not working properly  :-(
 The following snippet of a treeTable-column is expected to:
 - render a link if it 's the tableHead
 - render a outputText if it's a row inside the tableBody
 - render a outputText with a special style if it's selected
 
 h:column id=columnBrowsTab1 rendered=#{foo.secondBoolean}
 h:commandLink
action=#{listener.sort}
immediate=true
rendered=#{foo.obid == 'obid'}XX/h:commandLink
 h:outputText value=#{foo.secondColumn}
rendered=#{foo.obid != 'obid' and !(foo.obid == listener.obid)}/
 h:outputText  value=#{foo.secondColumn}
rendered=#{(foo.obid == listener.obid)}
styleClass=treeNodeSelected /
 /h:column
 
 The result so far looks good, but the ACTION method of the link gets
 only fired if the tableBody is empty.
 
 Any ideas to solve this problem???
 
  -  my backingBean has session scope
  -  I'm using the nightly build from 2005/09/12.
 
 Warm regards,
 
 Christian
 
 --
 Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
 Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
 


-- 
Mathias


Re: Change Email-Address for mailing-lists

2005-09-15 Thread Hendrik Neumann
Okay, I've done this - thanks.


Re: Hibernate: 1-to-many -- struggling

2005-09-15 Thread Werner Punz

Jepp just gave you an example on how I think things could be made easier
or how things should resolve in that special area...
Dont get me wrong, I like Hibernate but I have seen several developers
run into serious issues in that area...

Werner


Joshua Davis wrote:

Aha, I've found you!
http://forum.hibernate.org/viewtopic.php?t=947528



-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Werner Punz
Sent: Thursday, September 15, 2005 2:45 AM
To: users@myfaces.apache.org
Subject: Re: Hibernate: 1-to-many -- struggling

Duncan Krebs wrote:


Hey,
Here are my two cents. The biggest obstacle with Hibernate 


is figuring 

out how to correctly map the stupid collections and 


relationships that 

are modeled in your object model. I did not take the time 


to look at 


all your code but maybe this will help you out:



The mapping is one obstacle, the other one is dealing 
correctly with the dreaded m:n relations, there is a huge 
lack of good documentation in this area, I hope the next 
release of Hibernate in action will resolve that...


Hibernate is not a toy but it is harder to grasp in some 
areas than a straight database approach via jdbc.
I am just wondering all the time when I am banging my head 
again for hours against some weirdness which was caused 
mostly by a mistake of mine, due to lack of understanding / 
documentation in a certain area, if there cannot be a sane 
middleground somewhere.



now it is getting really off topic ;-)









Re: Custom Component

2005-09-15 Thread Udo Schnurpfeil

Which Faces implementation? Which version?

What is the long version of Java? I'm wondering about the 
NullPointerException inside of java.lang.Throwable.


What is the content of the JSP?

Udo

Goyo Escobar Escalero wrote:


JAVA IS 1.4

I'm not using myFaces

Original Message Follows
From: Udo Schnurpfeil [EMAIL PROTECTED]
Reply-To: MyFaces Discussion users@myfaces.apache.org
To: MyFaces Discussion users@myfaces.apache.org
Subject: Re: Custom Component
Date: Thu, 15 Sep 2005 12:30:49 +0200

Hi!

What is the Java version?
What is the MyFaces version?

Udo

Goyo Escobar Escalero wrote:


I've a problem extendign the UISelectOne component...

My classes:

package holderTagClasses;


import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
import javax.faces.event.ValueChangeEvent;
import javax.faces.webapp.UIComponentTag;
public class BDE_IAS_ComboTag extends UIComponentTag{

String lista;
String listaValores;
String value;
String valueChangeListener;

public String getValueChangeListener() {
   return valueChangeListener;
   }

   public void setValueChangeListener(String valueChangeListener) {
   this.valueChangeListener = valueChangeListener;
   }

public void setLista(String lista){
this.lista=lista;
}

public String getLista(){
return lista;
}

public void setListaValores(String lista){
this.listaValores=lista;
}

public String getListaValores(){
return listaValores;
}

public void setValue(String valor){
this.value=valor;
}

public String getValue(){
return value;
}

public void release() {
// the super class method should be called
super.release();
lista=null;
value=null;
valueChangeListener=null;
listaValores=null;
}

protected void setProperties(UIComponent component) {
super.setProperties(component);

if (lista != null) {
if (isValueReference(lista)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(lista); 



component.setValueBinding(lista, vb);
} else {
if(lista.length()==0){
lista=null;
}
else{
component.getAttributes().put(lista,lista);
}
}
}

if (listaValores != null) {
if (isValueReference(listaValores)) {
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(listaValores); 



component.setValueBinding(listaValores, vb);
} else {
if(listaValores.length()!=0){

component.getAttributes().put(listaValores,listaValores);

}
else{
if(lista!=null){
if(lista.length()0){
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(lista); 



component.setValueBinding(listaValores, 
vb);

}
}
}
}
}

if (value!=null) {
if (isValueReference(value)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(value); 



component.setValueBinding(value, vb);
}
else {
if(value.length()==0){
value=null;
}
else{
component.getAttributes().put(value,value);
}
}
}


if (valueChangeListener != null) {
   if (isValueReference(valueChangeListener)) {
   FacesContext context = FacesContext.getCurrentInstance();
   Application app = context.getApplication();
   MethodBinding mb = 
app.createMethodBinding(valueChangeListener, new Class[] { 
ValueChangeEvent.class });

   component.getAttributes().put(valueChangeListener, mb);
   }
   }
}

public String getRendererType() { return combo; }
public String getComponentType() { return combo; }

}




package rendererClasses;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;


public class ComboRenderer extends Renderer{

public void encodeBegin(FacesContext context, UIComponent combo) 
throws IOException {

ResponseWriter writer = context.getResponseWriter();
char 

Re: Map managed bean with managed properties

2005-09-15 Thread Michael
Yeah you can use expressions (JSF Spec 1.1 Section 10.3.1 Page
285). I use Spring's delegating variable resolver to expose my
Spring beans through EL and then I inject references to them in this
manner. It has worked great up until the map case.

Should a bug be filed on this or is it desired behavior? I looked
through the spec for guidance here but I didn't see anything.

Thanks,
MichaelOn 9/15/05, Ricardo R. Ramírez Valenzuela [EMAIL PROTECTED] wrote:
Does this actually work? I don't think you can use expressions in thevalue for initialization.What I do when I want to inject a value to another bean is get thebean via the faces context, for example I do a
getManagedBean(detailsBean).setDetail(someObject)(I attach the code for my getManagedBean method below)public final static Object getManagedBean(String beanName){FacesContext facesContext = 
FacesContext.getCurrentInstance();Application a = facesContext.getApplication();ValueBinding binding = a.createValueBinding(#{ + beanName + });return binding.getValue
(facesContext);}I wonder if this is the best practiceRicardoMichael wrote: Hi all, I have a managed bean that implements the Map interface.The bean also has a dependency that needs to be injected.I thought I'd be
 able to configure the bean like this: public class MyMap implements Map { ... public Dependency getMyDependency() { return myDependency; } public Dependency setMyDependency(Dependency newDependency) {
 myDependency = newDependency; // initialize contained map using myDependency } ... // Impementation of map interface... } managed-bean
 managed-bean-namemyMap/managed-bean-name managed-bean-classMyMap/managed-bean-class managed-bean-scoperequest/managed-bean-scope
 managed-property property-namemyDependency/property-name property-classDependency/property-class value#{someOtherBean}/value
 /managed-property /managed-bean The problem I'm running into is that PropertyResolverImpl.setValue checks to see if the bean is an instance of Map and if so, calls
 put(property, value).So instead of calling MyMap.setMyDependency, it is calling MyMap.put and passing the key = myDependency and the value = #{someOtherBean}. Any suggestions?
 Thanks, Michael


Re: Custom Component

2005-09-15 Thread Udo Schnurpfeil

hmmm, I think IBM uses an other java version...

with the IBM I can't help your in the moment. I've no sources.

But what I've seen is the start of the stacktrace.

It seems that there is an NullPointerException, and while the 
construction of the NullPointerException an NullPointerException 
occures. Looks like a problem of IBM.


Hope that helps

Udo


java.lang.NullPointerException
at java.lang.Throwable.init(Throwable.java)
at java.lang.Throwable.init(Throwable.java)
at java.lang.NullPointerException.init(NullPointerException.java:61)
at 
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:675)



Udo Schnurpfeil wrote:

Which Faces implementation? Which version?

What is the long version of Java? I'm wondering about the 
NullPointerException inside of java.lang.Throwable.


What is the content of the JSP?

Udo

Goyo Escobar Escalero wrote:


JAVA IS 1.4

I'm not using myFaces

Original Message Follows
From: Udo Schnurpfeil [EMAIL PROTECTED]
Reply-To: MyFaces Discussion users@myfaces.apache.org
To: MyFaces Discussion users@myfaces.apache.org
Subject: Re: Custom Component
Date: Thu, 15 Sep 2005 12:30:49 +0200

Hi!

What is the Java version?
What is the MyFaces version?

Udo

Goyo Escobar Escalero wrote:


I've a problem extendign the UISelectOne component...

My classes:

package holderTagClasses;


import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
import javax.faces.event.ValueChangeEvent;
import javax.faces.webapp.UIComponentTag;
public class BDE_IAS_ComboTag extends UIComponentTag{

String lista;
String listaValores;
String value;
String valueChangeListener;

public String getValueChangeListener() {
   return valueChangeListener;
   }

   public void setValueChangeListener(String valueChangeListener) {
   this.valueChangeListener = valueChangeListener;
   }

public void setLista(String lista){
this.lista=lista;
}

public String getLista(){
return lista;
}

public void setListaValores(String lista){
this.listaValores=lista;
}

public String getListaValores(){
return listaValores;
}

public void setValue(String valor){
this.value=valor;
}

public String getValue(){
return value;
}

public void release() {
// the super class method should be called
super.release();
lista=null;
value=null;
valueChangeListener=null;
listaValores=null;
}

protected void setProperties(UIComponent component) {
super.setProperties(component);

if (lista != null) {
if (isValueReference(lista)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(lista); 



component.setValueBinding(lista, vb);
} else {
if(lista.length()==0){
lista=null;
}
else{
component.getAttributes().put(lista,lista);
}
}
}

if (listaValores != null) {
if (isValueReference(listaValores)) {
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(listaValores); 



component.setValueBinding(listaValores, vb);
} else {
if(listaValores.length()!=0){

component.getAttributes().put(listaValores,listaValores);

}
else{
if(lista!=null){
if(lista.length()0){
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(lista); 



component.setValueBinding(listaValores, 
vb);

}
}
}
}
}

if (value!=null) {
if (isValueReference(value)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(value); 



component.setValueBinding(value, vb);
}
else {
if(value.length()==0){
value=null;
}
else{
component.getAttributes().put(value,value);
}
}
}


if (valueChangeListener != null) {
   if (isValueReference(valueChangeListener)) {
   FacesContext context = FacesContext.getCurrentInstance();
   Application app = context.getApplication();
   MethodBinding mb = 
app.createMethodBinding(valueChangeListener, new Class[] { 
ValueChangeEvent.class });

   component.getAttributes().put(valueChangeListener, mb);
  

Re: Custom Component

2005-09-15 Thread Werner Punz

Websphere problably runs on the IBM JDK,...


Udo Schnurpfeil wrote:

hmmm, I think IBM uses an other java version...

with the IBM I can't help your in the moment. I've no sources.

But what I've seen is the start of the stacktrace.

It seems that there is an NullPointerException, and while the 
construction of the NullPointerException an NullPointerException 
occures. Looks like a problem of IBM.


Hope that helps

Udo


java.lang.NullPointerException
at java.lang.Throwable.init(Throwable.java)
at java.lang.Throwable.init(Throwable.java)
at java.lang.NullPointerException.init(NullPointerException.java:61)
at 
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:675)



Udo Schnurpfeil wrote:


Which Faces implementation? Which version?

What is the long version of Java? I'm wondering about the 
NullPointerException inside of java.lang.Throwable.


What is the content of the JSP?

Udo

Goyo Escobar Escalero wrote:


JAVA IS 1.4

I'm not using myFaces

Original Message Follows
From: Udo Schnurpfeil [EMAIL PROTECTED]
Reply-To: MyFaces Discussion users@myfaces.apache.org
To: MyFaces Discussion users@myfaces.apache.org
Subject: Re: Custom Component
Date: Thu, 15 Sep 2005 12:30:49 +0200

Hi!

What is the Java version?
What is the MyFaces version?

Udo

Goyo Escobar Escalero wrote:


I've a problem extendign the UISelectOne component...

My classes:

package holderTagClasses;


import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
import javax.faces.event.ValueChangeEvent;
import javax.faces.webapp.UIComponentTag;
public class BDE_IAS_ComboTag extends UIComponentTag{

String lista;
String listaValores;
String value;
String valueChangeListener;

public String getValueChangeListener() {
   return valueChangeListener;
   }

   public void setValueChangeListener(String valueChangeListener) {
   this.valueChangeListener = valueChangeListener;
   }

public void setLista(String lista){
this.lista=lista;
}

public String getLista(){
return lista;
}

public void setListaValores(String lista){
this.listaValores=lista;
}

public String getListaValores(){
return listaValores;
}

public void setValue(String valor){
this.value=valor;
}

public String getValue(){
return value;
}

public void release() {
// the super class method should be called
super.release();
lista=null;
value=null;
valueChangeListener=null;
listaValores=null;
}

protected void setProperties(UIComponent component) {
super.setProperties(component);

if (lista != null) {
if (isValueReference(lista)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(lista); 



component.setValueBinding(lista, vb);
} else {
if(lista.length()==0){
lista=null;
}
else{
component.getAttributes().put(lista,lista);
}
}
}

if (listaValores != null) {
if (isValueReference(listaValores)) {
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(listaValores); 



component.setValueBinding(listaValores, vb);
} else {
if(listaValores.length()!=0){

component.getAttributes().put(listaValores,listaValores);

}
else{
if(lista!=null){
if(lista.length()0){
ValueBinding vb 
=FacesContext.getCurrentInstance().getApplication().createValueBinding(lista); 




component.setValueBinding(listaValores, vb);

}
}
}
}
}

if (value!=null) {
if (isValueReference(value)) {
ValueBinding vb = 
FacesContext.getCurrentInstance().getApplication().createValueBinding(value); 



component.setValueBinding(value, vb);
}
else {
if(value.length()==0){
value=null;
}
else{
component.getAttributes().put(value,value);
}
}
}


if (valueChangeListener != null) {
   if (isValueReference(valueChangeListener)) {
   FacesContext context = 
FacesContext.getCurrentInstance();

   Application app = context.getApplication();
   MethodBinding mb = 
app.createMethodBinding(valueChangeListener, new Class[] { 
ValueChangeEvent.class });
 

Re: URGENT! HELP ME! Tree2 state problem

2005-09-15 Thread Guilherme Gomes
Well, i solved my issue by not creating a new tree. I
have my tree in a session bean, so i just clean the
root's children - with attention to collapse the nodes
if they are expanded - and then repopulate the tree
with the new data.

That solved it, as i no longer have the same exception
as you do now.



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: commandLink with action inside Table

2005-09-15 Thread Christian Froelich
Hello,

YES, the action is executed if I remove the rendered attribute...
BUT I need this attribute. You know this Problem or a solution??

Best Regards, 

Christian

 --- Ursprüngliche Nachricht ---
 Von: Rick Reumann [EMAIL PROTECTED]
 An: MyFaces Discussion users@myfaces.apache.org
 Betreff: Re: commandLink with action inside Table
 Datum: Thu, 15 Sep 2005 11:36:08 -0400
 
 Does the action get executed if you remove the 'rendered' attribute?
 
 Christian Froelich wrote the following on 9/15/2005 9:00 AM:
  Thanks for your fast answer!
  
  My jsp looks like this:
  
  x:tree id=tree value=#{treeTable.treeModel}
  var=foo
  styleClass=tree3
  nodeClass=browserCol
  columnClasses=treeNode
  selectedNodeClass=treeNodeSelected
  expandRoot=true
  
x:treeColumn rendered=#{foo.firstBoolean} id=treeColumn
   ...
/x:treeColumn
  
h:column id=columnBrowsTab1 rendered=#{foo.secondBoolean}
  h:commandLink
 action=#{listener.sort}
 immediate=true
 rendered=#{foo.obid == 'obid'}
 value=/h:commandLink
  h:outputText value=#{foo.secondColumn}
 rendered=#{foo.obid != 'obid' and !(foo.obid ==
 listener.obid)}/
  h:outputText  value=#{foo.secondColumn}
 rendered=#{(foo.obid == listener.obid)}
 styleClass=treeNodeSelected /
/h:column
  
...other h:columns...
  
  /x:tree
  
  The commandLink is always rendered as link. And also the rest of the
  treeTable seems to get rendered correctly. But the action method is only
  executed if the tableBody is empty.
  
  
  Thanks and warm regards,
  
  Christian
  
  
  
 --- Ursprüngliche Nachricht ---
 Von: Mathias Brökelmann [EMAIL PROTECTED]
 An: MyFaces Discussion users@myfaces.apache.org
 Betreff: Re: commandLink with action inside Table
 Datum: Thu, 15 Sep 2005 14:01:53 +0200
 
 the action of the commandlink is only executed if the rendered flag
 for this and his parent component is true during the decode phase.
 
 Can you post the surrounding datatable tag also?
 
 2005/9/15, Christian Froelich [EMAIL PROTECTED]:
 
 Hello,
 
 I try to use a commandLink with an action inside a treeTable but it is
 not working properly  :-(
 The following snippet of a treeTable-column is expected to:
 - render a link if it 's the tableHead
 - render a outputText if it's a row inside the tableBody
 - render a outputText with a special style if it's selected
 
 h:column id=columnBrowsTab1 rendered=#{foo.secondBoolean}
 h:commandLink
action=#{listener.sort}
immediate=true
rendered=#{foo.obid == 'obid'}XX/h:commandLink
 h:outputText value=#{foo.secondColumn}
rendered=#{foo.obid != 'obid' and !(foo.obid == listener.obid)}/
 h:outputText  value=#{foo.secondColumn}
rendered=#{(foo.obid == listener.obid)}
styleClass=treeNodeSelected /
 /h:column
 
 The result so far looks good, but the ACTION method of the link gets
 only fired if the tableBody is empty.
 
 Any ideas to solve this problem???
 
  -  my backingBean has session scope
  -  I'm using the nightly build from 2005/09/12.
 
 Warm regards,
 
 Christian
 
 --
 Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
 Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
 
 
 
 -- 
 Mathias
 
  
  
 
 
 -- 
 Rick
 

-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner


Re: Map managed bean with managed properties

2005-09-15 Thread Mike Kienenberger
It looks like you need to look at JavaServer Pages Specification (version 2.0),
sections 2.3 through 2.9 to determine the precedence of calling Map vs
calling Bean properties.

Take a look at JSF Spec 1.1 Section 5.1.3 (Get Value Semantics) and
5.1.4 (Set Value Semantics).   While nothing is explicitly stated for
get value semantics (just the reference to the above, which I don't
have handy), set value semantics show that the map put operation takes
precedence over the bean setter.

On 9/15/05, Michael [EMAIL PROTECTED] wrote:
 Yeah you can use expressions (JSF Spec 1.1 Section 10.3.1 Page 285).  I use
 Spring's delegating variable resolver to expose my Spring beans through EL
 and then I inject references to them in this manner.  It has worked great up
 until the map case.
  
  Should a bug be filed on this or is it desired behavior?  I looked through
 the spec for guidance here but I didn't see anything.
  
  Thanks,
  Michael
 
 
 On 9/15/05, Ricardo R. Ramírez Valenzuela [EMAIL PROTECTED] wrote:
  Does this actually work? I don't think you can use expressions in the
  value for initialization.
  
  What I do when I want to inject a value to another bean is get the
  bean via the faces context, for example I do a 
  getManagedBean(detailsBean).setDetail(someObject)
  
  (I attach the code for my getManagedBean method below)
  
  public final static Object getManagedBean(String beanName)
  {
  FacesContext facesContext = FacesContext.getCurrentInstance();
  Application a = facesContext.getApplication();
  ValueBinding binding = a.createValueBinding(#{ + beanName +
 });
  return binding.getValue (facesContext);
  }
  
  I wonder if this is the best practice
  
  Ricardo
  
  Michael wrote:
  
   Hi all,
  
   I have a managed bean that implements the Map interface.  The bean
   also has a dependency that needs to be injected.  I thought I'd be 
   able to configure the bean like this:
  
   public class MyMap implements Map {
   ...
   public Dependency getMyDependency() {
   return myDependency;
   }
   public Dependency setMyDependency(Dependency newDependency) { 
   myDependency = newDependency;
   // initialize contained map using myDependency
   }
   ...
   // Impementation of map interface...
   }
  
   managed-bean 
   managed-bean-namemyMap/managed-bean-name
   managed-bean-classMyMap/managed-bean-class
  
 managed-bean-scoperequest/managed-bean-scope 
   managed-property
   property-namemyDependency/property-name
   property-classDependency/property-class
   value#{someOtherBean}/value 
   /managed-property
   /managed-bean
  
   The problem I'm running into is that PropertyResolverImpl.setValue
   checks to see if the bean is an instance of Map and if so, calls 
   put(property, value).  So instead of calling MyMap.setMyDependency, it
   is calling MyMap.put and passing the key = myDependency and the
   value = #{someOtherBean}.
  
   Any suggestions? 
  
   Thanks,
   Michael
  
 



Re: commandLink with action inside Table

2005-09-15 Thread Mike Kienenberger
Take a look at this thread for both a discussion on the situation and
solutions.  Note that the earlier part of the thread didn't address
the real issue, so I started you somewhere in the middle.

http://mail-archives.apache.org/mod_mbox/myfaces-users/200509.mbox/[EMAIL 
PROTECTED]

Rick was going to write a wiki entry on the situation, but I don't
think he's done so yet.

Basically, you need to preserve the value of rendered to the next request.
Using the t:saveState component is one way to do this.

On 9/15/05, Christian Froelich [EMAIL PROTECTED] wrote:
 Hello,
 
 YES, the action is executed if I remove the rendered attribute...
 BUT I need this attribute. You know this Problem or a solution??
 
 Best Regards,
 
 Christian
 
  --- Ursprüngliche Nachricht ---
  Von: Rick Reumann [EMAIL PROTECTED]
  An: MyFaces Discussion users@myfaces.apache.org
  Betreff: Re: commandLink with action inside Table
  Datum: Thu, 15 Sep 2005 11:36:08 -0400
 
  Does the action get executed if you remove the 'rendered' attribute?
 
  Christian Froelich wrote the following on 9/15/2005 9:00 AM:
   Thanks for your fast answer!
  
   My jsp looks like this:
  
   x:tree id=tree value=#{treeTable.treeModel}
   var=foo
   styleClass=tree3
   nodeClass=browserCol
   columnClasses=treeNode
   selectedNodeClass=treeNodeSelected
   expandRoot=true
  
 x:treeColumn rendered=#{foo.firstBoolean} id=treeColumn
...
 /x:treeColumn
  
 h:column id=columnBrowsTab1 rendered=#{foo.secondBoolean}
   h:commandLink
  action=#{listener.sort}
  immediate=true
  rendered=#{foo.obid == 'obid'}
  value=/h:commandLink
   h:outputText value=#{foo.secondColumn}
  rendered=#{foo.obid != 'obid' and !(foo.obid ==
  listener.obid)}/
   h:outputText  value=#{foo.secondColumn}
  rendered=#{(foo.obid == listener.obid)}
  styleClass=treeNodeSelected /
 /h:column
  
 ...other h:columns...
  
   /x:tree
  
   The commandLink is always rendered as link. And also the rest of the
   treeTable seems to get rendered correctly. But the action method is only
   executed if the tableBody is empty.
  
  
   Thanks and warm regards,
  
   Christian
  
  
  
  --- Ursprüngliche Nachricht ---
  Von: Mathias Brökelmann [EMAIL PROTECTED]
  An: MyFaces Discussion users@myfaces.apache.org
  Betreff: Re: commandLink with action inside Table
  Datum: Thu, 15 Sep 2005 14:01:53 +0200
  
  the action of the commandlink is only executed if the rendered flag
  for this and his parent component is true during the decode phase.
  
  Can you post the surrounding datatable tag also?
  
  2005/9/15, Christian Froelich [EMAIL PROTECTED]:
  
  Hello,
  
  I try to use a commandLink with an action inside a treeTable but it is
  not working properly  :-(
  The following snippet of a treeTable-column is expected to:
  - render a link if it 's the tableHead
  - render a outputText if it's a row inside the tableBody
  - render a outputText with a special style if it's selected
  
  h:column id=columnBrowsTab1 rendered=#{foo.secondBoolean}
  h:commandLink
 action=#{listener.sort}
 immediate=true
 rendered=#{foo.obid == 'obid'}XX/h:commandLink
  h:outputText value=#{foo.secondColumn}
 rendered=#{foo.obid != 'obid' and !(foo.obid == listener.obid)}/
  h:outputText  value=#{foo.secondColumn}
 rendered=#{(foo.obid == listener.obid)}
 styleClass=treeNodeSelected /
  /h:column
  
  The result so far looks good, but the ACTION method of the link gets
  only fired if the tableBody is empty.
  
  Any ideas to solve this problem???
  
   -  my backingBean has session scope
   -  I'm using the nightly build from 2005/09/12.
  
  Warm regards,
  
  Christian
  
  --
  Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
  Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
  
  
  
  --
  Mathias
  
  
  
 
 
  --
  Rick
 
 
 --
 Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
 Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner



PreserveDataModel behaviour (2)

2005-09-15 Thread Enrique Medina
Hi again,

I have investigated another interesting behaviour about using
PreserveDataModel, which makes my application crash (due to the way I'm
working with data tables). Let me explain it to you in a
straight-forward manner.

Currently, I use a session scoped bean to work with my objects (e.g.
one bean to work with customer objects, one bean to work with the
users, etc), due to the fact that I don't want to loose state between
requests (yes, I know it could have been done using
t:saveState...). So within all my session beans, I have defined
a ListDataModel variable that holds the data model that is presented to
the view every time the view is rendered (nothing strange here, I
guess).

>From my views (JSP), I simply use:

t:dataTable .. value=#{sessionScopedWhateverBean.listOfObjectsAsListDataModel} 

So whenever the view is rendered, the method public DataModel
getListOfObjectsAsListDataModel() in my session scoped bean is
invoked. Obviously, the first time it will be created, and the
subsequent calls simply will return the existing object. Everything's
fine here.

The problem comes when using PreserveDataModel because, as explained in
the wiki I posted about working with PreserveDataModel, every object in
my listOfObjectsAsListDataModel is added to a new ArrayList belonging
to a new _SerializedDataModel object, which is the object being really
serialized when saving the state by the JspStateManagerImpl. And why is
it the problem? Think about the future restoring phase...

When a link is clicked inside the data table to work with a particular
object, the event created as a consequence of the clicked link has
the information about the exact row which has been clicked
(specifically in its rowIndex attribute). Following, the state is
restored, and the previously serialized data model (as a
_SerializedDataModel object) is used to set the information about the
clicked row. What does this mean? It's as simple as this: the
clicked row information is set on the restored object, so it is
really set on the _SerializedDataModel object (nothing to be with our
original ListOfObjectsAsListDataModel object).

When afterwards the broadcast calls our action method (the one
associated with the link in the data table through usually an
HtmlCommandLink tag), our session scoped bean has the original
ListOfObjectsAsListDataModel object that was used to create the
_SerializedDataModel object when saving the state. But with a
definitive difference: the rowIndex from the event was set on the
_SerializedDataModel object, not the one we have here now, i.e. our
ListOfObjectsAsListDataModel object. And due to the fact that our
ListOfObjectsAsListDataModel was used to create the
_SerializedDataModel object, now it has its internal rowIndex attribute
set to the last row plus one (obviously, as the saveState method
iterates through the ListOfObjectsAsListDataModel list of objects to
populate the _SerializedDataModel list of objects).

At the end, the result is a call to setRowIndex(last row + 1), which
obviously does not exist, so a IllegalArgumentException: row is
unavailable is thrown. On the other hand, if I don't use
preserveDataModel, everything works perfectly, as the
ListOfObjectsAsListDataModel object is the one used to save the state
(not the _SerializedDataModel).

IMHO, the solution will be as simple as updating my
ListOfObjectsAsListDataModel object with the _SerializedDataModel
object when restoring the state. But I would like to hear the MyFaces'
team experts about this possibility before going deeper into the code.

Is it feasible? Is it possible to work with the preserveDataModel
together with a DataModel inside my bean and the getRowData() method?
Is the use od preserveDataModel incompatible with using the
getRowData() method inside my bean?

Looking forward to hearing your comments :-)


Re: Hibernate: 1-to-many -- struggling

2005-09-15 Thread Werner Punz

Yes that is a good place, and that is what I did
but there were another bunch of issues by
using that mapping type...
just posted a long explanation in the forum regarding
all the problems you run into with many-to-many


Joshua Davis wrote:

Werner,

Since you have data associated with your many-to-many, you can simplify this
by making an entity in the middle, transforming your many-to-many in to a
many-to-one, one-to-many from the ORMs perspective.

We can continue this discussion on the Hibernate forum, if you like.  I'd be
glad to help you out.

[EMAIL PROTECTED]



-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Werner Punz
Sent: Thursday, September 15, 2005 2:54 AM
To: users@myfaces.apache.org
Subject: Re: Hibernate: 1-to-many -- struggling

Well maybe the original guy did not use session.saveOrUpdate 
on the parent element...


I usually deal with 1:n which usually are far less 
problematic then m:n (which is the case where you usually 
sink 90% of the dev time banging your head and cursing 
hibernate left and right) is to have a 1:n rel, with a set 
mapping and to use cascade all with a save on the root element.

That has worked best.

The crux of hibernate is, you have so many ways to solve 
things for everything around 100 ways, but 90 of them fail 
with either no error or cryptic error messages once you have 
to apply them, while there still is a huge lack of best 
practices especially in the areas many-to-many and one-to-many


I will give an example:
Implicit mapping, not working if you have additional data in 
your many to many binding table, now how do you resolve that 
you can resolve it via an explicit binding object 
declaration, the doc is very vague on this approach,


you finally get it up and running, loading works, but 
deleting utterly fails with a cascade error, no real help in 
the forum, after banging your head for straight 8 hours you 
finally know why this happens, you delete the objects with an 
explicit delete and regenerate the binding objects, but the 
binding table does not have a surrogate, you do that within 
the same transaction.
What wouldnt pose a problem in straight JDBC because you 
clear the m:n elements out of the many to many table before 
setting them anew, causes hibernate to choke.
Solution, set the relational binding to lazy thus the objects 
do not get marked as deleted before loading the parent object 
and thus the setting works again.


It is cases like that, which are very commmon where all the 
documentation unfortunately utterly fails and where you can 
sink hours into hibernate.


Hibernate to my taste lacks a high level layer which resolves 
such cases automatically, some kind of
hibernatetool.resolveManyToManyBinding(BindingList) would 
have helped a lot in this case.


Before Hibernate 2 it also was the session handling which 
lacked those tools, that fortunately is resolved now.




Rafael Nami wrote:


I'm not an expert in this, but I think if you use another type of
collection, like a Set or a List, this behavior won't 


occur. I usually


use Sets to many to many and Lists to bidirecional relations.

Hope that it helps

Rafael Mauricio Nami

2005/9/12, Dave [EMAIL PROTECTED]:


I am struggling with Hibernate 1-to-many mapping(collection). 
Could someone tell me how to manage the collection of 


one-to-many mapping? a


little code will be very helpful.

I have a very simple one-to-many relationship: an Item has 


many Picture(s). 

ENTITY -- Item 
@... 
public class item { 
private Collection pictures; 
private Integer id; 

// getter/setter for id and @Id(...) 



@OneToMany(cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER,
mappedBy=item) 
public Collection getPictures() { 
return pictures; 
} 

public void setPictures(Collection pictures) { 
this.pictures = pictures; 
} 

public void addPicture(Picture p) { 

if (pictures == null) 
pictures = new ArrayList(); 
pictures.add(p); 

} 
} 

ENTITY Picture -- 
@  
public class Picture { 
private Item item; 
private Integer id; 

// constructor 
public Picture(Item item, ) { 
this.item = item; 
 
} 
// getter/setter for id and @Id(...) 

@ManyToOne 
@JoinColumn(name=itemId) 
public Item getItem() { 
return item; 
} 

public void setItem(Item item) { 
this.item = item; 
} 
} 

I create an Item in persistence without any pictures. Then 


use a session

bean to add pictures to the item. 

Session Bean -- 

@Stateless 
public class ItemManagerBean implements ItemManager { 

public void addPictureToItem(Item item, Picture p) { 
item.addPicture(p); 
em.merge(item); 
} 

} 

The merge() ignores those pictures that are already in persistence. 
Add picture P1: --- persistence: P1, ( great!) 
Add picture P2 --- persistence: P1, P1, P2 (P1 duplicated) 
Add picture P3 --- persistence: P1, P1, P2, P1, P2, P3 

Obviously, the merge() ignored what are already in 


persistence. All pictures

has Id. EM.merge() should be able to know P1 is already in 



Re: Boolean converter?

2005-09-15 Thread Ken Weiner
Yes, the issue in JIRA was http://issues.apache.org/jira/browse/MYFACES-451
You can get the source code from the MyFaces sandbox.On 9/14/05, Dennis Byrne [EMAIL PROTECTED] wrote:
I think he put it in JIRA. Original message Date: Wed, 14 Sep 2005 18:00:05 -0500
From: CONNER, BRENDAN \(SBCSI\) [EMAIL PROTECTED]Subject: Boolean converter?To: MyFaces Discussion 
users@myfaces.apache.orgI recall from one of the earlier postings that someone haddeveloped aboolean converter.Is that available?- BrendanDennis Byrne



Re: commandLink with action inside Table

2005-09-15 Thread Rick Reumann

Mike Kienenberger wrote the following on 9/15/2005 12:18 PM:

Take a look at this thread for both a discussion on the situation and
solutions.  Note that the earlier part of the thread didn't address
the real issue, so I started you somewhere in the middle.

http://mail-archives.apache.org/mod_mbox/myfaces-users/200509.mbox/[EMAIL 
PROTECTED]

Rick was going to write a wiki entry on the situation, but I don't
think he's done so yet.

Basically, you need to preserve the value of rendered to the next request.
Using the t:saveState component is one way to do this.


Yes, I am going to make a wiki entry this. The reason I didn't reply 
immediately is that he mentioned he was using session scope for his 
backing bean. I'm guessing now that both the foo bean and listener 
bean both aren't in session scope.


Christian, I'm guessing that listener is not being preserved so if you 
preserve listener or listener you should be all set:


t:saveState id=listener value=#{listener}/

(just perserving obid of listener should work also:
t:saveState id=obid value=#{listener.obid}/)

If foo isn't being preserved (I think you said it was in Session 
scope), you'll need to save that state also. I haven't looked into using 
t:saveState for more than one object though.


--
Rick


setting headers on the response in JSF

2005-09-15 Thread Ken Weiner
What is the best way to set headers on the HttpResponse to control things such as caching directives?

For example:
response.setHeader(Cache-Control, no-cache);

Would I need to implement a PhaseListener? Is this done through config
parameters of some kind? Should I just include a scriptlet in
each JSP page?

-Ken


Creating a Custom Component with other components inside...

2005-09-15 Thread gvial
Hi,

I'm looking at designing a simple component that would render the
following:

2 ListBoxes with items in each of them. Each being plugged on a
different List in the background.

I'm trying to figure out how to do that right now... I have created a
custom component that works but does not render my listboxes. The way I
saw this was that in my component's code, in encodeBegin, I could create
2 UISelectMany components and setting their parent to my component. 

Now be honest... Is this a horrible way to do things :p? The reason I'm
asking is because I'm trying to figure out if i can render this without
having to use the responsewriter to write HTML, ie by using another
component and calling its encodeBegin method so that later changes can
be repercuted in my component automatically.

Are there any examples of custom components that do this? I'm figuring I
could use the ResponseWriter and iterate through the ListBoxes' lists
etc... but I'm wondering if creaeting the components and setting their
required properties is possible.

Thanks a lot,

Greg


RE: Creating a Custom Component with other components inside...

2005-09-15 Thread Balaji Saranathan

I remember trying to learn custom components by creating a form builder
that will create a form from XML file.

What I did was to create a Label component and a HtmlInputText component
as to the number of properties specified and add Validators
accordingly.(Only regular Expression validator though). Add these
components to my component.
I did the above in encodeBegin(). In the encodeChildren(). Loop thru my
component and call the renderers of these children.

However, what I realised was I had a check at the start like this...
If(myComponent.getChildren().size == 0)
{
//Create the needed type of Uicomponents and add to
myComponent.getChildren().add()
}

I think this check was not needed...However, it was my test
component...so left it at that
To make the long story short, yes, you can do it the way you had
mentioned. Most of the composite components that aggregates components
like this, does that I guess.\

Hope this helps.
Regards
Balaji

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 2:19 PM
To: users@myfaces.apache.org
Subject: Creating a Custom Component with other components inside...


Hi,

I'm looking at designing a simple component that would render the
following:

2 ListBoxes with items in each of them. Each being plugged on a
different List in the background.

I'm trying to figure out how to do that right now... I have created a
custom component that works but does not render my listboxes. The way I
saw this was that in my component's code, in encodeBegin, I could create
2 UISelectMany components and setting their parent to my component. 

Now be honest... Is this a horrible way to do things :p? The reason I'm
asking is because I'm trying to figure out if i can render this without
having to use the responsewriter to write HTML, ie by using another
component and calling its encodeBegin method so that later changes can
be repercuted in my component automatically.

Are there any examples of custom components that do this? I'm figuring I
could use the ResponseWriter and iterate through the ListBoxes' lists
etc... but I'm wondering if creaeting the components and setting their
required properties is possible.

Thanks a lot,

Greg




Confidentiality Notice 

The information contained in this electronic message and any attachments to 
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or 
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.


t:columns resource bundle

2005-09-15 Thread Dave
When I use t:columns for variable number of columns in dataTable, I need to call getResourceBundle() from ViewRoot, and then call resoucebundle.getString("Label").In JSP, I just use "#{bundle.Label}". Is there any performance overhead? Is there a better way to display localized string from a backing bean such as for t:columns? I am trying to understand how JSP manage resource bundle? does JSF need to access disk everytime I call getResourceBundle() or everytime a page loads that declares a resouce bundle? or any cache going on? Thanks. Dave__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com 

[newbie] Forward to launch page

2005-09-15 Thread Robert Taylor
Greetings, I'm a current Struts user interested in learning and using 
MyFaces and JSF.


My dev. env. consists of Tomcat 5.5.9, MyFaces 1.0.9, JDK 1.4.2, Win2K.

I've configured MyFaces to use Tiles for view-handler.

What I want to do is to have my welcome page (index.jsp), forward to a 
launch page for the application.


In Struts, I would simply use a jsp:forward page=/app/launch/.
In my struts-config.xml file I has an action mapping for action 
path=/launch forward=launch.tile/ which forwarded to a tiles 
configuration which builds the page.


I'm trying to do something similar with JSF, but have been unsuccessful.
I removed the tiles complexity just to see if it would display a 
non-tiles .jsp. My wecome page consists of a single line:

jsp:forward page=/app/launch/.

My faces-context.xml file is as follows:

?xml version=1.0?

!DOCTYPE faces-config PUBLIC
  -//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN
  http://java.sun.com/dtd/web-facesconfig_1_0.dtd; 

faces-config

navigation-rule
from-view-id/launch/from-view-id
navigation-case
to-view-id/pages/launch.jsp/to-view-id
/navigation-case

/navigation-rule

/faces-config


I keep getting a 404 error. The HTTP request is for /test/app/launch, 
but the 404 error indicates it cannot find /test/launch.


The log files reflect the following:

2005-09-15 17:39:05,140 [http-8080-Processor24] DEBUG 
org.apache.myfaces.lifecycle.LifecycleImpl - entering restoreView in 
org.apache.myfaces.lifecycle.LifecycleImpl
2005-09-15 17:39:05,187 [http-8080-Processor24] DEBUG 
org.apache.myfaces.application.jsp.JspStateManagerImpl - No tree 
structure state found in client request
2005-09-15 17:39:05,234 [http-8080-Processor24] DEBUG 
org.apache.myfaces.application.jsp.JspViewHandlerImpl - Created view /launch
2005-09-15 17:39:05,312 [http-8080-Processor24] DEBUG 
org.apache.myfaces.util.DebugUtils - Newly created view


UIViewRoot id=NULL family=javax.faces.ViewRoot transient=false 
rendered=true rendererType=NULL locale=en rendersChildren=false 
renderKitId=HTML_BASIC viewId=/launch/



2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUG 
org.apache.myfaces.lifecycle.LifecycleImpl - exiting restoreView in 
org.apache.myfaces.lifecycle.LifecycleImpl (-- render response)
2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUG 
org.apache.myfaces.lifecycle.LifecycleImpl - entering renderResponse in 
org.apache.myfaces.lifecycle.LifecycleImpl
2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUG 
org.apache.myfaces.webapp.webxml.WebXmlParser - adding mapping for 
servlet + Faces Servlet urlpattern = /app/*
2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUG 
org.apache.myfaces.application.jsp.JspViewHandlerImpl - Dispatching to 
/launch
2005-09-15 17:39:05,468 [http-8080-Processor24] DEBUG 
org.apache.myfaces.util.DebugUtils - View after rendering


UIViewRoot id=NULL family=javax.faces.ViewRoot transient=false 
rendered=true rendererType=NULL locale=en rendersChildren=false 
renderKitId=HTML_BASIC viewId=/launch/



2005-09-15 17:39:05,468 [http-8080-Processor24] DEBUG 
org.apache.myfaces.lifecycle.LifecycleImpl - exiting renderResponse in 
org.apache.myfaces.lifecycle.LifecycleImpl



Any ideas, suggestions, RTFM, etc... would be helpful. I have read 
through the JSF spec. regarding the navigation and I still can't figure 
out what I have misconfigured. I even tried removing the 
from-view-id/launch/from-view-id altogether to make sure the 
navigaction-case/ would execute but still get the same error.


/robert






Validator for t:inputDate

2005-09-15 Thread CONNER, BRENDAN \(SBCSI\)
What format am I supposed to use to specify the value for the validator
attribute in t:inputDate?  I tried giving a string that contained the
fully qualified path name of the validator.  Then I tried using the id
of the validator given in faces-config.xml.  Neither of those appeared
to cause my validator to get invoked.

- Brendan


Re: Help your brothers and sisters- Suggestions for improving this JSF example

2005-09-15 Thread Werner Punz

Looks quite good,
but one thing struck me...
Your structure is very Struts like, which is not really needed.

extends AbstractViewController

you wont need that in JSF unless you have something really
important down there, which you have to reuse

also you wont need to think in actions and forms (beans)
like you do in struts, everything is a backing bean.
A divided MVC approach is very viable, but
you also can use a simplified combined model controller approach.
Sun uses this strategy in their studio creator
to enable a Visual basic like handling of the backend code.



Rick Reumann wrote:
Eventually I want to turn this small example into a walk through 
lesson/tutorial. Before I get to that point, I could really use the help 
of those that know what they are talking about to look over this example 
and provide suggestions on how to fix it up. Since I'm new to 
JSF/MyFaces, I'm sure there are some things that could be done better.


This won't be the final look and feel of the site, it's just for working 
through the suggestions and improvements on this example..


http://www.reumann.net/reumann/jsf/jsf_employees/

You can click on the source code of most of the files from the left menu 
frame or you could download the source, war, whatever.


Let's not put all those answers you gave to my noob questions go in vain:)





Re: Validator for t:inputDate

2005-09-15 Thread Mike Kienenberger
RTM :)

It's the validation method binding, not a validator.

To save you a trip, the signature is thus:

public void foo(FacesContext context, UIComponent component, Object
value) throws ValidatorException

but can be named whatever you like.



On 9/15/05, CONNER, BRENDAN (SBCSI) [EMAIL PROTECTED] wrote:
 What format am I supposed to use to specify the value for the validator
 attribute in t:inputDate?  I tried giving a string that contained the
 fully qualified path name of the validator.  Then I tried using the id
 of the validator given in faces-config.xml.  Neither of those appeared
 to cause my validator to get invoked.
 
 - Brendan



Re: Help your brothers and sisters- Suggestions for improving this JSF example

2005-09-15 Thread Werner Punz

Ah I just googled, the AbstractViewController is Shale,
that explains a lot ;-)...

Craig if you read this, I thought that one point of JSF was
to get rid of the Form-Action division of struts towards a more
generalized approach?
Does the AbstractViewController do something special in Shale or
is it simply a class to ease the transition from Struts
and enforce MVC?

Werner



Werner Punz wrote:

Looks quite good,
but one thing struck me...
Your structure is very Struts like, which is not really needed.

 extends AbstractViewController

you wont need that in JSF unless you have something really
important down there, which you have to reuse

also you wont need to think in actions and forms (beans)
like you do in struts, everything is a backing bean.
A divided MVC approach is very viable, but
you also can use a simplified combined model controller approach.
Sun uses this strategy in their studio creator
to enable a Visual basic like handling of the backend code.



Rick Reumann wrote:

Eventually I want to turn this small example into a walk through 
lesson/tutorial. Before I get to that point, I could really use the 
help of those that know what they are talking about to look over this 
example and provide suggestions on how to fix it up. Since I'm new to 
JSF/MyFaces, I'm sure there are some things that could be done better.


This won't be the final look and feel of the site, it's just for 
working through the suggestions and improvements on this example..


http://www.reumann.net/reumann/jsf/jsf_employees/

You can click on the source code of most of the files from the left 
menu frame or you could download the source, war, whatever.


Let's not put all those answers you gave to my noob questions go in 
vain:)









Re: [newbie] Forward to launch page

2005-09-15 Thread Thomas Spiegl
You could use a redirect instead. If you are using extension mapping *.jsf the following redirect should work.

%
response.sendRedirect(response.encodeRedirectURL(/pages/launch.jsf));
%
Thomas
On 9/16/05, Robert Taylor [EMAIL PROTECTED] wrote:
Greetings, I'm a current Struts user interested in learning and usingMyFaces and JSF.My dev. env. consists of Tomcat 5.5.9, MyFaces 1.0.9, JDK 1.4.2, Win2K.I've configured MyFaces to use Tiles for view-handler.
What I want to do is to have my welcome page (index.jsp), forward to alaunch page for the application.In Struts, I would simply use a jsp:forward page=/app/launch/.In my struts-config.xml
 file I has an action mapping for actionpath=/launch forward=launch.tile/ which forwarded to a tilesconfiguration which builds the page.I'm trying to do something similar with JSF, but have been unsuccessful.
I removed the tiles complexity just to see if it would display anon-tiles .jsp. My wecome page consists of a single line:jsp:forward page=/app/launch/.My faces-context.xml
 file is as follows:?xml version=1.0?!DOCTYPE faces-config PUBLIC -//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN 
http://java.sun.com/dtd/web-facesconfig_1_0.dtd faces-config navigation-rule from-view-id/launch/from-view-id navigation-case
 to-view-id/pages/launch.jsp/to-view-id /navigation-case /navigation-rule/faces-configI keep getting a 404 error. The HTTP request is for /test/app/launch,
but the 404 error indicates it cannot find /test/launch.The log files reflect the following:2005-09-15 17:39:05,140 [http-8080-Processor24] DEBUGorg.apache.myfaces.lifecycle.LifecycleImpl - entering restoreView in
org.apache.myfaces.lifecycle.LifecycleImpl2005-09-15 17:39:05,187 [http-8080-Processor24] DEBUGorg.apache.myfaces.application.jsp.JspStateManagerImpl - No treestructure state found in client request2005-09-15 17:39:05,234 [http-8080-Processor24] DEBUG
org.apache.myfaces.application.jsp.JspViewHandlerImpl - Created view /launch2005-09-15 17:39:05,312 [http-8080-Processor24] DEBUGorg.apache.myfaces.util.DebugUtils - Newly created view
UIViewRoot id=NULL family=javax.faces.ViewRoot transient=falserendered=true rendererType=NULL locale=en rendersChildren=false
renderKitId=HTML_BASIC viewId=/launch/2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUGorg.apache.myfaces.lifecycle.LifecycleImpl
 - exiting restoreView inorg.apache.myfaces.lifecycle.LifecycleImpl (-- render response)2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUGorg.apache.myfaces.lifecycle.LifecycleImpl - entering renderResponse in
org.apache.myfaces.lifecycle.LifecycleImpl2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUGorg.apache.myfaces.webapp.webxml.WebXmlParser - adding mapping forservlet + Faces Servlet urlpattern = /app/*
2005-09-15 17:39:05,359 [http-8080-Processor24] DEBUGorg.apache.myfaces.application.jsp.JspViewHandlerImpl - Dispatching to/launch2005-09-15 17:39:05,468 [http-8080-Processor24] DEBUGorg.apache.myfaces.util.DebugUtils
 - View after renderingUIViewRoot id=NULL family=javax.faces.ViewRoot transient=falserendered=true rendererType=NULL locale=en rendersChildren=false
renderKitId=HTML_BASIC viewId=/launch/2005-09-15 17:39:05,468 [http-8080-Processor24] DEBUGorg.apache.myfaces.lifecycle.LifecycleImpl
 - exiting renderResponse inorg.apache.myfaces.lifecycle.LifecycleImplAny ideas, suggestions, RTFM, etc... would be helpful. I have readthrough the JSF spec. regarding the navigation and I still can't figure
out what I have misconfigured. I even tried removing thefrom-view-id/launch/from-view-id altogether to make sure thenavigaction-case/ would execute but still get the same error.
/robert


Re: setting headers on the response in JSF

2005-09-15 Thread Thomas Spiegl
If you don't want to implment a PhaseListener or a javax.servlet.Filter
for setting response headers, think about using MyFaces Tiles-Support.
You'd just need to define a scriptlet in one (maybe a few) JSP
templates.

Thomas
On 9/15/05, Ken Weiner [EMAIL PROTECTED] wrote:
What is the best way to set headers on the HttpResponse to control things such as caching directives?

For example:
response.setHeader(Cache-Control, no-cache);

Would I need to implement a PhaseListener? Is this done through config
parameters of some kind? Should I just include a scriptlet in
each JSP page?

-Ken




Re: UIComponent: Not serializable?

2005-09-15 Thread Thomas Spiegl
 see Adam Winer's comment on MYFACES-573:
http://issues.apache.org/jira/browse/MYFACES-573?page=comments#action_12329502


ThomasOn 9/15/05, Marios Kerkemezos [EMAIL PROTECTED] wrote:
Hello everyone!I have the following question, which I still haven'tanswered...I have a simple MyFaces test application consisting ofa small number of pages and an equal number of backingbeans deployed on Tomcat 
5.0.28. All my beans inheritfrom some base class which implementsjava.io.Serializable and some of them containUIComponent subclasses as properties which are usedfor component bindings (e.g. private UIData
tableComponent; private UIOutput labelComponent;).I've noticed that when I stop and restart myapplication from Tomcat Manager I get aNotSerializableException for the beans that containcomponent binding properties (
e.g.java.io.NotSerializableException:org.apache.myfaces.component.html.ext.HtmlDataTable )Everything else "seems" to be working ok, but I guessthis exception isn't normal. Any ideas on what I might
be overlooking?Any help appreciatedMario___Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com


Re: Help your brothers and sisters- Suggestions for improving this JSF example

2005-09-15 Thread rick.reumann
I believe it's needed in order to get the various methods called within the JSF life-cycle... such as the use of prerender.

>From the Shale http://struts.apache.org/shale/features.html#view

Each backing bean that implements ViewController will
support a boolean property postback, which will be set to
true if this view is the one that is processing a form
submit previously rendered by the same page, or false if
this view was newly navigated to.  The property will be set before any
of the lifecycle methods described below are called, so that application
logic may perform conditional tasks based on this state.



As part of the standard JavaServer Faces managed beans processing, any
managed-property elements in the configuration
file, that are nested inside the managed-bean
element for this backing bean, will also be processed when a new bean
instance is created.  You can use either literal values or value binding
expressions to customize properties on your backing bean class.  Fans
of Dependency Injection will see that the managed beans facility
provides support for such a framework, using Setter Injection as the
mechanism for injecting dependencies.
In addition, the following lifecycle events are called, by the
framework, at certain points in the JavaServer Faces request processing
lifecycle:




init() - Called immediately after the view that
this backing bean is associated with is created.  (Technically, it
happens when ViewManager.createView() is called.)
For a postback, this happens during the Restore View
phase of the request processing lifecycle, once it ha been
determined which view should be restored.  If your application
navigates from one page to another, the init() method
of the second page will be called as part of the
NavigationHandler.handleNavigation() processing.

  Use this method to acquire resources that you will need, no
  matter whether this is a postback request, a rendering request,
  or both.


preprocess() - Called after the Restore View
phase has been completed, but before Apply Request Values
phase starts, only for the view that will be
processing the postback.

  Use this method to acquire resources (such as database connections)
  that you will need to process the postback.


prerender() - Called immediately before the
Render Response phase that actually causes the view to
be rendered.  This method will only be called for
the view that is actually rendered (the current view if you are
redisplaying, or the new view if you perform navigation).

  Use this method to acquire resources (such as database connections,
  or performing queries) that you will need if this view is the one
  to be rendered.  NOTE - when portlet support is integrated, all of
  the portlets on the current page will receive this event.


destroy() - If init() was ever called
for a ViewController, then it is guaranteed that
destroy() will be called as well.

  Use this method to release any resources acquired during an earlier
  event handler.


On 9/15/05, Werner Punz [EMAIL PROTECTED] wrote:
Ah I just googled, the AbstractViewController is Shale,that explains a lot ;-)...Craig if you read this, I thought that one point of JSF wasto get rid of the Form-Action division of struts towards a more
generalized approach?Does the AbstractViewController do something special in Shale oris it simply a class to ease the transition from Strutsand enforce MVC?WernerWerner Punz wrote: Looks quite good,
 but one thing struck me... Your structure is very Struts like, which is not really needed.extends AbstractViewController you wont need that in JSF unless you have something really
 important down there, which you have to reuse also you wont need to think in actions and forms (beans) like you do in struts, everything is a backing bean. A divided MVC approach is very viable, but
 you also can use a simplified combined model controller approach. Sun uses this strategy in their studio creator to enable a Visual basic like handling of the backend code.
 Rick Reumann wrote: Eventually I want to turn this small example into a walk through lesson/tutorial. Before I get to that point, I could really use the help of those that know what they are talking about to look over this
 example and provide suggestions on how to fix it up. Since I'm new to JSF/MyFaces, I'm sure there are some things that could be done better. This won't be the final look and feel of the 

Navigation Panel Question

2005-09-15 Thread James Reynolds



Hello 
all,

I just noticed a 
problem with my navigation panel. I have a top level "home" link that 
takes the user to the index page. If I use the component to browse to a 
link in a lower directory, then click the home link, the page renders without 
any style information. It's as if the style sheet fails to load. If 
I click it again, everything reverts to normal and life is good again. Has 
anyone else encountered this?

Thanks!


Re: Navigation Panel Question

2005-09-15 Thread Jesse
Could be to do with your browser trying to load your link'ed css 
resource from a location that is relative to the page's location in your 
web-app.  That's why it works at the top level and not at any lower level.


As a test, trying including a base tag in your htmlhead section in 
the lower-level page.


Although it's probably not what you want to do in the long run, you 
could try pasting in something like this:


base href=%=request.getScheme() + :// + request.getLocalName() + 
: + request.getLocalPort() + request.getContextPath() + /test.htm %


If it starts working, at least you know the problem :)

-Jess.


James Reynolds wrote:

Hello all,
 
I just noticed a problem with my navigation panel.  I have a top level 
home link that takes the user to the index page.  If I use the 
component to browse to a link in a lower directory, then click the home 
link, the page renders without any style information.  It's as if the 
style sheet fails to load.  If I click it again, everything reverts to 
normal and life is good again.  Has anyone else encountered this?
 
Thanks!


RE: Navigation Panel Question

2005-09-15 Thread James Reynolds

Yeah, that is definitely what's going on.  Thanks a ton!

JR 

-Original Message-
From: Jesse [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 8:28 PM
To: MyFaces Discussion
Subject: Re: Navigation Panel Question

Could be to do with your browser trying to load your link'ed css
resource from a location that is relative to the page's location in your
web-app.  That's why it works at the top level and not at any lower
level.

As a test, trying including a base tag in your htmlhead section in
the lower-level page.

Although it's probably not what you want to do in the long run, you
could try pasting in something like this:

base href=%=request.getScheme() + :// + request.getLocalName() +
: + request.getLocalPort() + request.getContextPath() + /test.htm
%

If it starts working, at least you know the problem :)

-Jess.


James Reynolds wrote:
 Hello all,
  
 I just noticed a problem with my navigation panel.  I have a top level

 home link that takes the user to the index page.  If I use the 
 component to browse to a link in a lower directory, then click the 
 home link, the page renders without any style information.  It's as if

 the style sheet fails to load.  If I click it again, everything 
 reverts to normal and life is good again.  Has anyone else encountered
this?
  
 Thanks!



t:columns data conversion

2005-09-15 Thread Dave
Previously I used h:column with dataTable, data conversionwas done by JSF between String/Integer, String/BigDecimal. When I changed it to use t:columns for variable number of columns, I got error.
Cannot set value for _expression_ '#{backingBean.columnValue}' to a new value of type java.lang.String

In the backing bean:
public Object getColumnValue();
public void setColumnValue(Object value);

The value passed into setColumnValue() is always String.
t:dataTable does not keep track of data type for each column and then convert data automatically. So I need to make data conversion in setColumnValue(Object value) for all columns.

Am I correct? Thanks! Dave__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com