| Author |
Message |
|
|
The tutorial, as I remember it, was directly accessible from the ICEfaces web page, i.e. some of the introduction material or some such.
Sorry about not being more precise and for not putting the link on my reply in the first case. This project with us has long since been obsolete, and we have re-written the application (not in ICEfaces, alas).
I guess, since facelets support seem to exclude jsp support this approach would not really work after all. If you want a mixture, you would probably have to use jsp pages throughout - some with old-style jsp and some with ICEfaces tags.
|
 |
|
|
Spent some time trying to work around the problem, and thought I would share my solution.
I add a menu helper object to my java code, which builds List<SelectItem> for the f:selectItems tag. And a converter that will run through the list of SelectItems using the String value and pick the correct SelectItem.getValue() as the converted result:
Code:
class MenuHelper {
private ModelBean modelBean; // bind this to the underlying application model object in faces-config.xml
public List<SelectItems> getSelectItems() {
List<SelectItems> result = ...;
for (ModelObject m : modelBean.getAllValues())
result.add(new SelectItem(m.getStringRepresentation(), m));
return result;
}
public Converter getConverter() {
return new Converter() {
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
for (SelectItem si : getSelectItems())
if (si.getLabel().equals(arg2))
return si.getValue();
throw new IllegalArgumentException("Item not found: " + arg2);
}
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
for (SelectItem si : getSelectItems())
if (si.getValue().equals(arg2))
return si.getLabel();
throw new IllegalArgumentException("Item not found: " + arg2);
}
};
}
}
It is in effect completely generic code, which might as well be the standard implementation of the selectOneMenu. As it stands, this generic code will have to be duplicated every time I need a selectOneMenu where the menu items are really objects in the application model.
Come to think of it, this may even be a faces pattern.
Best regards,
Jacob.
|
 |
|
|
Hi.
Although this is an old post, I decided to follow up. I have this exact problem, and am really at my wits' end trying to understand the reasoning behind this design decision.
After all, building the selectOneMenu I have code that dynamically creates the <f:selectItems ...> (Java List<SelectItems>). These objects contain a string representation of the menu choice AND the model object that the menu choice represents. Thus, it makes perfectly sense to use that model object in the the value="#{....}" of the selectOneMenu. It specifically does NOT make sense to use the string representation sent through a converter.
Why else do we need the SelectItem? Why does the SelectItem class have both a setValue(Object o) and a setLabel(String s) methods?
When (if ever) does the corresponding getValue() on the SelectItem objects get called?
Or, put in another way: There already is a trivial converter defined in the SelectItems: If you want the model object, use getValue(). If you want the String representaion, use getLabel() method. No converters needed, they are already there!
Best regards,
Jacob.
|
 |
|
|
Following up on my own question - solved.
It turns out I accidentally copied the style sheets into my source code directory from a previous version of Icefaces.
When I tried to change to "Rime" style, everything works beatifully. So I guess I'll have to grab the style sheets from the correct versio of icefaces (no wonder), and try again.
Jacob.
|
 |
|
|
Hi.
I am new to Icefaces. Great framework. Using Netbeans 6.5.1 and Glassfish v2ur2, Icefaces 1.8.0. All on ubuntu linux and firefox browser.
I am trying do get the dataTable and rowSelector to work.
Copy/Pasting from the component showcase:
<ice:dataTable id="dataTable_nxPxerf" var="item"
value="#{nxPerformanceBean.rowDataModel}"
scrollable="false"
title="NX Linie Top-liste">
<ice:column>
<ice:rowSelector id="selector" value="#{item.selected}"
multiple="true" enhancedMultiple="true"
selectionListener="#{nxPerformanceBean.rowSelectionListener}"
preStyleOnSelection="true"/>
<f:facet name="header">
<ice:outputText value="NX Linie"/>
...
My rowSelectionListener loops through the item list and prints any selected rows.
I have no end of problems with the GUI part. The internal state row selector state seems to work ok somewhat. At least: when I click ONE row, my rowSelectionListener prints that row. When I use "Shift" + Click, my rowSelectionListener prints a row range. Ctrl+click does nothing.
The GUI, however does not keep up to date with the state: The rows I click on are highlighted, but never un-highlighted.
Is this a problem with Glassfish/Netbeans or am I doing something wrong?
I tried other combinations (multiple="false", enhancedMultiple="false", use Internet explorer) with the same strange results. Removing preStyleOnSelection simply disables any visible state change to the selected rows).
Regards,
Jacob.
|
 |
|
|
Thanks for your suggestion, I can see how that would work. Unfortunately I had forgotten that the JSP files need to be in xml syntax, and they are not. So I guess I am stuck with rewriting the application on a page by page basis. Oh well, it's about time anyway.
mkat wrote:
What I did in my project, so that I could use Facelets to run both ICEfaces and .jsp pages not using facelets or even not Icefaces was to set the facelets DEFAULT_SUFFIX to .jsp.
Code:
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>
That way, I am using .jsp pages as templates for other .jsp pages.
|
 |
|
|
Does that mean that it is impossible to have some pages as facelets and some pages as jsp?
I would like to have both: To migrate a jsp based application to icefaces.
I would have some pages being jsp pages with icefaces components (saw the tutorial). But I would like those pages, that will be complete rewritten to be facelet pages. Impossible?
philip.breau wrote:
Facelets is a replacement for JSP and the JSP compiler. So they're mutually exclusive.
Philip
|
 |
|
|
Hi,
I am in a situation where we have an old-style JSP based web application---all html and java code in one big mess. I want to move that gradually into ICEfaces. I followed the tutorial on your web site.
To ease integration, and get the best of all worlds, I would like to leave some pages untouched (i.e. old style JSP files with no icefaces components), some pages fully migrated to icefaces using facelets (.xhtml), and some pages using a mixture---i.e. replacing one or two components with a more live icefaces component, but otherwise leaving the JSP page as is.
Would such a construct be possible?
Thanks
Jacob
|
 |
|
|
Using firefox on ubuntu linux (32bit), the presentation downloads but does not start. Is there a more portable version available?
Thanks
Jacob
|
 |
|
|