In that case case you have a non-faces request that generates a faces
response. You may implement a Servlet that calls the appropriate first
action. Tobago has a Servlet
NonFacesRequestServlet
that you can extend in this case. You have only to implement the method
public abstract String invokeApplication(FacesContext facesContext);
which returns the outcome. Create your model there.
There is one open issue with that servlet. Links point to it must be
prefixed with "/faces/" although the servlet mapping does not contain
that string. Otherwise the next page is not displayed. We consider this
a bug :-( Maybe you have an idea about this ;-)
Performance: I think there is no big difference if the model reference
is done by a getter or stored internal somehow else. As Simon stated the
different JSF-Phases need access to the model more than one time anyway.
Regards,
Pleff
Olexandr Zakordonskyy wrote:
Hi,
What action is executed if page is rendering for the 1 time?
May be it's not clear design, but I may say that 2 times call to getter is
performance loose. What about conflicts while rendering if bean is not
synchronized?
I don't think the pattern is more important than normal application
behavior.
Thanks,
Olexandr.
-----Original Message-----
From: Detlef Bartetzko [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 21, 2005 4:04 PM
To: MyFaces Discussion
Subject: Re: Tobago SheetRenderer calls getter for list twicely.
Hi,
in my opinion its not a good idea to create the model with a getter. The
getter should only present a reference to the model. The model itself
should be created explicitely in an action. This leads to a cleaner
design and makes the whole architecture easier to understand.
Yours,
Pleff
Detlef Bartetzko wrote:
Hi,
Bernd I think Simon just stated a common issue about faces. He was not
talking about the Tobago implementation... hit me if i am wrong.
Yours,
Pleff
Bernd Bohmann wrote:
Unfortunaly you don't read my description correctly or the subject.
In the render phase:
SheetRenderer is calling ListDataModel.setRowIndex
ListDataModel.setRowIndex is calling ListDataModel.getRowData
Then SheetRenderer is calling getRowData.
This means a double call for data.get(index)
Maybe data.get(index) is call three times
but i only analyse the render phase.
Bernd
Simon Kitching schrieb:
Hi,
All input components (including tables) call the getter at least twice.
They need to call the getter during the validation phase, in order
to know whether to generate ValueChanged events.
And then they need to call it again at the start of the following
render phase, because the value may have changed as a result of the
"update model" phase.
There's really no way to avoid either of these calls. Possibly
MyFaces could add a "noValueChanged" property on every component,
and users could set that to true if they don't care about getting
ValueChanged events for that component, so the validation step can
skip trying to compare the current value against the model.
Hmm..maybe the component could look to see if it has any
ValueChangeListeners attached, and not try to generate the event in
that case? I don't know if that's safe though; there might be other
ways to detect that event than a listener (eg an ancestor component
which overrides queueEvent). See method UIInput.validate for details.
If you are sure that your list will *not* change as a result of the
"update model" phase, then you could do this:
<code>
private transient DataModel myModel;
public DataModel getMyModel() {
if (myModel == null) {
// create the model, including fetching data
}
return myModel;
}
</code>
This way, you'll create the model during the validation phase (ie
when the components are trying to determine whether ValueChanged
events are needed or not) and use the same object during the
rendering phase. Of course, as described above, that assumes your
data won't change as a result of the "update model" phase.
Regards,
Simon
Bernd Bohmann wrote:
Tobago doesn't call getter for the list twice.
SheetRenderer is calling ListDataModel.setRowIndex
ListDataModel.setRowIndex is calling ListDataModel.getRowData
Then SheetRenderer is calling getRowData.
Maybe we can impove the implementation of ListDataModel.
(I think we should) :-)
Bernd
Dennis Byrne schrieb:
I don't think it's a good idea, because writing getter is more
logic.
Are you talking about actions and actionListeners?
Dennis Byrne
--
Dipl.-Inform. Detlef Bartetzko - Executive Officer - Atanion GmbH
Software Development - Bismarckstraße 13 - 26122 Oldenburg - Germany
phone +49 441 4082300 - mobile +49 174 9749449 - fax +49 441 4082333
mailto:[EMAIL PROTECTED] - http://www.atanion.com