updateActionListener within tree2

2006-07-11 Thread giannidoe
I'm new to MyFaces and having some problems using updateActionListener inside a 
tree2,  I get Action listener for property is not present when clicking the 
commandButton.

MyFaces 1.1.3 + Tomahawk 1.1.3 + Facelets + updateActionListener tag handler 
from Wiki

 2006-07-11 10:04:28,379 DEBUG http-8180-Processor20 
com.myapp.util.TomahawkUpdateActionListenerHandler - Apply called. Component: 
[EMAIL PROTECTED]
 2006-07-11 10:04:28,379 DEBUG http-8180-Processor20 
com.myapp.util.TomahawkUpdateActionListenerHandler - Action listener for 
property is not present. Property: #{patientEvent.currentEvent}

The same updateActionListener works fine within a t:dataTable.

I've looked around and can't find any mention of this specific problem, does 
any know of any issues?
I'd appreciate some pointers.
Thanks
Gianni


t:tree2 id=historyTree
  value=#{patientEvent.historyTreeModel}
  showRootNode=false
  var=node
  varNodeToggler=t
  clientSideToggle=true 
  f:facet name=top
h:panelGroup
  h:outputText value=#{node.description}/
/h:panelGroup
  /f:facet
  f:facet name=diagnosis
h:panelGroup
  h:outputText value=#{node.description}/

  t:commandButton type=submit 
action=#{patientEvent.addNewSecondaryEvent}
value=#{msgs['label.patient-event.add-new']}
t:updateActionListener property=#{patientEvent.currentEvent}
  value=#{node.visit} /
  /t:commandButton
/h:panelGroup
  /f:facet
/t:tree2


selectManyListbox custom converter toString() problem

2006-05-10 Thread giannidoe
I'm having some trouble using a selectManyListbox with a custom  
converter.
My select items are composed of an object value and string label as  
follows:


LookupItem item = ...  // simple lookup - integer values and a  
description label.

String label = item.getLabel(locale);
SelectItem selectItem = new SelectItem(item,label);
...
CollectionSelectItem lookupItems = new ArrayListSelectItem();
...

Selected values in the backing bean are held in an ArrayList.

t:selectManyListbox
value=#{mybean.selectedItems}
size=30 
f:selectItems value=#{mybean.lookupItems } /
f:converter
  converterId=com.mydomain.MyConverter /
/t:selectManyListbox

I've written a custom converter which works fine if I use it with a  
SelectOne.. type component but when I try it with a SelectMany..  
getAsString() is passed a String value containing the selected value  
instead of a LookupItem object.


public String getAsString(FacesContext facesContext, UIComponent  
component, Object value)

throws ConverterException {
if (value != null) {
return ((LookupItem) value).getCode().toString();
}
return null;
}

 java.lang.ClassCastException: java.lang.String
at com.mydomain.MyConverter.getAsString(Unknown Source)

Maybe I'm missing something but I expected getAsString() to be passed  
the converted LookupItem object.

I'd appreciate some help.
-Gianni


Date output and timezone

2006-04-29 Thread giannidoe
I would appreciate some suggestions for the handing of dates:
I'm using Tomahawk t:inputDate .../ to collect a person's date of birth in a 
backing bean variable of type Date.
When I subsequently view the date using a simple h:outputText ../ it displays 
the original date minus 1 day, even though the Date variable is set correctly.
For example I enter 01-Jan-1965  and outputText displays 31-Dec-1964.

I'm not using any converters and I assume that the default converter is taking 
in to account my timezone, I'm on CET (GMT+1), and calculating 01-Jan-1965 
00:00:00 minus 1 hour to display the GMT time (correct?).

The application is going to be accessed from different timezones but the date 
display must be exactly as entered.
What would be the easiest/cleanest way to get around this problem?
I guess I could dynamically set f:convertDateTime 
timeZone=#{User.timeZone}/ to the user's timezone but I'd rather the date 
was simply treated as a Date without any time and timezone.

Gianni


dataTable master/detail getRowData() - help needed

2006-04-21 Thread giannidoe
I'm trying to implement a master-detail type scenario where a search  
is performed to populate a dataTable with a list of users, the user  
name can then be clicked to view the details.


The method I am attempting to use is described on the Myfaces Wiki -
3) Getting handle to DataModel Row
http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters

When I have my managed bean set to session scope it all works fine,  
the only problem is that I don't want it in the session scope, once  
set to request scope the userDetails method does not get fired when I  
click on the commandLink, I simply get bumped back to the original  
view with a blank data table.


I have tried using t:saveState/ but I get an error as  
org.apache.myfaces.component.html.ext.HtmlDataTable is not serializable.


Relevant code:

  managed-bean
  managed-bean-nameuserAdmin/managed-bean-name
  managed-bean-classcom.mydomain.view.bean.UserAdminBean/ 
managed-bean-class

  managed-bean-scoperequest/managed-bean-scope
  /managed-bean

users.xhtml
..
t:dataTable
  value=#{userAdmin.foundUsers} var=user
  binding=#{userAdmin.userTable}
  rendered=#{userAdmin.displayResults}
  preserveDataModel=true
  h:column id=col1
f:facet name=header
  h:outputText value=#{msgs['label.user.id']} /
/f:facet
t:commandLink action=#{userAdmin.userDetails}
  value=#{user.userId} /
  /h:column
/t:dataTable


UserAdminBean.java
...
private UIData userTable;
...
public String userDetails()
   User appUser = (User) userTable.getRowData();
   getApplication().createValueBinding(#{appUser}).setValue 
(getFacesContext(), appUser);

   return Constants.SUCCESS;
}

One thing particularly puzzling me is why the userDetails() method  
does not get fired at all when clicking the commandLink.
Being new to JSF it's probably my lack of understanding of the  
lifecycle but I'd appreciate some pointers as to how other people  
have solved this problem without resorting to placing the dataTable  
in the session scope.


Regards
Gianni



inputDate JavaScript generation problem

2005-09-07 Thread giannidoe

Hi
I've got a newbie question regarding components and JavaScript  
generation.


I'm using t:inputDate with popupCalendar=true but when I click the  
button to display the popup calendar nothing happens, this is because  
the necessary JavaScript link tags are not present in the page.
When I run the MyFaces examples for the date input component it works  
perfectly and the links to the JavaScript and CSS are in the page  
header.


As far as I can tell from the example these links should be auto- 
generated by the component or maybe I'm missing something obvious?


Suggestions appreciated.
Thanks
Gianni

PS. I've got org.apache.myfaces.ALLOW_JAVASCRIPT set to 'true'


Re: inputDate JavaScript generation problem

2005-09-07 Thread giannidoe

Excellent it's working now, many thanks for the quick response.
I thought I was missing something obvious :)
-Gianni


On 07/set/05, at 13:18, Bruno Aranda wrote:


You have to include the extensions filter in the web.xml:

[CODE]

 !-- Extensions Filter --
filter
filter-nameextensionsFilter/filter-name
filter- 
classorg.apache.myfaces.component.html.util.ExtensionsFilter/ 
filter-class

init-param
param-nameuploadMaxFileSize/param-name
param-value100m/param-value
descriptionSet the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
/description
/init-param
init-param
param-nameuploadThresholdSize/param-name
param-value100k/param-value
descriptionSet the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.

Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
/description
/init-param
!--init-param
param-nameuploadRepositoryPath/param-name
param-value/temp/param-value
descriptionSet the path where the intermediary files
will be stored.
/description
/init-param--
/filter

filter-mapping
filter-nameextensionsFilter/filter-name
url-pattern*.jsf/url-pattern
/filter-mapping
filter-mapping
filter-nameextensionsFilter/filter-name
url-pattern/faces/*/url-pattern
/filter-mapping

[/CODE]

Regards,

Bruno

2005/9/7, [EMAIL PROTECTED] [EMAIL PROTECTED]:


Hi
I've got a newbie question regarding components and JavaScript
generation.

I'm using t:inputDate with popupCalendar=true but when I click the
button to display the popup calendar nothing happens, this is because
the necessary JavaScript link tags are not present in the page.
When I run the MyFaces examples for the date input component it works
perfectly and the links to the JavaScript and CSS are in the page
header.

As far as I can tell from the example these links should be auto-
generated by the component or maybe I'm missing something obvious?

Suggestions appreciated.
Thanks
Gianni

PS. I've got org.apache.myfaces.ALLOW_JAVASCRIPT set to 'true'







Re: TR : Dynamic Locale change

2005-08-26 Thread giannidoe
I suggest you take a look at the list archives for Maintain locale  
across views.
I had a similar issue and it seems the locale is not maintained  
across views when a redirect/ is used.
In the end I set f:view locale=#{visit.locale}, where visit is a  
session scoped bean.

Gianni





Sorry for asking so much questions but I'll have to present my  
webapp very soon and I need the multi-language to works fine.
Has anybody any idea ? Why the locale is reset to the default  
one ? Could it comes from a redirect/ instruction in my faces- 
config.xml ?

 Ty for your help :D
Clément
 -Message d'origine-
*De :* Clément Maignien
*Envoyé :* lundi 22 août 2005 18:18
*À :* MyFaces Discussion
*Objet :* Dynamic Locale change
Hi,
I'm trying to allow the application user to change the language of  
my web app.
I did it the way it is done in the myFaces 1.0.9 examples : a  
selectOneMenu with a choice of languages and an action button with  
that code :

 OptionBean {
...
public String action {
...
FacesUtil.setLocale(selectedLocale);
...
}
...
}
 FacesUtil {
...
public static void setLocale(Locale l) {
FacesContext.getCurrentInstance().getFacesContext().getViewRoot 
().setLocale(l);

}
 ...
}
  It works fine when the action is executed (the language change),  
but as soon as I navigate to another page of the App, the language  
is resetted to the default one. Why ?
  NB : I'm trying not to use the /locale/ parameter of the / 
f:view/ tag ...

 Thx,
Clément.








Maintain locale across views

2005-07-11 Thread giannidoe
I'm starting out with JSF and I'd appreciate some clarification  
regarding internationalization:


I'm using a select menu and backing bean to call setLocale() on the  
current view, this works fine and I can change the locale of the view  
in question. But when I navigate to another view the locale reverts  
back to the browser default.

Is this correct behavior?
Do I need to set the locale myself on a per-view basis or should JSF  
maintain the locale between views?


If this is the case then I guess I need to store the view's local in  
the session and use this to set the locale for subsequent views.  
Where and how would be the best way to do this in terms of the JSF  
lifecycle?


I also have tiles in the mix using MyFaces JspTilesViewHandlerImpl,  
does this have any implications for how I need to handle  
internationalization?


Thanks
Gianni


Re: Maintain locale across views

2005-07-11 Thread giannidoe
I tried with the RI and was still getting the same issue then I  
realised it may be something to do with the fact I was using  
redirect/ in the navigation rule.
If I take out the redirect/ then the locale is maintained across  
views, with redirect it's not.


Thanks
Gianni


On 11/lug/05, at 18:28, Craig McClanahan wrote:


On 7/11/05, Daniel Zwink [EMAIL PROTECTED] wrote:


Hi,



I'm using a select menu and backing bean to call setLocale() on the
current view, this works fine and I can change the locale of the  
view

in question. But when I navigate to another view the locale reverts
back to the browser default.
Is this correct behavior?



AFAIK yes.




Actually, that is *not* correct, for requests after the initial one
(where the browser's accept-language header is used to set the default
if the app doesn't do it).

Details are in the JSF spec, section 2.2.1, but the basic idea is
that, if you are already in a flow of views managed by JSF, *and* if a
locale has been established, it should also be carried forward to any
created view -- the app should not have to do this manually on every
view.  The RI does it this way, by the way.

Craig





Re: Tiles subview mixing html and jsf

2005-07-07 Thread giannidoe

Thanks for the responses.

I got around it in the end by using this library:
http://jsftutorials.net/htmLib/

I would have liked to use plain html mixed with the jsf but it seems  
that there is simply no practical way to do this in a subview using  
the jsp xml syntax.


Gianni


On 06/lug/05, at 21:49, Martin Marinschek wrote:


Yes, that is the reason...

of course, in XML the syntax needs to be followed correctly, and you
cannot have opening tags without an according closing tag.

Sylvain proposed to have an html tag which would render out the
provided html code out - is this already included? If yes, you could
use this approach...

Additionally, my last suggestion should also work.

regards,

Martin

On 7/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Yep standard Tomcat 5.5.9

Could the fact I'm using xml syntax for the pages have something to
do with it?
Here are the relevant files:

--- topLayout.jsp 

jsp:root version=2.0
   xmlns:jsp=http://java.sun.com/JSP/Page;
   xmlns:f=http://java.sun.com/jsf/core;
   xmlns:h=http://java.sun.com/jsf/html;
   xmlns:x=http://myfaces.apache.org/extensions;
   xmlns:tiles=http://jakarta.apache.org/struts/tags-tiles;
   f:view

 jsp:output doctype-root-element=html
doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN
doctype-system=http://www.w3c.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd/
 jsp:directive.page contentType=text/html  
pageEncoding=UTF-8/

 html xmlns=http://www.w3.org/1999/xhtml;
---cut---
   x:div forceId=true id=page-footer
 f:subview id=footer
   tiles:insert definition=page.footer flush=false/
 /f:subview
   /x:div
---cut---
   /body
 /html
   /f:view
/jsp:root

--- END topLayout.jsp 


--- footer.jsp 

jsp:root version=2.0
   xmlns:jsp=http://java.sun.com/JSP/Page;
   xmlns:f=http://java.sun.com/jsf/core;
   xmlns:h=http://java.sun.com/jsf/html;
   xmlns:x=http://myfaces.apache.org/extensions;






f:verbatim
h4
/f:verbatim
h:outputText value=My heading/
f:verbatim
/h4
/f:verbatim

/jsp:root

--- END footer.jsp 


Thanks
Gianni



On 06/lug/05, at 21:33, Martin Marinschek wrote:



Sorry, I looked only at the first part...

my fault..

strange, I am always mixing content like that - never had a problem
so far.

are you using a standard tomcat server?

regards,

Martin

On 7/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



As explained in my original post I've already tried that and I get:

org.apache.jasper.JasperException: /WEB-INF/templates/footer.jsp
(10,3)
The element type h4 must be terminated by the matching end-tag  
/

h4.

In fact this is what I assumed should work as I have seen other
examples using this format.

Gianni


On 06/lug/05, at 21:14, Martin Marinschek wrote:




do that:

f:verbatim
h4
/f:verbatim
h:outputText value=My heading/
f:verbatim
/h4
/f:verbatim

and you should be all set!

regards,

Martin

p.s.: variant: do what bruno told you, but do not use the h4 in
the
attribute directly, but get the value from a backing bean with a
valuebinding.


On 7/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:




Sorry my response got truncated, the full error is :

org.apache.jasper.JasperException: /WEB-INF/templates/footer.jsp
(8,22) The value of attribute value associated with an element
type
h:outputText must not contain the '' character.

Gianni


On 06/lug/05, at 19:35, [EMAIL PROTECTED] wrote:





I get an error:

[ServletException in:/WEB-INF/templates/footer.jsp] /WEB-INF/
templates/footer.jsp(8,22)
The value of attribute value associated with an element type
h:outputText must not contain the '


On 06/lug/05, at 19:29, Bruno Aranda wrote:






And if you do this?

h:outputText value=h4My heading/h4 escape=false/

Regards,

Bruno

2005/7/6, [EMAIL PROTECTED] [EMAIL PROTECTED]:






Hi
I'm trying to use a combination of html and jsf in a tiles
included
subview.
This isn't the actual code but serves to illustrate the  
problem.


If I do this:

f:verbatim
h4
h:outputText value=My heading/
/h4
/f:verbatim

the jsf output appears before the html:

My headingh4/h4

However if I do this:

f:verbatimh4/f:verbatim
h:outputText value=My heading/
f:verbatim/h4/f:verbatim

I get a mismatched tag exception:

[ServletException in:/WEB-INF/templates/footer.jsp] /WEB-INF/
templates/footer.jsp(9,19)
The element type h4 must be terminated by the matching end-
tag 

I appreciate some suggestions it's really driving me crazy, I
need to
mix html and jsf but can find no practical way of doing so.
Thanks
Gianni










































Tiles subview mixing html and jsf

2005-07-06 Thread giannidoe

Hi
I'm trying to use a combination of html and jsf in a tiles included  
subview.

This isn't the actual code but serves to illustrate the problem.

If I do this:

f:verbatim
h4
h:outputText value=My heading/
/h4
/f:verbatim

the jsf output appears before the html:

My headingh4/h4

However if I do this:

f:verbatimh4/f:verbatim
h:outputText value=My heading/
f:verbatim/h4/f:verbatim

I get a mismatched tag exception:

[ServletException in:/WEB-INF/templates/footer.jsp] /WEB-INF/ 
templates/footer.jsp(9,19)

The element type h4 must be terminated by the matching end-tag 

I appreciate some suggestions it's really driving me crazy, I need to  
mix html and jsf but can find no practical way of doing so.

Thanks
Gianni


Re: Tiles subview mixing html and jsf

2005-07-06 Thread giannidoe

I get an error:

[ServletException in:/WEB-INF/templates/footer.jsp] /WEB-INF/ 
templates/footer.jsp(8,22)
The value of attribute value associated with an element type  
h:outputText must not contain the '



On 06/lug/05, at 19:29, Bruno Aranda wrote:


And if you do this?

h:outputText value=h4My heading/h4 escape=false/

Regards,

Bruno

2005/7/6, [EMAIL PROTECTED] [EMAIL PROTECTED]:


Hi
I'm trying to use a combination of html and jsf in a tiles included
subview.
This isn't the actual code but serves to illustrate the problem.

If I do this:

f:verbatim
h4
h:outputText value=My heading/
/h4
/f:verbatim

the jsf output appears before the html:

My headingh4/h4

However if I do this:

f:verbatimh4/f:verbatim
h:outputText value=My heading/
f:verbatim/h4/f:verbatim

I get a mismatched tag exception:

[ServletException in:/WEB-INF/templates/footer.jsp] /WEB-INF/
templates/footer.jsp(9,19)
The element type h4 must be terminated by the matching end-tag 

I appreciate some suggestions it's really driving me crazy, I need to
mix html and jsf but can find no practical way of doing so.
Thanks
Gianni







Re: Tiles subview mixing html and jsf

2005-07-06 Thread giannidoe

Sorry my response got truncated, the full error is :

org.apache.jasper.JasperException: /WEB-INF/templates/footer.jsp 
(8,22) The value of attribute value associated with an element type  
h:outputText must not contain the '' character.


Gianni


On 06/lug/05, at 19:35, [EMAIL PROTECTED] wrote:


I get an error:

[ServletException in:/WEB-INF/templates/footer.jsp] /WEB-INF/ 
templates/footer.jsp(8,22)
The value of attribute value associated with an element type  
h:outputText must not contain the '



On 06/lug/05, at 19:29, Bruno Aranda wrote:



And if you do this?

h:outputText value=h4My heading/h4 escape=false/

Regards,

Bruno

2005/7/6, [EMAIL PROTECTED] [EMAIL PROTECTED]:



Hi
I'm trying to use a combination of html and jsf in a tiles included
subview.
This isn't the actual code but serves to illustrate the problem.

If I do this:

f:verbatim
h4
h:outputText value=My heading/
/h4
/f:verbatim

the jsf output appears before the html:

My headingh4/h4

However if I do this:

f:verbatimh4/f:verbatim
h:outputText value=My heading/
f:verbatim/h4/f:verbatim

I get a mismatched tag exception:

[ServletException in:/WEB-INF/templates/footer.jsp] /WEB-INF/
templates/footer.jsp(9,19)
The element type h4 must be terminated by the matching end-tag 

I appreciate some suggestions it's really driving me crazy, I  
need to

mix html and jsf but can find no practical way of doing so.
Thanks
Gianni