Re: Concerning DataModel usage plus overhead?

2005-08-31 Thread Martin Marinschek
Kevin,

I am trying to get Sylvain involved in this to explain
forceIndexFormula better (hint: this should be in the documentation ;)
- but I believe that his solution is somewhat similar to your
suggestion!

Particularly, you just get the id of the data row as part of the
client-id in your action, and it is your responsibility then to fetch
this row!

regards,

Martin



On 8/30/05, Kevin Galligan [EMAIL PROTECTED] wrote:
 My brain is very struts centric as well.  There's some things I like
 about the JSF model too though.  Thats why I'm probably landing
 somewhere in between.
 
 I generally avoided session scoping anything that didn't need to be,
 which I guess is my big reservation with JSF.  I know exactly what you
 mean with the lazy list in the form.  You do have some extra effort
 involved, like building the property string on the input objects and
 tracking the id's in a hidden input component, but there's not as much
 going on behind the curtain either.
 
 I think that's enough for today though...
 
 Rick Reumann wrote:
  On 8/30/05, Kevin Galligan [EMAIL PROTECTED] wrote:
 
 
 I think updating several rows at the same time, which might require
 local copies of the data, and just linking are two different things.
 They might need two different components.
 
 
  With Struts this was a piece of cake. Your ActionForm has a bean
  property that is a List of the objects you want to update (Helps if
  it's a LazyList if not using session scope), and when your form
  submits BeanUtils (in the background) simply copies your form objects
  to the List in the Action form. Super simple imo.
 
  The only slightly tricky part is validation, but I always provide a
  manual validation method in my Action classes so this was easy to
  handle.
 
 


-- 

http://www.irian.at
Your JSF powerhouse - 
JSF Trainings in English and German


master detail pages

2005-08-31 Thread ::SammyRulez::
Hi all

I'm a JSF total newbbie so.. I'm sorry if I'm asking something trivial.

I read a lot of tutorials on page navigation and event handling... but
I still can't figure out how to implement a simple master/detail
pages. I make a page with dataTable reading values from a managed bean
but I can implement the passage to the detailed page?

thanks
 

Sam


RE: master detail pages

2005-08-31 Thread Balaji Kalyansundaram

Hi

Download the my-faces examples from http://myfaces.apache.org/binary.cgi
and look at the Master-Detail in the Component menu.

Balaji

-Original Message-
From: ::SammyRulez:: [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 31 August 2005 5:01 PM
To: users@myfaces.apache.org
Subject: master detail pages


Hi all

I'm a JSF total newbbie so.. I'm sorry if I'm asking something trivial.

I read a lot of tutorials on page navigation and event handling... but
I still can't figure out how to implement a simple master/detail
pages. I make a page with dataTable reading values from a managed bean
but I can implement the passage to the detailed page?

thanks


Sam

This correspondence is for the named persons only.
It may contain confidential or privileged information or both.
No confidentiality or privilege is waived or lost by any mis transmission.
If you receive this correspondence in error please delete it from your system 
immediately and notify the sender.
You must not disclose, copy or relay on any part of this correspondence, if you 
are not the intended recipient.
Any opinions expressed in this message are those of the individual sender 
except where the sender expressly,
and with the authority, states them to be the opinions of the Department of 
Emergency Services, Queensland.


Re: Tree2 Questions

2005-08-31 Thread Enrique Medina
Hi Bryan,

IMHO, the lazy loading mechanism is not responsibility of the tree2
itself, but of the treemodel that provides the data to the tree2, so
you can provide your own implementation using, for example, Hibernate
or OJB.2005/8/30, Sean Schofield [EMAIL PROTECTED]:
Please send tree2 questions to the mailing list so all users canbenefit from the answers.Also, there are many more users on the listwho can help you and the component authors do not have time to answerall of the questions individually.
Regards,sean-- Forwarded message --From: Dunbar, Bryan [EMAIL PROTECTED]Date: Aug 30, 2005 11:22 AMSubject: Tree2 Questions
To: [EMAIL PROTECTED]Sean - Do you have a good way to implement Lazy loading via tree2?This e-mail transmission contains information that is confidential and
may be privileged. It is intended only for the addressee(s) namedabove. If you receive this e-mail in error, please do not read, copyor disseminate it in any manner. If you are not the intendedrecipient, any disclosure, copying, distribution or use of the
contents of this information is prohibited. Please reply to themessage immediately by informing the sender that the message wasmisdirected. After replying, please erase it from your computersystem. Your assistance in correcting this error is appreciated.



RE: master detail pages

2005-08-31 Thread Jesse Alexander (KBSA 21)
-Original Message-
I'm a JSF total newbbie so.. I'm sorry if I'm asking something trivial.

I read a lot of tutorials on page navigation and event handling... but
I still can't figure out how to implement a simple master/detail
pages. I make a page with dataTable reading values from a managed bean
but I can implement the passage to the detailed page?
-/Original Message-

Have you checked the tutorials at: http://www.jsftutorials.net/?

Basically you add a command-link as a child to a column and pass it some
identifying attribute of the current row-object as a parameter.

hth
Alexander

Else join us on the IRC-channel (search the mailing-list archives for
the coordinates)...


Re: master detail pages

2005-08-31 Thread Enrique Medina
Just a question...

Why do you need a parameter to the commandlink? Wouldn't it be
sufficient to have the datatable in your backing bean and simply call
getRowData()?2005/8/31, Jesse Alexander (KBSA 21) [EMAIL PROTECTED]:
-Original Message-I'm a JSF total newbbie so.. I'm sorry if I'm asking something trivial.I read a lot of tutorials on page navigation and event handling... butI still can't figure out how to implement a simple master/detail
pages. I make a page with dataTable reading values from a managed beanbut I can implement the passage to the detailed page?-/Original Message-Have you checked the tutorials at: 
http://www.jsftutorials.net/?Basically you add a command-link as a child to a column and pass it someidentifying attribute of the current row-object as a parameter.hthAlexanderElse join us on the IRC-channel (search the mailing-list archives for
the coordinates)...


Re: difficult savestating question

2005-08-31 Thread Enrique Medina
Hi Martin,

This sounds interesting. Could you please tell me more precisely what does AutoUpdateDataTable do exactly?

Thanks,
Quique.2005/8/30, Martin Marinschek [EMAIL PROTECTED]:
Hmmm...Do you want to look at AutoUpdateDataTable?We have implemented a way of fetching data from the server, and if thestate of the server changes, to change the state on the client as well(replacing the input hidden field on the client with the new state
returned from the client).If I understood you correctly, this would be what you need as well!regards,MartinOn 8/30/05, Werner Punz [EMAIL PROTECTED] wrote:
 Hi this question goes very deep into the structures of jsf. I did some 1:n relational programming today, the idea was to have a master form with the :n relational data in a subarea of this form.
 My idea was to bypass the entire refresh cycle by using ajax for the display of the :n relational data, that did work execptionally well although it is plain html at the current stage.
 I also did the create and update cycle of the data with popup boxes which trigger the ajax releoad at the end of their operations, worked also exceptionally well. Bit I ran into one minor problem I am not sure how to solve.
 Currently I keep the :n relational data due to easier handling in the session, and use saveState only for the dialog handling of the popups. I would love to push the :n relational data into saveState as well, but
 the main problem is, with my ajax request I am kindof out of the entire JSF lifecycle, but saveStating the data would guarantee that at the next page refresh of the main master form the data would be loaded properly
 without having to put the burden into the session. So my question, is there a way to trigger the serialization on a bean outside of the rendering cycle, so that at cycle the altered bean gets
 loaded and saved properly? Werner--http://www.irian.atYour JSF powerhouse -JSF Trainings in English and German



Re: master detail pages

2005-08-31 Thread ::SammyRulez::
this would be great... I'm looking at myFaces examples... 

thank you all..

ps:

finaly I got it

http://www.oracle.com/technology/oramag/oracle/04-mar/o24dev_jsf.html


2005/8/31, Enrique Medina [EMAIL PROTECTED]:
 Just a question...
  
  Why do you need a parameter to the commandlink? Wouldn't it be sufficient
 to have the datatable in your backing bean and simply call getRowData()?
 
 2005/8/31, Jesse Alexander (KBSA 21)
 [EMAIL PROTECTED]:
  -Original Message-
  I'm a JSF total newbbie so.. I'm sorry if I'm asking something trivial.
  
  I read a lot of tutorials on page navigation and event handling... but
  I still can't figure out how to implement a simple master/detail 
  pages. I make a page with dataTable reading values from a managed bean
  but I can implement the passage to the detailed page?
  -/Original Message-
  
  Have you checked the tutorials at:  http://www.jsftutorials.net/?
  
  Basically you add a command-link as a child to a column and pass it some
  identifying attribute of the current row-object as a parameter.
  
  hth
  Alexander
  
  Else join us on the IRC-channel (search the mailing-list archives for 
  the coordinates)...
  
 
  


-- 
::SammyRulez::
http://sammyprojectz.blogspot.com


Re: JSF success story

2005-08-31 Thread Enrique Medina
Hi Werner,

Could you please give us extenden information about the application of xdoclet for standard CRUD maks and the use of IoC?

I have a slight idea of what you're talking, but to concrete ;-)

Thanks.2005/8/30, Werner Punz [EMAIL PROTECTED]:
Martin Manfred and the others from vienna, know already the app, Ishowed an early beta version to them in Vienna,I could not show it publicly due to various reasonsBut just for the general public here is a small success story,
I did a JSF app, around the timeframe of the 15th of may til the 15th ofjune (core crunch phase with some maintainance until now)most of the controls currently hosted on jsf-comp were developed forthat program due to the insane specs I got in last minute, which I
could not get rid of.So far so good, since the beginning of june the application has beenrolled out, it is an intranet app, servicing around 60 users some ofthem working constantly with it, with around 
12.000 addresses so farhammered in manually.So far not a single crash, not the slightest memory problem,a few minor bugfixes in between, and the tomcat runs on conservative128mb, with not even spiking the server which is a xeon server to 3%
from time to time.The application was programmed against myfaces 1.0.9, running on aTomcat 5.5.9 under JDK 5.0I just wanted to share an internal success story, and wantedto show that myfaces can be used perfectly for real apps...
It scales very well...The app uses a combination of myfaces, some ajax controls,some other controls like the client side tabbing pane,hibernate in the old incarnation, and spring forsupporting classes in the middle tier.
It also used some effects from the script.aculo.us libraryand from the fat library mapped into jsf tags.The development time was dramatically reduced by the application of
xdoclet for standard CRUD masks (which the app consists of around 50%)and the application of the generated classes to the IOC system of springmerged into JSF, via the Spring JSF integration library.
Werner


Re: JSF success story

2005-08-31 Thread Werner Punz

Enrique Medina wrote:

Hi Werner,

Could you please give us extenden information about the application of 
xdoclet for standard CRUD maks and the use of IoC?


I have a slight idea of what you're talking, but to concrete ;-)

Thanks.

Yes, I started off and still am in the project as a one man team, it 
started off as a project which had to be finished very swiftly and

will be dumped once a bigger system goes online, more details is NDA...

I knew xdoclet in the past from an old job where I constantly had to 
fight against monetary issues, and had in the end to do the work of an 
entire team.


What I did was to use xdoclet sort of as a code templating wizard, which 
generated the create update delete base code and the master detail views

from the given reverse engineered database objects...

All I did was to extend it that way, that I had to add basic metadata
with form information to the database pojos and then had a run via 
xdoclet over them. The result is basically a master detail module with 
all the forms, some basic verification code and the dao layer, and it is 
working and also with working faces-config files which were generated.


Several form parts are split apart for easier maintenance via aliasbean 
includes... or general includes


No to overwrite my code again and again I used basic inheritance to add 
manually the additional functionality to the java parts, nowadays if I 
had to write it from scratch I probably would weave the objects into the 
rest of the system via inversion of object control.


the final forms were based upon the code templates generated but 
manually altered and moved into separate directories, the binding could 
then be done by altering the faces-config manually...


So what happened is that you basically generate a basic application out
of an existing db schema and then start to alter the parts you need 
changed and move them out of the generation base, so that you do not 
overwrite them. That also means, you need at least one working project 
codebase to start on to write your templates for the next project.
Once this huge task is done and the codebase is stabilized you can reuse 
it for the next projects...



one of the generation classes for xdoclet looks like this:
/**
 * @dbo.form.single module=gen icon=img_institution_big 
title=Institutionsverwaltung

 * @dbo.binding.hibernate A simple changelog blog object which handles the
 *change logs and infos of the system
 * @author Punz
 *
 * PRE
 *
 * Dummy class to generate the database forms
 *
 * currently following tags are supported dbo.form.single marks the 
class as dbo
 * master object on a single master detail form dbo.method mars a 
method which

 * has to be parsed as dbo method (only getters have to be marked it has
 * following attributes: header marks a plain text header or a ref to an
 * internationalization file sortable if set marks this property as a sort
 * criterion masterDisplay marks this one as displayable in the master 
table

 * detailDisplay marks this one as displayable in the detail table as well
 * detailField gives the jsf detail field type detailFieldParams pushes the
 * internal detail field params down to the template
 *
 * @dbo.method.validation marks that validation has to be added
 *required=true/false marks that the required 
flag has

 *to be set stdvalidators= f:validateLength
 *minimum='2' maximum='40' / a string of standard
 *validators
 *
 * @dbo.action sets an action with following parameters 
oneonmany=true marks

 * the action as simply two form oneonmany relations
 * header=Kontakte linkheader for the action 
masterDisplay=true
 * display the action in the master display 
detailDisplay=true

 * display the action in the detail display as well
 * slave=Tblcontact slave object in case of a simple one 
on many

 *
 * /pre
 */
public class Institution extends ommiddlegen.Institution {

/**
 * @see ommiddlegen.AbstractDiffsyschangelog#getId()
 * @dbo.method header=Id sortable=true masterDisplay=true 
detailDisplay=true detailField=h:inputHidden 
detailFieldType=h:inputHidden

 */

public Integer getId() {
return super.getId();
}





/**
 * @see ommiddlegen.AbstractDiffsyschangelog#getTitle()
 *  @dbo.method header=Name  masterDisplay=true 
detailDisplay=true
 *  @dbo.method.validation required=true 
stdvalidators=f:validateLength minimum='2' maximum='50' /

 *  @dbo.method.search likeQuery=true
 */
public String getNachname() {

return super.getNachname();
}





/**
 * @see ommiddlegen.AbstractDiffsyschangelog#getDescription()
 * @dbo.method header=Beschreibung   detailDisplay=true 
detailField=h:inputTextarea rows='10' 

Re: master detail pages

2005-08-31 Thread Mathias Broekelmann
getRowData() will work too. But if the data changes between the requests 
it could be possible that getRowData() returns the wrong object. Using a 
parameter with a commandlink which identifies the selected object would 
be safer.


Regards,

Mathias

Enrique Medina schrieb:

Just a question...

Why do you need a parameter to the commandlink? Wouldn't it be 
sufficient to have the datatable in your backing bean and simply call 
getRowData()?


2005/8/31, Jesse Alexander (KBSA 21) [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]:


-Original Message-
I'm a JSF total newbbie so.. I'm sorry if I'm asking something trivial.

I read a lot of tutorials on page navigation and event handling... but
I still can't figure out how to implement a simple master/detail
pages. I make a page with dataTable reading values from a managed bean
but I can implement the passage to the detailed page?
-/Original Message-

Have you checked the tutorials at:  http://www.jsftutorials.net/?

Basically you add a command-link as a child to a column and pass it some
identifying attribute of the current row-object as a parameter.

hth
Alexander

Else join us on the IRC-channel (search the mailing-list archives for
the coordinates)...




cannot use AddResource class to add my own resources

2005-08-31 Thread Sebestyén Csaba








Hi!



I wrote a new component based on MyFaces, and this component
has an external JS resource. While rendering, I want to add the reference of
this resource by the AddResource class: I tried simply to call AddResource.addJavaScriptToHeader(...).
But unfortunately this function can handle only the resources of the MyFaces
components, because of the line 203:

   if( ! name.startsWith(COMPONENTS_PACKAGE) ){  
log.error(  



If I write my own AddResource class (functions like yours),
the ExtensionsFilter still references the old AddReource class (between lines 106
and 132), so I need to implement a new ExtensionFilter to handle my resources
well.



This solution of my problem works, but I won't use it. I
need a more structured solution. What shall I do to use the original AddResource
class? And what are these security reasons, why the restriction
to the package name is required?





Thanks,



Csaba










Re: cannot use AddResource class to add my own resources

2005-08-31 Thread Martin Marinschek
I believe this need not be checked for, right.

Open a jira issue on this, and assign Sylvain Vieujot to the issue -
he is the original author of the ExtensionFilter.

regards,

Martin

On 8/31/05, Sebestyén Csaba [EMAIL PROTECTED] wrote:
  
  
 
 Hi! 
 
   
 
 I wrote a new component based on MyFaces, and this component has an external
 JS resource. While rendering, I want to add the reference of this resource
 by the AddResource class: I tried simply to call
 AddResource.addJavaScriptToHeader(...). But unfortunately
 this function can handle only the resources of the MyFaces components,
 because of the line 203: 
 
if( ! name.startsWith(COMPONENTS_PACKAGE) ){   log.error(   
 
   
 
 If I write my own AddResource class (functions like yours), the
 ExtensionsFilter still references the old AddReource class (between lines
 106 and 132), so I need to implement a new ExtensionFilter to handle my
 resources well. 
 
   
 
 This solution of my problem works, but I won't use it. I need a more
 structured solution. What shall I do to use the original AddResource class?
 And what are these „security reasons, why the restriction to the package
 name is required? 
 
   
 
   
 
 Thanks, 
 
   
 
 Csaba 
 
   


-- 

http://www.irian.at
Your JSF powerhouse - 
JSF Trainings in English and German


Re: master detail pages

2005-08-31 Thread Enrique Medina
Hi Mathias,

What about using getRowData() and then calling your service level to
refresh the object? If it has recently changed, it would be in cache,
so no hits to the DB are needed... because with the solution of the
hidden parameter it is also necessary to retrieve the object in every
request, isn't it?

Once I heard that the use of hidden fields breaks security in the sense
that you are giving everyone the possibility to know the PK of your
data. What do you think about it?

Thanks.2005/8/31, Mathias Broekelmann [EMAIL PROTECTED]:
getRowData() will work too. But if the data changes between the requestsit could be possible that getRowData() returns the wrong object. Using aparameter with a commandlink which identifies the selected object would
be safer.Regards,MathiasEnrique Medina schrieb: Just a question... Why do you need a parameter to the commandlink? Wouldn't it be sufficient to have the datatable in your backing bean and simply call
 getRowData()? 2005/8/31, Jesse Alexander (KBSA 21) [EMAIL PROTECTED] mailto:
[EMAIL PROTECTED]: -Original Message- I'm a JSF total newbbie so.. I'm sorry if I'm asking something trivial. I read a lot of tutorials on page navigation and event handling... but
 I still can't figure out how to implement a simple master/detail pages. I make a page with dataTable reading values from a managed bean but I can implement the passage to the detailed page?
 -/Original Message- Have you checked the tutorials at:  http://www.jsftutorials.net/? Basically you add a command-link as a child to a column and pass it some
 identifying attribute of the current row-object as a parameter. hth Alexander Else join us on the IRC-channel (search the mailing-list archives for the coordinates)...



MyFaces - navigation problem while extending jsp page in tiles.xml

2005-08-31 Thread Nikita Koselev
Hello everybody...

I've created simple form with two input fields and one submit button
on jsp page.

test.jsp

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
%@ page contentType=text/html;charset=windows-1257%
%@ taglib uri=http://java.sun.com/jsf/core; prefix=f%
%@ taglib uri=http://java.sun.com/jsf/html; prefix=h%
 
jsp:useBean id=backing_test class=mypackage.beans.backing.Test
scope=request /
 
%--= backing_test.action()--%
 
html
  head
meta http-equiv=Content-Type content=text/html;
charset=windows-1257/meta
title
  test
/title
  /head
  body

f:view
  h:form binding=#{backing_test.form1}


Riigi id: h:inputText value=#{backing_test.id}/



Kood: h:inputText value=#{backing_test.kood}/



h:commandLink action=#{backing_test.goFilter} value=action /
h:commandButton value=push me action=#{backing_test.goFilter}
binding=#{backing_test.commandButton1}/

  /h:form
/f:view
  /body
/html



I've added such code to faces-config.xml

navigation-rule
from-view-id/test.jsp/from-view-id
navigation-case
from-outcomesuccess/from-outcome
to-view-id/filtered.jsp/to-view-id
/navigation-case
/navigation-rule



And that's piece of code ofTest.java bean I use to get to another page:

 
public String goFilter()
  {
System.out.println(came to action);
// Add event code here...
 
return success;
  }



Till now everything goes fine, user is redirected to filter.jsp page
after clicking button.

Now attention please:
As soon as I add such a code to my tiles.xml, my button stops working :(
I even don't get came to action message :(

definition name=/test.tiles extends=layout
put name=body value=/test.jsp/
/definition


Here layout defines basic page, with standard information on it
(banners, menus, etc).

I don't understand - how to heal such code... Is it possible to heal
it without printing each page's layout manually?


WG: best way to initialize BackingBean?

2005-08-31 Thread Stefan Gesigora
Hello!

Is there another way without using an addon-framework to initialize a 
backing-bean (without constructor intialization, managed-properties)? 

Stefan Gesigora

-Ursprüngliche Nachricht-
Von: Stefan Gesigora 
Gesendet: Mittwoch, 31. August 2005 11:21
An: MyFaces Discussion
Betreff: AW: best way to initialize BackingBean?

Hi!

Thx Martin!
How can I integrate Shale into JSF (Sun RI)? Is there a tutorial about this?

Stefan Gesigora


-Ursprüngliche Nachricht-
Von: Martin Marinschek [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 31. August 2005 11:13
An: MyFaces Discussion
Betreff: Re: best way to initialize BackingBean?

You might use Shale to do this kind of things.

With Shale, if your beans implement a special interface, several
methods will be called on your bean - one of them before the view is
shown...

regards,

Martin

On 8/31/05, Stefan Gesigora [EMAIL PROTECTED] wrote:
  
  
 
   
 
 Hi folks! 
 
   
 
 What is the best way to initialize BackingBeans? 
 
 I would like to get data from a DB everytime before the jsp will be shown
 initializing the jsp with this data. 
 
 I can't use the constructor initialization cause I need it everytime not
 only the first time. 
 
 I can't use initialization via managed-property cause the data isn't static...
 
   
 
 Any suggestions? 
 
   
 
 Thx 
 
 Stefan Gesigora 
 
   


-- 

http://www.irian.at
Your JSF powerhouse - 
JSF Trainings in English and German




Re: JSF + Spring + Hibernate

2005-08-31 Thread Werner Punz

Martin Marinschek wrote:

A very short hint from my side:

that exception means this object is not in the session anymore. You
can easily reapply it to the session by calling

session.update(object)



update is sort of problematic unless you really want to write
unless you do transactioning...
the better option would be to prefetch the affected parts
so that you do not run into lazy loading issues
over session boundaries.

To my experience, the OpenSessionInViewFilter, covers most problems in 
these areas anyway because usually you only need the data you show or at 
least reference in one form, in the next one, and fore the few

cases you do not need, a lazy false or object reload or bind does it.

the spring OpenSessionInViewFilterfilter has another nice sideeffect it 
forces you to use dedicated transactions if you want to write, otherwise 
it refuses to write.







tree table

2005-08-31 Thread Claudio Tamietto



i tried to use the tree table components and all is 
OK but i have a lot of data and i need some sort of paging like a data table. Is 
there any way to obtain this behaviour ? 
Thanks for any answer 


RE: best way to initialize BackingBean?

2005-08-31 Thread Murali








I didnt see your full message
earlier. Along with Injection service, you should define the scope as request.
And data retrieval logic keep it in another Backed bean which is defined before
this bean  store it in session.





Regards

Murali











From: Murali [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, August 31, 2005
7:20 AM
To: 'MyFaces Discussion'
Subject: RE: best way to
initialize BackingBean?





You can use injections service available
in JSF. The attributes of Backed bean can be initialized part of definition
using other Backedbean properties. 



It is a great feature. The class code
looks neat, as no initialization code, also it is easy to modify initialization
code , which is part of Backed bean definition.





Regards

Murali

248.766.9009 (Cell)



This e-mail message is for the sole use of the intended
recipient(s) and may contain confidential and/or privileged information belonging
to ECON LLC. Any unauthorized review, use, copying, disclosure or distribution
of this message is strictly prohibited. If you are not an intended recipient of
this message, please contact the sender by reply e-mail and destroy all soft
and hard copies of the message and any attachments 











From: Stefan Gesigora
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 31, 2005
7:00 AM
To: MyFaces Discussion
Subject: AW: best way to
initialize BackingBean?





I use this kind of bean.
But I have to initialize it dynamically. Like the initialization of a Form
class in an action class in struts.















Von:
Guy Katz [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 31. August
2005 12:54
An: MyFaces Discussion
Betreff: RE: best way to
initialize BackingBean?







why
not useuse a request scope bean and bind it to the JSP you talk
about?






-Original
Message-
From: Stefan Gesigora
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 31, 2005
11:54 AM
To: MyFaces Discussion
Subject: best way to initialize
BackingBean?







Hi folks!



What is the best way to
initialize BackingBeans?

I would like to get data
from a DB everytime before the jsp will be shown initializing the jsp with this
data.

I cant use the
constructor initialization cause I need it everytime not only the first time.

I cant use
initialization via managed-property cause the data isnt static



Any suggestions?



Thx 

Stefan Gesigora












Antwort: imageLocation

2005-08-31 Thread mathias . werlitz

Yes, it should be fixed in the nightly
build. 

Re: JSF + Spring + Hibernate

2005-08-31 Thread Rick Gruber-Riemer
Thank you Turgay

The solution unfortunately does not work for me. 

Maybe I do something stupid. So I have to read through all the other replies 
and try to understand ...

Regards ... Rick

Onsdag 31 august 2005 12:18 skrev Turgay Zengin:
 Sorry, I forgot the filter mapping part. You should also add this to
 web.xml:

 filter-mapping
 filter-namehibernateFilter/filter-name
 url-pattern*.do/url-pattern
 /filter-mapping

 Just replace the url-pattern with the correct pattern you use for JSF
 (*.jsf for example)

 -Turgay

 On 8/31/05, Turgay Zengin [EMAIL PROTECTED] wrote:
  Did you try the OpenSessionInViewFilter?
  In web.xml, define this filter:
 
  filter
  filter-namehibernateFilter/filter-name
  filter-classorg.springframework.orm.hibernate.support.OpenSessionInView
 Filter/filter-class /filter
 
  I have not tried this with MyFaces yet, but with Struts this worked for
  me.
 
  HTH,
  Turgay.


Re: best way to initialize BackingBean?

2005-08-31 Thread Jeff Cooper
I'm new to JSF, so maybe this isn't best way. But couldn't you do that fromthe action that sends you to the page you want to initialize. Have your action mapped to the method you want to use as initilization method, then forward to the page.

On 8/31/05, Stefan Gesigora [EMAIL PROTECTED] wrote:



Hi folks!

What is the best way to initialize BackingBeans?
I would like to get data from a DB everytime before the jsp will be shown initializing the jsp with this data.

I can't use the constructor initialization cause I need it everytime not only the first time.

I can't use initialization via managed-property cause the data isn't static…

Any suggestions?

Thx 
Stefan Gesigora



RE: Tree2 Questions

2005-08-31 Thread Dunbar, Bryan



I agree with it being part of the model, however I feel 
(and I've seen it in other posts) that the tree should throw NodeExpansionEvents 
when the navigation controls are clicked. This way I could implement my lazy 
loading in my listener for those events. It would save developers the 
hassle of using there own navigation images to accomplish this 
task.

Bryan

  
  
  From: Enrique Medina 
  [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 31, 2005 3:19 
  AMTo: MyFaces DiscussionCc: Dunbar, 
  BryanSubject: Re: Tree2 Questions
  Hi Bryan,IMHO, the lazy loading mechanism is not 
  responsibility of the tree2 itself, but of the treemodel that provides the 
  data to the tree2, so you can provide your own implementation using, for 
  example, Hibernate or OJB.
  2005/8/30, Sean Schofield [EMAIL PROTECTED]:
  Please 
send tree2 questions to the mailing list so all users canbenefit from 
the answers.Also, there are many more users on the listwho 
can help you and the component authors do not have time to answerall of 
the questions individually. Regards,sean-- 
Forwarded message --From: Dunbar, Bryan [EMAIL PROTECTED]Date: Aug 
30, 2005 11:22 AMSubject: Tree2 Questions To: [EMAIL PROTECTED]Sean 
- Do you have a good way to implement Lazy loading via tree2?This 
e-mail transmission contains information that is confidential and may be 
privileged. It is intended only for the addressee(s) namedabove. If you 
receive this e-mail in error, please do not read, copyor disseminate it 
in any manner. If you are not the intendedrecipient, any disclosure, 
copying, distribution or use of the contents of this information is 
prohibited. Please reply to themessage immediately by informing the 
sender that the message wasmisdirected. After replying, please erase it 
from your computersystem. Your assistance in correcting this error is 
appreciated. This e-mail transmission contains information that is confidential and may be privileged. It is intended only for the addressee(s) named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated.


Re: JSF success story

2005-08-31 Thread Martin Marinschek
this is a project on:

sourceforge.net

were people who want to drop jsf code can do it - without having to go
through the rigorous ASF screening necessary ;)

depending on license issues, users base etc. some of this code might
wander over to MyFaces core at some point in time.

regards,

Martin


On 8/31/05, Dave Brondsema [EMAIL PROTECTED] wrote:
 Werner Punz wrote:
  Martin Manfred and the others from vienna, know already the app, I
  showed an early beta version to them in Vienna,
  I could not show it publicly due to various reasons
 
  But just for the general public here is a small success story,
  I did a JSF app, around the timeframe of the 15th of may til the 15th of
  june (core crunch phase with some maintainance until now)
 
  most of the controls currently hosted on jsf-comp were developed for
  that program due to the insane specs I got in last minute, which I
  could not get rid of.
 
 
 What and where is jsf-comp?
 
 --
 Dave Brondsema
 Software Developer
 Cornerstone University
 
 
 


-- 

http://www.irian.at
Your JSF powerhouse - 
JSF Trainings in English and German


Re: JSF + Spring + Hibernate

2005-08-31 Thread Dave Brondsema
Rick Gruber-Riemer wrote:
 Hej
 
 I use MyFaces (1.0.9), Hibernate (3.0.5) and Spring (1.22) in my 
 webapplication. When I get a list of records from the database in a table or 
 make a new record using a form everything works fine. However when I try to 
 edit a record in a form, I get a org.hibernate.LazyInitializationException 
 error on opening the editform.
 I understand this has something to do with the Hibernate sessions. And it has 
 nothing to do with MyFaces in particular. And I have found some hints by 
 googeling like Spring's OpenSessionInViewFilter. However I do not have a clue 
 what to change where in the configuration.
 
 = Has somebody used JSF+Spring+Hibernate successfully?
 = Downloadable sample code?
 = Do I need the jsf-spring integration library?
 
 Any hint would be much appreciated ... Rick
 

I'm using Hibernate 3.1 annotations, but I'm sure you can do this
without annotation syntax.  The code that follows is a Menu object
with a unique key by date.

My DTO object is annotated like this:
@Table(name = tblFoodServiceMenu)
@org.hibernate.annotations.Proxy(lazy = false)
public class Menu implements Serializable {
...


I don't use OpenSessionInViewFilter


The DTOs are loaded with this DAO class:
public class MenuDAO extends HibernateDaoSupport {
private final Log log = LogFactory.getLog(getClass().getName());

public Menu getMenu(Date date) {
log.trace(creating object for key:  + date);
try {
return (Menu) getHibernateTemplate().load(Menu.class, 
date);
} catch (DataAccessException e) {
log.debug(detected that no object found);
return null;
}
}

public void saveMenu(Menu menu) {
log.trace(saving object with key:  + menu.date);
getHibernateTemplate().saveOrUpdate(menu);
}
}



applicationContext.xml has:
bean id=dataSource ...
/bean

!-- Hibernate SessionFactory Definition --
bean id=sessionFactory
class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
property name=configLocation
value/WEB-INF/classes/hibernate.cfg.xml/value
/property
property name=configurationClass
valueorg.hibernate.cfg.AnnotationConfiguration/value
/property
property name=dataSource
ref bean=dataSource/
/property
/bean

!-- Spring Data Access Exception Translator Defintion --
bean id=jdbcExceptionTranslator
class=org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator

property name=dataSourceref bean=dataSource//property
/bean

!-- Hibernate Template Defintion --
bean id=hibernateTemplate
class=org.springframework.orm.hibernate3.HibernateTemplate
property name=sessionFactoryref bean=sessionFactory//property
property name=jdbcExceptionTranslatorref
bean=jdbcExceptionTranslator//property
/bean

!-- User DAO object: Hibernate implementation --
bean id=menuDao class=my.package.model.MenuDAO
property name=hibernateTemplateref
bean=hibernateTemplate//property
/bean



And the Menu backing bean has a managed property which points to a
service locator class (that class connects to the spring container, but
I intend to switch to the jsf-spring library soon).   Then in the
backing bean it has this method which loads a Menu:
public void setDate(Date date) {
if (date != null) {
this.date = date;
menu = menuDao.getMenu(date);
if (menu == null) {
menu = new Menu();
menu.setDate(date);
}
} else {
log.debug(ignoring setDate(null));
}
}

Hope that helps!  Took me a while to figure out

-- 
Dave Brondsema
Software Developer
Cornerstone University


signature.asc
Description: OpenPGP digital signature


Re: JSF + Spring + Hibernate

2005-08-31 Thread Enrique Medina
But Dave, you are not using lazy loading, are you?

The big problems appear when using lazy loading and objects are not initialized in the same Hibernate session...
2005/8/31, Dave Brondsema [EMAIL PROTECTED]:
Rick Gruber-Riemer wrote: Hej
I use MyFaces (1.0.9), Hibernate (3.0.5) and Spring (1.22) in my
webapplication. When I get a list of records from the database in a
table or make a new record using a form everything works fine. However
when I try to edit a record in a form, I get a
org.hibernate.LazyInitializationException error on opening the editform.
I understand this has something to do with the Hibernate sessions. And
it has nothing to do with MyFaces in particular. And I have found some
hints by googeling like Spring's OpenSessionInViewFilter. However I do
not have a clue what to change where in the configuration. = Has somebody used JSF+Spring+Hibernate successfully? = Downloadable sample code? = Do I need the jsf-spring integration library?
 Any hint would be much appreciated ... RickI'm using Hibernate 3.1 annotations, but I'm sure you can do thiswithout annotation syntax.The code that follows is a Menu object
with a unique key by date.My DTO object is annotated like this:@Table(name = tblFoodServiceMenu)@org.hibernate.annotations.Proxy(lazy = false)public class Menu implements Serializable {
...I don't use OpenSessionInViewFilterThe DTOs are loaded with this DAO class:public class MenuDAO extends HibernateDaoSupport {private final Log log = LogFactory.getLog(getClass().getName());
public Menu getMenu(Date date) {log.trace(creating
object for key:  + date);try {return
(Menu) getHibernateTemplate().load(Menu.class, date);}
catch (DataAccessException e) {log.debug(detected
that no object found);return
null;}}public void saveMenu(Menu menu) {log.trace(saving
object with key:  + menu.date);getHibernateTemplate().saveOrUpdate(menu);}}applicationContext.xml has:bean id=dataSource .../bean
!-- Hibernate SessionFactory Definition --bean id=sessionFactoryclass=org.springframework.orm.hibernate3.LocalSessionFactoryBeanproperty name=configLocation
value/WEB-INF/classes/hibernate.cfg.xml/value/propertyproperty name=configurationClassvalueorg.hibernate.cfg.AnnotationConfiguration
/value/propertyproperty name=dataSourceref bean=dataSource//property/bean!-- Spring Data Access Exception Translator Defintion --
bean id=jdbcExceptionTranslatorclass=org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslatorproperty name=dataSourceref bean=dataSource//property
/bean!-- Hibernate Template Defintion --bean id=hibernateTemplateclass=org.springframework.orm.hibernate3.HibernateTemplateproperty name=sessionFactoryref bean=sessionFactory//property
property name=jdbcExceptionTranslatorrefbean=jdbcExceptionTranslator//property/bean!-- User DAO object: Hibernate implementation --
bean id=menuDao class=my.package.model.MenuDAOproperty name=hibernateTemplaterefbean=hibernateTemplate//property/bean
And the Menu backing bean has a managed property which points to aservice locator class (that class connects to the spring container, butI intend to switch to the jsf-spring library soon). Then in the
backing bean it has this method which loads a Menu:public void setDate(Date date) {if (date != null) {this.date
= date;menu
= menuDao.getMenu(date);if
(menu == null) {menu
= new Menu();menu.setDate(date);}} else {log.debug(ignoring
setDate(null));}}Hope that helps!Took me a while to figure out--Dave BrondsemaSoftware DeveloperCornerstone University


Re: best way to initialize BackingBean?

2005-08-31 Thread Sean Schofield
I'm using Shale for this.  This is one of the specific things that
Shale is designed to give you.  And yes, you can use with either the
RI or MyFaces (basically any JSF implementation.)  I use it with
MyFaces of course ;-)

There is a nice overview on the Struts website now
(http://struts.apache.org/shale.)  Check out the javadocs as well
since there is some good summary documentation in there as well.

sean

On 8/31/05, Jeff Cooper [EMAIL PROTECTED] wrote:
 I'm new to JSF, so maybe this isn't best way.  But couldn't you do that from
 the action that sends you to the page you want to initialize.  Have your
 action mapped to the method you want to use as initilization method, then
 forward to the page. 
 
  
 On 8/31/05, Stefan Gesigora
 [EMAIL PROTECTED] wrote: 
  
  
  

  
  Hi folks! 
  

  
  What is the best way to initialize BackingBeans? 
  
  I would like to get data from a DB everytime before the jsp will be shown
 initializing the jsp with this data. 
  
  I can't use the constructor initialization cause I need it everytime not
 only the first time. 
  
  I can't use initialization via managed-property cause the data isn't
 static… 
  

  
  Any suggestions? 
  

  
  Thx 
  
  Stefan Gesigora 
  
   
 



Re: JSF + Spring + Hibernate

2005-08-31 Thread Enrique Medina
I don't see it in your fragment of the JSP code, but I guess you have
an EL accessing your lazy loaded variable inside your links object,
haven't you?

That is the precise moment where the error should appear, as all the
list has been created using a different Hibernate session from the one
you are now in this request ;-)
2005/8/31, Rick Gruber-Riemer [EMAIL PROTECTED]:
Hej MartinThe thing is, that this object does not even exist. At least not if Iunderstand the meaning of a request the right way.What I do is:# A DAO extending HibernateDaoSupport finds all records or a record with a
specifc id (ScanJourLinkHbmDAO)# The Page-objects get records or a record by means of a (shared)manager-class, which has a pointer to the DAO# Then in danafileResultPage.jsf I have a table, which shows all records based
on DanafileResultPage.java getting the records from the database via managerand DAO# Each row in the table contains links to edit a record in a new page(danafileScanJourModifyPage.jsf). The Page object for the new page
(DanafileScanJourModifyPage.java) has a property (idLink) which I access viaa MyFaces t:updateActionListener tag. Then in setIdLink(String anId) I tryto get the record from the database by means of the manager, which then calls
the DAO ...= I have no pointer to the object in either the Page, manager or DAO class.So I cannot call session.update(object) :-( And I guess that the call to anew page is a new request.Am I doing something wrong?
Regards ... Rickt:dataTableid=scanJourLinksTablestyleClass=standardTablecolumnClasses=list-column-leftheaderClass=list-header-left
rowClasses=list-row-even, list-row-oddvalue=#{DanafileResultPage.scanJourLinks}var=linksh:columnf:facet name=header
h:outputText
value=//f:faceth:commandLink
action="" immediate=trueh:outputText
value=#{msg.edit} /t:updateActionListener
property=#{DanafileScanJourModifyPage.idLink}value=#{links.id} //h:commandLink/h:columnpublic class DanafileScanJourModifyPage extends Page {
public void setIdLink(String anId) {if (logger.isDebugEnabled()) {logger.debug(getting
link with id=  + anId);}link
= danafileManager.findScanJourLink(Long.valueOf(anId));setUpdating(true);} //public void setId(String)public class DanafileManager {public ScanJourLink findScanJourLink(Long id) {
return
scanJourLinkDAO.findScanJourLink(id);} //END public ScanJourLink findScanJourLink(Long)public class ScanJourLinkHbmDAO extends HibernateDaoSupport implementsIScanJourLinkDAO {//implements IScanJourLinkDAO
public ScanJourLink findScanJourLink(Long id) {ScanJourLink
link = (ScanJourLink)getHibernateTemplate().load(ScanJourLink.class, id);if (null == link) {throw
new ObjectRetrievalFailureException(ScanJourLink.class, id);}return link;}Onsdag 31 august 2005 12:26 skrev Martin Marinschek: A very short hint from my side:
 that exception means this object is not in the session anymore. You can easily reapply it to the session by calling session.update(object) If you are sure that your object has not changed since it was last in
 the session, you can call: session.lock(object, LockMode.NONE); regards, Martin On 8/31/05, Werner Punz [EMAIL PROTECTED]
 wrote:  I think before giving a short answer... I will give you a detailed  explanation via a links:   
http://wiki.apache.org/myfaces/HibernateAndMyFaces?highlight=%28hibernate %29   This small article describes exactly the problems you run into and how  to solve them...
   Werner   Rick Gruber-Riemer wrote:   Hej I use MyFaces (1.0.9), Hibernate (3.0.5) and Spring (1.22) in my   webapplication. When I get a list of records from the database in a
   table or make a new record using a form everything works fine. However   when I try to edit a record in a form, I get a   org.hibernate.LazyInitializationException error on opening the
   editform. I understand this has something to do with the Hibernate   sessions. And it has nothing to do with MyFaces in particular. And I   have found some hints by googeling like Spring's
   OpenSessionInViewFilter. However I do not have a clue what to change   where in the configuration. = Has somebody used JSF+Spring+Hibernate successfully?
   = Downloadable sample code?   = Do I need the jsf-spring integration library? Any hint would be much appreciated ... Rick  
   hibernate-mapping   class   name=dk.trafikstyrelsen.data.transfer.dto.railsecurity.danafile.ScanJo  urLink table=DANAFILE.SCANJOUR_LINK



id name=id type=long column=ROW_ID 

meta attribute=scope-setprotected/meta


generator class=sequence 

param name=sequenceDANAFILE.SEQNUMBER/param   /generator   /id


version column=REVISION name=revision / 

property name=objId type=string not-null=true/


property name=scanJourNumber type=int   column=SCANJOUR_NUMBER not-null=true/ property name=notes   type=string column=NOTES not-null=false/ property name=active
   type=yes_no column=ACTIVE not-null=true / property   name=createdBy type=string column=CREATED_BY not-null=true/
   property name=lastUpdatedBy type=string 

Re: best way to initialize BackingBean?

2005-08-31 Thread Werner Punz
I really can recomment, to add the spring JSF integration library to the 
entire mix of libs in the project, you get many benefits by using spring 
IOC, like integrated AOP mechanisms...


Werner


Enrique Medina wrote:
At the moment, the IoC provided by JSF is only about objects and 
properties, I'm afraid.


You'll have to use Spring or another advance IoC container for 
constructor dependency injection, etc.


2005/8/31, Stefan Gesigora  [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]:


Hello!

Is there another way without using an addon-framework to
initialize a backing-bean (without constructor intialization,
managed-properties)?

Stefan Gesigora

-Ursprüngliche Nachricht-
Von: Stefan Gesigora
Gesendet: Mittwoch, 31. August 2005 11:21
An: MyFaces Discussion
Betreff: AW: best way to initialize BackingBean?

Hi!

Thx Martin!
How can I integrate Shale into JSF (Sun RI)? Is there a tutorial
about this?

Stefan Gesigora


-Ursprüngliche Nachricht-
Von: Martin Marinschek [mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 31. August 2005 11:13
An: MyFaces Discussion
Betreff: Re: best way to initialize BackingBean?

You might use Shale to do this kind of things.

With Shale, if your beans implement a special interface, several
methods will be called on your bean - one of them before the view is
shown...

regards,

Martin

On 8/31/05, Stefan Gesigora [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
 
 
 
 
 
  Hi folks!
 
 
 
  What is the best way to initialize BackingBeans?
 
  I would like to get data from a DB everytime before the jsp will
be shown
  initializing the jsp with this data.
 
  I can't use the constructor initialization cause I need it
everytime not
  only the first time.
 
  I can't use initialization via managed-property cause the data
isn't static...
 
 
 
  Any suggestions?
 
 
 
  Thx
 
  Stefan Gesigora
 
 


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German







Re: JSF + Spring + Hibernate

2005-08-31 Thread Rick Gruber-Riemer
You are right, I access the variable just in the same table in the next 
column. 
It seems to me, that I just have to get rid of all this lazy-stuff. Right now 
I do not care whether this gives me some resourceproblems.

How and where can I specify, that I want a session per database request?

Regards ... Rick


t:dataTable
id=scanJourLinksTable
styleClass=standardTable
columnClasses=list-column-left
headerClass=list-header-left
rowClasses=list-row-even, list-row-odd
value=#{DanafileResultPage.scanJourLinks}
var=links
   
h:column
f:facet name=header
h:outputText value=/
/f:facet
h:commandLink action=edit_link 
immediate=true
h:outputText 
value=#{msg.edit} / 
t:updateActionListener 
property=#{DanafileScanJourModifyPage.idLink} 
value=#{links.id} /
/h:commandLink
/h:column
h:column
f:facet name=header
h:outputText  
value=#{msg.scanJourNumberLabel}/
/f:facet
h:outputText 
value=#{links.scanJourNumber}/
/h:column
h:column
f:facet name=header
h:outputText  
value=#{msg.notesLabel}/
/f:facet
t:popup styleClass=popup 
closePopupOnExitingElement=true closePopupOnExitingPopup=true 
displayAtDistanceX=10 displayAtDistanceY=10 
h:outputText value=#{links.notes} / 
f:facet name=popup
h:panelGroup
h:panelGrid columns=1 
h:outputText value=#{links.notes}/
/h:panelGrid
/h:panelGroup
/f:facet
/t:popup  
/h:column
/t:dataTable
h:form
t:commandButton
id=saveBtn 
tabindex=4 
value=#{msg.buttonAdd}
action=add_link
forceId=true
styleClass=button
immediate=true 
t:updateActionListener

property=#{DanafileScanJourModifyPage.objIdLink}

value=#{DanafileResultPage.caseDocument.objId} /
/t:commandButton
/h:form   


Onsdag 31 august 2005 14:38 skrev Enrique Medina:
 I don't see it in your fragment of the JSP code, but I guess you have an EL
 accessing your lazy loaded variable inside your links object, haven't
 you?

 That is the precise moment where the error should appear, as all the list
 has been created using a different Hibernate session from the one you are
 now in this request ;-)

 2005/8/31, Rick Gruber-Riemer [EMAIL PROTECTED]:
  Hej Martin
 
  The thing is, that this object does not even exist. At least not if I
  understand the meaning of a request the right way.
 
  What I do is:
  # A DAO extending HibernateDaoSupport finds all records or a record with
  a specifc id (ScanJourLinkHbmDAO)
  # The Page-objects get records or a record by means of a (shared)
  manager-class, which has a pointer to the DAO
  # Then in danafileResultPage.jsf I have a table, which shows all records
  based
  on DanafileResultPage.java getting the records from the database via
  manager
  and DAO
  # Each row in the table contains links to edit a record in a new page
  (danafileScanJourModifyPage.jsf). The Page object for the new page
  (DanafileScanJourModifyPage.java) has a property (idLink) which I access
  via
  a MyFaces t:updateActionListener tag. Then in setIdLink(String anId) I
  try
  to get the record from the database by means of the manager, which then
  calls
  the DAO ...
  = I have no pointer to the object in either the Page, manager or DAO
  class.
  

Re: ajax ajax ajax

2005-08-31 Thread Enrique Medina
Hi Balaji,

I have just downloaded Firefox 1.0.6 and still doesn't work for me...

Could you please post a quick step-by-step guide of your configuration?

Thanks.2005/8/31, Balaji Kalyansundaram [EMAIL PROTECTED]:







It

works in Firefox 1.0.6

  -Original Message-From: Enrique Medina

  [mailto:[EMAIL PROTECTED]]Sent: Tuesday, 30 August 2005 8:48

  PMTo: MyFaces DiscussionSubject: Re: ajax ajax

  ajaxAlso is not working for me in Firefox 1.0

  :-(Error: [Exception... Component returned failure code: 0x80040111

  (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.getResponseHe ader]

  nsresult: 0x80040111 (NS_ERROR_NOT_AVAILABLE) location: JS frame ::

  http://localhost:8080/DeltaR/faces/myFacesExtensionResource/ajax.UIAjaxViewComponent/11245933/JSFAJAX.js

  :: anonymous :: line 48 data: no]Source File: 
http://localhost:8080/DeltaR/faces/myFacesExtensionResource/ajax.UIAjaxViewComponent/11245933/JSFAJAX.js

  Line: 48where the source line is:  	  var idsFromResponse = req.getResponseHeader(Ajax-Update-Ids);
  2005/8/30, Arash Bijanzadeh [EMAIL PROTECTED]:
  
On 8/15/05, Werner Punz [EMAIL PROTECTED] 

wrote:

Just

  checked the wiki again, some russian guy postedlinks to his

  projectthat stuff looks really interestinghttp://wiki.apache.org/myfaces/AJAX_Framework

It is not working on mozilla

1.7.8 with error message AJAX not found!-- from debian manifesto:Debian Linux is a brand-new

kind of Linux distribution. Rather than being developed by one isolated

individua l or group, as other distributions of Linux have been

developed in thepast, Debian is being developed openly in the spirit of

Linux and GNU. 

This correspondence is for the named persons only. 
It may contain confidential or privileged information or both. 
No confidentiality or privilege is waived or lost by any mis transmission. 
If you receive this correspondence in error please delete it from your system immediately and notify the sender. 
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. 
Any opinions expressed in this message are those of the individual sender except where the sender expressly, 
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.




RE: JSF success story

2005-08-31 Thread Jesse Alexander (KBSA 21)
-Original Message-
What and where is jsf-comp?
-/Original Message-

https://sourceforge.net/projects/jsf-comp/
current active components:
- optional validator
- tabbed pane memory

idea:
- easy accessible repository for code around JSF 
- access for everyone willing to contribute
- all licensing must be Apache license v2
  to allow for easy migration to myfaces

hth
Alexander


Re: best way to initialize BackingBean?

2005-08-31 Thread hicham abassi
Sean,

Have you a good tuto on Shale ?

2005/8/31, Sean Schofield [EMAIL PROTECTED]:
 Yes but really you should look at Shale.  It provides a simple
 *standard* way to do this.  Take the time to learn this aspect of
 Shale.  You won't regret it.
 
 sean
 
 On 8/31/05, hicham abassi [EMAIL PROTECTED] wrote:
  Is it possible to do that with a PhaseListener ?
  http://www.jsfcentral.com/redirect?listingTitle=JSF%20PhaseListener%20-%20Is%20This%20User%20Logged%20In?categoryTitle=Articles%20and%20BookscategoryPath=readingsite=http://groups.yahoo.com/group/jsf-developers/message/471
 
  I have to do the same thing than Stephan
 
 
  2005/8/31, Werner Punz [EMAIL PROTECTED]:
   I really can recomment, to add the spring JSF integration library to the
   entire mix of libs in the project, you get many benefits by using spring
   IOC, like integrated AOP mechanisms...
  
   Werner
  
  
   Enrique Medina wrote:
At the moment, the IoC provided by JSF is only about objects and
properties, I'm afraid.
   
You'll have to use Spring or another advance IoC container for
constructor dependency injection, etc.
   
2005/8/31, Stefan Gesigora  [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]:
   
Hello!
   
Is there another way without using an addon-framework to
initialize a backing-bean (without constructor intialization,
managed-properties)?
   
Stefan Gesigora
   
-Ursprüngliche Nachricht-
Von: Stefan Gesigora
Gesendet: Mittwoch, 31. August 2005 11:21
An: MyFaces Discussion
Betreff: AW: best way to initialize BackingBean?
   
Hi!
   
Thx Martin!
How can I integrate Shale into JSF (Sun RI)? Is there a tutorial
about this?
   
Stefan Gesigora
   
   
-Ursprüngliche Nachricht-
Von: Martin Marinschek [mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 31. August 2005 11:13
An: MyFaces Discussion
Betreff: Re: best way to initialize BackingBean?
   
You might use Shale to do this kind of things.
   
With Shale, if your beans implement a special interface, several
methods will be called on your bean - one of them before the view is
shown...
   
regards,
   
Martin
   
On 8/31/05, Stefan Gesigora [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
 
 
 
 
 
  Hi folks!
 
 
 
  What is the best way to initialize BackingBeans?
 
  I would like to get data from a DB everytime before the jsp will
be shown
  initializing the jsp with this data.
 
  I can't use the constructor initialization cause I need it
everytime not
  only the first time.
 
  I can't use initialization via managed-property cause the data
isn't static...
 
 
 
  Any suggestions?
 
 
 
  Thx
 
  Stefan Gesigora
 
 
   
   
--
   
http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German
   
   
   
  
  
 
 
  --
 
  hicham ABASSI
  [EMAIL PROTECTED]
 
 


-- 

hicham ABASSI
[EMAIL PROTECTED]


Re: best way to initialize BackingBean?

2005-08-31 Thread Sean Schofield
Nope.  Just check the link from earlier in the thread.  There are
nightly builds and simple examples as well so you should be able to
get up to speed pretty quickly.

sean

On 8/31/05, hicham abassi [EMAIL PROTECTED] wrote:
 Sean,
 
 Have you a good tuto on Shale ?
 
 2005/8/31, Sean Schofield [EMAIL PROTECTED]:
  Yes but really you should look at Shale.  It provides a simple
  *standard* way to do this.  Take the time to learn this aspect of
  Shale.  You won't regret it.
 
  sean
 
  On 8/31/05, hicham abassi [EMAIL PROTECTED] wrote:
   Is it possible to do that with a PhaseListener ?
   http://www.jsfcentral.com/redirect?listingTitle=JSF%20PhaseListener%20-%20Is%20This%20User%20Logged%20In?categoryTitle=Articles%20and%20BookscategoryPath=readingsite=http://groups.yahoo.com/group/jsf-developers/message/471
  
   I have to do the same thing than Stephan
  
  
   2005/8/31, Werner Punz [EMAIL PROTECTED]:
I really can recomment, to add the spring JSF integration library to the
entire mix of libs in the project, you get many benefits by using spring
IOC, like integrated AOP mechanisms...
   
Werner
   
   
Enrique Medina wrote:
 At the moment, the IoC provided by JSF is only about objects and
 properties, I'm afraid.

 You'll have to use Spring or another advance IoC container for
 constructor dependency injection, etc.

 2005/8/31, Stefan Gesigora  [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]:

 Hello!

 Is there another way without using an addon-framework to
 initialize a backing-bean (without constructor intialization,
 managed-properties)?

 Stefan Gesigora

 -Ursprüngliche Nachricht-
 Von: Stefan Gesigora
 Gesendet: Mittwoch, 31. August 2005 11:21
 An: MyFaces Discussion
 Betreff: AW: best way to initialize BackingBean?

 Hi!

 Thx Martin!
 How can I integrate Shale into JSF (Sun RI)? Is there a tutorial
 about this?

 Stefan Gesigora


 -Ursprüngliche Nachricht-
 Von: Martin Marinschek [mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 31. August 2005 11:13
 An: MyFaces Discussion
 Betreff: Re: best way to initialize BackingBean?

 You might use Shale to do this kind of things.

 With Shale, if your beans implement a special interface, several
 methods will be called on your bean - one of them before the view 
 is
 shown...

 regards,

 Martin

 On 8/31/05, Stefan Gesigora [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
  
  
  
  
  
   Hi folks!
  
  
  
   What is the best way to initialize BackingBeans?
  
   I would like to get data from a DB everytime before the jsp 
 will
 be shown
   initializing the jsp with this data.
  
   I can't use the constructor initialization cause I need it
 everytime not
   only the first time.
  
   I can't use initialization via managed-property cause the data
 isn't static...
  
  
  
   Any suggestions?
  
  
  
   Thx
  
   Stefan Gesigora
  
  


 --

 http://www.irian.at
 Your JSF powerhouse -
 JSF Trainings in English and German



   
   
  
  
   --
  
   hicham ABASSI
   [EMAIL PROTECTED]
  
 
 
 
 --
 
 hicham ABASSI
 [EMAIL PROTECTED]



Re: JSF + Spring + Hibernate

2005-08-31 Thread Rick Gruber-Riemer
Hej everybody

Thank you very much for your responses. I have got a lot of reading stuff from 
you all (including Hibernate chapter 20 to do, and maybe I should buy a book 
on Hibernate).

I solved the problem by setting lazy=false like Enrique (see below if you 
are a beginner like me).
OpenSessionInViewFilter did not work, but probably I made a mistake in the 
url-pattern although I changed it to *.faces (and use the hibernate3 
package). The challenge is that I have mixed code in my current project, 
where some of the data is fetched using JDBC and the newest tiny part with 
Hibernate. If a jsf-page is hit, which does not need data from Hibernate, 
then the filter casts an exception due to a missing Hibernate session. But 
this is just a configuration issue in web.xml ;-)

Regards ... Rick

hibernate-mapping
class  
name=dk.trafikstyrelsen.data.transfer.dto.railsecurity.danafile.ScanJourLink
table=DANAFILE.SCANJOUR_LINK
lazy=false
id name=id type=long column=ROW_ID
meta attribute=scope-setprotected/meta
generator class=sequence
param name=sequenceDANAFILE.SEQNUMBER/param
/generator
/id
version column=REVISION name=revision /
property name=objId type=string not-null=true/
...
/class
/hibernate-mapping

Onsdag 31 august 2005 15:13 skrev Werner Punz:
 The opensessioninview filter comes with spring, somebody posted already
 a semi correct configuration (that one was for struts, you have to
 adjust the filter patterns for jsf)

 it is probably the easiest way you can get, to deal with lazy binding,
 it at least has solved many problems regarding the lazy flag in my
 current struts project and works perfectly.

 werner

 Rick Gruber-Riemer wrote:
  You are right, I access the variable just in the same table in the next
  column.
  It seems to me, that I just have to get rid of all this lazy-stuff. Right
  now I do not care whether this gives me some resourceproblems.
 
  How and where can I specify, that I want a session per database request?


Re: immediate = true ?

2005-08-31 Thread Werner Punz

Bjørn T Johansen wrote:

I thought the reason for setting this property to true, was so the submit would 
skip the
validation phase, but that doesn't work for me...

I have the following...:

h:selectOneMenu accesskey=D value=#{bean.domainID} immediate=true 
onchange=submit();
f:selectItems value=#{selectMain.listDomain}/
/h:selectOneMenu

h:inputText id=text value=#{bean.name} size=40 maxlength=40 
required=true
f:validateLength minimum=3 maximum=30 /
/h:inputText

But when I change a value in the drop down box, the validation still occurs...
Does anyone know why?


Regards,

BTJ


Does not work that way... but I just had the same problem, there is a 
simple workaround to the validation problem, if you want some kind of 
cancel functionality, just bind the controls which you have to turn off

to the backend bean and if you want to bypass validation turn off
the validation on the controls directly, that way I could get a nice
cancel functionality although several fields of my form were
set to required...


Werner



Re: Concerning DataModel usage plus overhead?

2005-08-31 Thread Sylvain Vieujot




Hello,

I'm not sure I understand your problem, but I'll try to explain what I can :

If your problem is that in fields in a table, only the first field is updated, then this has nothing to do with forceIndexFormula, and it might very well be a bug. I had a similar problem, but I didn't take the time to dig into it. Another probable bug is that the table content is only updated on the second request. This too might be a bug, and I didn't had time to check it either.

The problem solved by forceIndexFormula is when the backend data can change between requests (order changes, or data insertion/deletion). It makes sure that the right row is updated. This is explained a the bottom of the t:dataTable doc :
http://myfaces.apache.org/tomahawk/extDataTable.html

HTH

Sylvain.

On Wed, 2005-08-31 at 08:53 +0200, Martin Marinschek wrote:


Kevin,

I am trying to get Sylvain involved in this to explain
forceIndexFormula better (hint: this should be in the documentation ;)
- but I believe that his solution is somewhat similar to your
suggestion!

Particularly, you just get the id of the data row as part of the
client-id in your action, and it is your responsibility then to fetch
this row!

regards,

Martin



On 8/30/05, Kevin Galligan [EMAIL PROTECTED] wrote:
 My brain is very struts centric as well.  There's some things I like
 about the JSF model too though.  Thats why I'm probably landing
 somewhere in between.
 
 I generally avoided session scoping anything that didn't need to be,
 which I guess is my big reservation with JSF.  I know exactly what you
 mean with the lazy list in the form.  You do have some extra effort
 involved, like building the property string on the input objects and
 tracking the id's in a hidden input component, but there's not as much
 going on behind the curtain either.
 
 I think that's enough for today though...
 
 Rick Reumann wrote:
  On 8/30/05, Kevin Galligan [EMAIL PROTECTED] wrote:
 
 
 I think updating several rows at the same time, which might require
 local copies of the data, and just linking are two different things.
 They might need two different components.
 
 
  With Struts this was a piece of cake. Your ActionForm has a bean
  property that is a List of the objects you want to update (Helps if
  it's a LazyList if not using session scope), and when your form
  submits BeanUtils (in the background) simply copies your form objects
  to the List in the Action form. Super simple imo.
 
  The only slightly tricky part is validation, but I always provide a
  manual validation method in my Action classes so this was easy to
  handle.
 
 








Re: url query string parameters as input to JSF action - not possible??

2005-08-31 Thread Gary VanMatre
Thank you for your opinions

I have a few notes:

   1) If you need to invoke an action method you should definitely use 
 h:commandLink or h:commandButton BUT is it necessary to call an action method 
 whenever you need to move to a different page?
  * using outputLink to navigate to a different page (plus specifying page 
 name + parameters explicitly) is not the best way BUT what if we would use 
   y:navigation method=GET navigationResult=detailPage 
 value=#{item.label} 
f:param name=itemName value=#{item.name} /
f:param name=itemCategory value=#{item.category} /
  /y:navigation - this could render as simple link a 
 href=detailPage.jsp?itemName=FerrariF50?itemCategory=SportsCarsFerrari 
 F50/a

   2) Personally, I consider our solution as a hack from the point of view of 
 JSF BUT what if your application is REQUIRED to support links like 
 page.jspparameters= ...? (this requirement is pretty valid and useful!) Is 
 it impossible to achieve this neatly using JSF (MyFaces)???

I think code is sometimes like a cup of coffee.  The taste is a unique 
experience.  I wouldn't say that creating a custom JSF component is a hack.  
JSF just give you several methods to accomplish page navigation.

If you favor classic struts, you might prefer something like this:


h:outputLink value=detailPage.jsp
   f:param name=itemName value=#{bean.productName}/
   f:param name=itemId value=#{bean.productId}/

   f:verbatimView acme widget/f:verbatim
/h:outputLink
  

managed-bean
description
This class simulates the classic Struts FormBean where
request parameters are populated in a POJO object. 
/description
managed-bean-nameformBean/managed-bean-name
managed-bean-classxxx.MyFormBean/managed-bean-class
managed-bean-scoperequest/managed-bean-scope
managed-property
property-nameproductId/property-name
value#{param.itemId}/value
/managed-property
managed-property
property-nameproductName/property-name
value#{param.itemName}/value
/managed-property

/managed-bean


Gary






---BeginMessage---
Thank you for your opinions

I have a few notes:

 1) If you need to invoke an action method you should
definitely use h:commandLink or h:commandButton BUT is it necessary to
call an action method whenever you need to move to a different page?
 * using outputLink to navigate to a
different page (plus specifying page name + parameters explicitly) is
not the best way BUT what if we would use 

y:navigation method=GET navigationResult=detailPage
value=#{item.label} 
 f:param name=itemName value=#{item.name} /
 f:param name=itemCategory value=#{item.category} /

/y:navigation - this could render as simple link a
href=""
F50/a

 2) Personally, I consider our solution as a hack from the
point of view of JSF BUT what if your application is REQUIRED to
support links like page.jspparameters= ...? (this requirement is
pretty valid and useful!) Is it impossible to achieve this neatly
using JSF (MyFaces)???
MNOn 8/30/05, Gary VanMatre [EMAIL PROTECTED] wrote:
  snip I'm still a bit confused on how you deal with links that go to backing bean methods for standard links/buttons. As an example, imagine the header on a page...
 John Doe[edit user] [logs for user] [user summary][look up company] 1455 some address[edit address] Somewhere, state, 12456 The example above is a bit exaggerated, but the point is the links(or
 even buttons) would have to access methods in all different kinds of backing beans. You might give the commandLink component a try.h:commandLink id=editUser action=""
somBean.editUser}h:outputText value=edit user//h:commandLinkh:commandLink id=logsForUser action="">h:outputText value=logs for user/
/h:commandLink -- RickGary
---End Message---


Re: JSF + Spring + Hibernate

2005-08-31 Thread Ken Weiner
I have a question about designing a webapp to use a DAO layer, lazily
loaded objects, Hibernate, and the OpenSessionInView technique.

Doesn't this strategy make it very difficult to reimplement the DAO
layer sometime in the future? If you switched a DAO
implementation from Hibernate to let's say, Spring JDBC, then how would
all the lazy loading work? There would be no equivalent
OpenSessionInView technique for Spring JDBC. For this reason, I
have been shying away from designing my domain objects such that the
rest of the app expects them to lazily load data.

So, instead of a Company class having a getEmployees() method, I would
choose, instead, to have a CompanyDao.getEmployees(Company company)
method that must be called at the point my webapp needs all the
Employees for a Company.

Have any of you had the same concerns? Or am I missing how a
webapp that relies on lazy-loaded object graphs can change DAO
implementations easily?

-Ken


Re: JSF + Spring + Hibernate

2005-08-31 Thread Larry Meadors
Heheh, are you suggesting that making your DAO layer depend upon your
view layer is a bad idea?

I would have to agree

Larry


On 8/31/05, Ken Weiner [EMAIL PROTECTED] wrote:
 I have a question about designing a webapp to use a DAO layer, lazily loaded
 objects, Hibernate, and the OpenSessionInView technique.
  
  Doesn't this strategy make it very difficult to reimplement the DAO layer
 sometime in the future?  If you switched a DAO implementation from Hibernate
 to let's say, Spring JDBC, then how would all the lazy loading work?  There
 would be no equivalent OpenSessionInView technique for Spring JDBC.  For
 this reason, I have been shying away from designing my domain objects such
 that the rest of the app expects them to lazily load data.
  
  So, instead of a Company class having a getEmployees() method, I would
 choose, instead, to have a CompanyDao.getEmployees(Company company) method
 that must be called at the point my webapp needs all the Employees for a
 Company.
  
  Have any of you had the same concerns?  Or am I missing how a webapp that
 relies on lazy-loaded object graphs can change DAO implementations easily?
  
  -Ken



Thanks and a best practice question in regard to set up of backing bean Actions

2005-08-31 Thread Rick Reumann
Thanks everyone for your help with the crud demo app I've been working
with. (Special thanks to Brendan for his fine Car example code that
he posted in another thread).

I want to start out on the right foot doing things in a 'correct' way
before I get into some bad practices.

Currently, I have a list of employees in a table you click on the
employee and a backing bean method gets the correct row, grabs the id,
gets the true larger Employee object back, then forwards to an
Employee form where you can edit the employee info.

What I'm debating about his how to best set up the backing bean that
supports the 'save' of this form. Currently it's part of an
EmployeeAction object and the pertinent code looks like:

EmployeeAction.java
--
private EmployeeVO employee = new EmployeeVO();
private EmployeesListBean empListBean;

public EmployeesListBean getEmployeesListBean() {
return empListBean;
}

public void setEmployeesListBean(EmployeesListBean empListBean) {
this.empListBean = empListBean;
}

public EmployeeVO getEmployee() {
return employee;
}

public void setEmployee(EmployeeVO employee) {
this.employee = employee;
}

public String prepareForEdit() {
log.debug(prepareForEdit);
this.employee =
(EmployeeVO)getEmployeesListBean().getEmployeesModel().getRowData();
//get Employee from backend
this.employee = EmployeeService.getEmployee( employee.getId() );
log.debug(returned employee = +employee );
return success;
}

public String saveAction() {
//need way to tell update vs insert ?
log.debug(In saveAction );
EmployeeService.updateEmployee(employee);
return success;
}

The prepareForEdit method is called from a link next to the name of
each employee on the employees.jsp. After clicking the link the
success result will navigate you to emloyeeForm.jsp...

The part I'm not so sure about is the setup of the EmployeeAction..
I'm having to initialize EmployeeVO employee = new EmployeeVO(); 
because if I don't have this, I'll end up with conversion errors since
the employee is null when the form submits. Is it better to not create
this new instance and maybe use saveState on the form instead?

Also on the form I'm doing...

h:inputText value=#{employeeAction.employee.name}/

I like the above since it saves me from having to add extra set/gets
in my EmployeeAction class to deal with the EmployeeVO nested inside
of EmployeeAction.However maybe there are some major drawbacks to
doing it that way I've implemented it?

Thanks for any comments.


Re: JSF + Spring + Hibernate

2005-08-31 Thread Werner Punz

Actually some valid points here, but the whole
opensessioninviewfilter technique is more like
a keep the session open as long as possible technique, so
that you do not have to care about it anywhere.

so basically what happens is following, that
normally you have the problem of keeping track of prefetching etc...
and often the session handling on dao level,
now the session handling is moved into the request cycle and now should 
be fully transparent to the user (not allways but often enough)


the benefit you get from this, is that you do not run into the lazy 
loading issues as often as with small dedicated sessions...


So what happens if you move lets say from Hibernate to plain JDBC...
you simple remove the opensessioninview filter
and from the outside you handle the pojos the same, all which happens is
that you replace lots of lazy loaded classes and some dao code with
the same classes prefilled from the jdbc connection...

the OpenSessionInView filter basically just eases the pain of having to 
keep track of lazily loaded classes in many instances (not in all)

but besides that is rather transparent to the implementation if done well...

I wil give you an example

without OpenSessionInView...

load some person classes

getHibernateTemplate().load(Person.class, id);

with OpenSessionInView

getHibernateTemplate().load(Person.class, id);


the main difference is, that if person in the first case references 
another bunch of lazy objects

like:
person.getAddress().getStreetName()...
you might get an error while rendering the data or doing something with it


in the second case you wont get the error, because the lazy loading 
still can be done due to the open session.


ideal would be to have some kind of session per session filter
but in most circumstances that is not possible, so opensessioninview
is the second best choice you can get.



Werner




Ken Weiner wrote:
I have a question about designing a webapp to use a DAO layer, lazily 
loaded objects, Hibernate, and the OpenSessionInView technique.


Doesn't this strategy make it very difficult to reimplement the DAO 
layer sometime in the future?  If you switched a DAO implementation from 
Hibernate to let's say, Spring JDBC, then how would all the lazy loading 
work?  There would be no equivalent OpenSessionInView technique for 
Spring JDBC.  For this reason, I have been shying away from designing my 
domain objects such that the rest of the app expects them to lazily load 
data.


So, instead of a Company class having a getEmployees() method, I would 
choose, instead, to have a CompanyDao.getEmployees(Company company) 
method that must be called at the point my webapp needs all the 
Employees for a Company.


Have any of you had the same concerns?  Or am I missing how a webapp 
that relies on lazy-loaded object graphs can change DAO implementations 
easily?


-Ken




Re: Problem with t:div

2005-08-31 Thread Bruno Aranda
I've just tried to reproduce this problem with the latest SVN and
everything seems to be working ok. What server are you using? Are
there any old myfaces jars in the classpath?

Bruno

2005/8/31, [EMAIL PROTECTED] [EMAIL PROTECTED]:
 Hello all,
 
 I am using the latest Night build. On a Page with a t:div I get first a lot
 of warnings:
 
 WARN [2005-08-31 18:07:13,685] HtmlRenderKitImpl - Unsupported
 component-family/renderer-type:
 javax.faces.Output/org.apache.myfaces.DivRenderer
  WARN [2005-08-31 18:07:13,685] HtmlRenderKitImpl - Unsupported
 component-family/renderer-type:
 javax.faces.Output/org.apache.myfaces.DivRenderer
 
 
 and then a lot of errors till a stack overflow error:
 
 at org.apache.myfaces.custom.div.Div.getClientId(Div.java:54)
   at javax.faces.component.UIComponentBase.getRenderer(
 UIComponentBase.java:531)
   at org.apache.myfaces.custom.div.Div.getClientId(Div.java:54)
 java.lang.StackOverflowError
 
 Is this a bug or I am doing something wrong?
 
 Regards,
 Marc
 



Re: best way to initialize BackingBean?

2005-08-31 Thread Craig McClanahan
On 8/31/05, Ken Weiner [EMAIL PROTECTED] wrote:
The Spring JSF integration I've seen focuses on enabling Spring IoC for
JSF managed beans. There is a way to enable IoC for JSF
Converters, Validators, and UIComponents too. I posted
information on the Spring JSF Wiki: http://opensource.atlassian.com/confluence/spring/x/Qgo

I was hoping Spring would incorporate the SpringApplication and
SpringApplicationFactory code in a future release, but there haven't
yet been comments on the Wiki page.

For converters, isn't this already possible out of the box (if you've got the Spring IoC integration with managed beans)?

 h:inputText ... converter=#{myConverter} .../

where myConverter is a spring bean. 

For validators, you can bind to a validator *method* of some bean that happens to be created via the IoC facility.

-Ken
Craig



RE: Highlight datatable row based on business logic

2005-08-31 Thread CONNER, BRENDAN \(SBCSI\)
Title: Message



If you 
use t:column instead of h:column, you can specify a style, and, 
if you combine thisa rendered="#{myBean.styleQuery}" attribute setting, 
then you can conditionally set a style for that cell. That's as far as 
we've gotten in being able to set styles dynamically in a 
table.

- 
Brendan

  
  -Original Message-From: Matt Cronin 
  [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 31, 2005 1:03 
  PMTo: users@myfaces.apache.orgSubject: Highlight 
  datatable row based on business logicI have seen that the 
  datatable allows highlighting of rows, but all the examples seem to highlight 
  alternate rows. I would like to highlight specific rows based on 
  business logic. Is there a way to do this with the datatable? 



RE: JSF + Spring + Hibernate

2005-08-31 Thread Joshua Davis
You can also use transfer objects with your DAOs, or turn lazy loading off
for certain classes or collections that you are using as transfer objects.
Either approach will eliminate the need for OpenSessionInView-like things
and enable you to switch DAO implemenations.   The right choice depends on
how much work you are willing to do in order to be able to switch DAO
implementations.

 -Original Message-
 From: news [mailto:[EMAIL PROTECTED] On Behalf Of Werner Punz
 Sent: Wednesday, August 31, 2005 1:52 PM
 To: users@myfaces.apache.org
 Subject: Re: JSF + Spring + Hibernate
 
 well OpenSessionInView... is one of those rare circumstances 
 where it actually makes sense, because it eases the 
 portability and implementation...
 
 I would not say it reall is dependend on the view layer, more 
 on the control layer of the server...
 It is one of those border cases...
 
 
 Larry Meadors wrote:
  Heheh, are you suggesting that making your DAO layer depend 
 upon your
  view layer is a bad idea?
  
  I would have to agree
  
  Larry
  
  
  On 8/31/05, Ken Weiner [EMAIL PROTECTED] wrote:
  
 I have a question about designing a webapp to use a DAO 
 layer, lazily loaded
 objects, Hibernate, and the OpenSessionInView technique.
  
  Doesn't this strategy make it very difficult to 
 reimplement the DAO layer
 sometime in the future?  If you switched a DAO 
 implementation from Hibernate
 to let's say, Spring JDBC, then how would all the lazy 
 loading work?  There
 would be no equivalent OpenSessionInView technique for 
 Spring JDBC.  For
 this reason, I have been shying away from designing my 
 domain objects such
 that the rest of the app expects them to lazily load data.
  
  So, instead of a Company class having a getEmployees() 
 method, I would
 choose, instead, to have a CompanyDao.getEmployees(Company 
 company) method
 that must be called at the point my webapp needs all the 
 Employees for a
 Company.
  
  Have any of you had the same concerns?  Or am I missing 
 how a webapp that
 relies on lazy-loaded object graphs can change DAO 
 implementations easily?
  
  -Ken
 
  
  
 
 




Re: JSF + Spring + Hibernate

2005-08-31 Thread Ken Weiner
The issue I was getting at was that knowing that your app has this lazy
loading capability, you may make different design decisions on what
methods go into your domain objects and what your domain object graph
looks like. I prefer to design the domain object graphs, keeping in
mind that the DAO layer would be responsible for completely loading the
graphs. So if there are many Employees for a Company and you
don't always want to load the Employees when you load a Company, then I
probably wouldn't put a getEmployees() method on the Company
class. I guess you could argue that it is okay to add the
getEmployees() method and document it so that sometimes it returns null
and sometimes it doesn't, but that seems undesireable to me. I'd
rather leave off the method and add an extra method to a DAO that can
fetch the employees for a Company whenever I need them.

-KenOn 8/31/05, Werner Punz [EMAIL PROTECTED] wrote:
well OpenSessionInView... is one of those rare circumstances where itactually makes sense, because it eases the portability and implementation...I would not say it reall is dependend on the view layer, more on the
control layer of the server...It is one of those border cases...Larry Meadors wrote: Heheh, are you suggesting that making your DAO layer depend upon your view layer is a bad idea?
 I would have to agree Larry On 8/31/05, Ken Weiner [EMAIL PROTECTED] wrote:I have a question about designing a webapp to use a DAO layer, lazily loaded
objects, Hibernate, and the OpenSessionInView technique. Doesn't this strategy make it very difficult to reimplement the DAO layersometime in the future?If you switched a DAO implementation from Hibernate
to let's say, Spring JDBC, then how would all the lazy loading work?Therewould be no equivalent OpenSessionInView technique for Spring JDBC.Forthis reason, I have been shying away from designing my domain objects such
that the rest of the app expects them to lazily load data. So, instead of a Company class having a getEmployees() method, I wouldchoose, instead, to have a CompanyDao.getEmployees
(Company company) methodthat must be called at the point my webapp needs all the Employees for aCompany. Have any of you had the same concerns?Or am I missing how a webapp that
relies on lazy-loaded object graphs can change DAO implementations easily? -Ken


Re: JSF + Spring + Hibernate

2005-08-31 Thread Werner Punz

Joshua Davis wrote:

You can also use transfer objects with your DAOs, or turn lazy loading off
for certain classes or collections that you are using as transfer objects.
Either approach will eliminate the need for OpenSessionInView-like things
and enable you to switch DAO implemenations.   The right choice depends on
how much work you are willing to do in order to be able to switch DAO
implementations.



I still do not see the problem of the opensessioninview filter...
the method is totally transparent, and if you are in need
for a different dao layer, then simply turn it off on the pages
where you already have replaced the layer.
The filter itself, just simplifies the handling of lazy loaded
objects in a transparent way to the programmer, so that he in most cases
does not have to care anymore if the object is lazily bound or not.

Werner



Re: best way to initialize BackingBean?

2005-08-31 Thread Dennis_Byrne


   h:inputText ... converter=#{myConverter}
.../

If I have a converter configured as myConverter in
faces-config.xml, it looks like this

h:inputText ... converter=myConverter
.../

Under which circumstances are the #{} needed?



Re: best way to initialize BackingBean?

2005-08-31 Thread Ken Weiner
I hadn't thought of that. I guess it would work fine when you
want to specify a converter by ID. However, it wouldn't work when
JSF looks for a converter by Class, would it?On 8/31/05, Craig McClanahan [EMAIL PROTECTED] wrote:
On 8/31/05, Ken Weiner 
[EMAIL PROTECTED] wrote:

The Spring JSF integration I've seen focuses on enabling Spring IoC for
JSF managed beans. There is a way to enable IoC for JSF
Converters, Validators, and UIComponents too. I posted
information on the Spring JSF Wiki: http://opensource.atlassian.com/confluence/spring/x/Qgo

I was hoping Spring would incorporate the SpringApplication and
SpringApplicationFactory code in a future release, but there haven't
yet been comments on the Wiki page.

For converters, isn't this already possible out of the box (if you've got the Spring IoC integration with managed beans)?

 h:inputText ... converter=#{myConverter} .../

where myConverter is a spring bean. 

For validators, you can bind to a validator *method* of some bean that happens to be created via the IoC facility.


-Ken
Craig





Re: best way to initialize BackingBean?

2005-08-31 Thread Craig McClanahan
On 8/31/05, Ken Weiner [EMAIL PROTECTED] wrote:

I hadn't thought of that. I guess it would work fine when you
want to specify a converter by ID. However, it wouldn't work when
JSF looks for a converter by Class, would it?
If you are using by-Class converters, you don't need to register them
on the *component* at all -- they get registered in the Application
instance along with the class they are for. I'm not sure I see a
need to use a DI framework to instantiate those, since you already have
the ability to configure the implementation class that will be used.

For converters registered by id, see my next response to a a separate question in this thread.

Craig




Re: best way to initialize BackingBean?

2005-08-31 Thread Mike Kienenberger
On 8/31/05, Craig McClanahan [EMAIL PROTECTED] wrote:
  If you are using by-Class converters, you don't need to register them on
 the *component* at all -- they get registered in the Application instance
 along with the class they are for.  I'm not sure I see a need to use a DI
 framework to instantiate those, since you already have the ability to
 configure the implementation class that will be used.

Craig,

Can you expand on this?  What do I need to do to gain the ability to
configure the implementation class?

I have lots of converters registered by class, and I want to DI a
managed JSF bean into each of them.   How do I do this?

-Mike


Re: best way to initialize BackingBean?

2005-08-31 Thread Craig McClanahan
On 8/31/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


   h:inputText ... converter=#{myConverter}
.../

If I have a converter configured as myConverter in
faces-config.xml, it looks like this

h:inputText ... converter=myConverter
.../

Under which circumstances are the #{} needed?



If you have a converter registered by id, you would not need the
#{...} _expression_ capability. But, that limits you to an
instance of the converter that is essentially created like what you'd
get from a new operator, with only the default set of
properties. What if you want to use some Converter class, but
customize its property settings?

This question surfaces an interesting (and not always understood) feature of the converter property:

* If you pass a literal string, JSF looks up a converter that you
 have registered by id in some faces-config.xml file.

* If you pass a value binding _expression_, JSF evaluates it
 at runtime and expects the evaluation to return an instance
 of type javax.faces.convert.Converter.

Even without Spring in the picture, that means you can declare a
managed bean named myConverter that will be instantiated on demand
(when the #{myConverter} is evaluated). Just to give a trivial
example of this, lets assume your model data is of type java.util.Date,
but you always want to display it showing the time only (i.e. if you're
using the standard DateTimeConverter, you would set the type property
to time. You can define a component like this:

 h:inputText ... converter=#{timeConverter} .../

and then define a managed bean in your faces-config.xml file:

 managed-bean
 managed-bean-nametimeConverter/managed-bean-name

managed-bean-classjavax.faces.convert.DateTimeConverter/managed-bean-class
 managed-bean-scopenone/managed-bean-scope
 managed-property
 property-nametype/property-name
 valuetime/value
 /managed-property
 /managed-bean

and you'll get a preconfigured converter that does the right thing,
without having to remember to set the property every single time.
For extra fun, you can use value binding expressions in the
value element, to initialze property values based on dynamic
conditions. JSF's managed beans, in other words, *provide* a
simple Dependency Injection (DI) or Inversion of Control (IoC)
framework out of the box.

If you include the Spring IoC integration along with JSF, you can still
do the above ... or, you can use the standard Spring configuration file
to instantiate a Spring bean named timeConverter, configured using
the full power of DI that Spring offers (for example, you can
instantiate an instance that uses constructor injection instead of
setter injection). That's because the integration layer will
first look to see if there is a managed bean definition for a given
name and, if not, check to see if Spring knows how to create one.
The developer who writes the value bnding _expression_ into the JSP page
does not have to know or care which mechanism is actually used to
create the converter for you at runtime.

Craig



RE: Thanks and a best practice question in regard to set up of backing bean Actions

2005-08-31 Thread CONNER, BRENDAN \(SBCSI\)
You'll also want an EmployeeBean as a managed bean, which can be defined
as having type EmployeeVO.

Then you'll want your EmployeeAction to have a managed reference to
EmployeeBean, and don't instantiate that; let JSF do that.  And don't
instantiate it; let JSF do that.  Then, when the user hits Save, JSF
will automatically populate your EmployeeBean with the correct values
(assuming your JSF page uses EmployeeBean), and your save() method can
just refer to the EmployeeBean values.

- Brendan

-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 31, 2005 12:48 PM
To: MyFaces Discussion
Subject: Thanks and a best practice question in regard to set up of
backing bean Actions


Thanks everyone for your help with the crud demo app I've been working
with. (Special thanks to Brendan for his fine Car example code that
he posted in another thread).

I want to start out on the right foot doing things in a 'correct' way
before I get into some bad practices.

Currently, I have a list of employees in a table you click on the
employee and a backing bean method gets the correct row, grabs the id,
gets the true larger Employee object back, then forwards to an
Employee form where you can edit the employee info.

What I'm debating about his how to best set up the backing bean that
supports the 'save' of this form. Currently it's part of an
EmployeeAction object and the pertinent code looks like:

EmployeeAction.java
--
private EmployeeVO employee = new EmployeeVO();
private EmployeesListBean empListBean;

public EmployeesListBean getEmployeesListBean() {
return empListBean;
}

public void setEmployeesListBean(EmployeesListBean empListBean) {
this.empListBean = empListBean;
}

public EmployeeVO getEmployee() {
return employee;
}

public void setEmployee(EmployeeVO employee) {
this.employee = employee;
}

public String prepareForEdit() {
log.debug(prepareForEdit);
this.employee =
(EmployeeVO)getEmployeesListBean().getEmployeesModel().getRowData();
//get Employee from backend
this.employee = EmployeeService.getEmployee( employee.getId() );
log.debug(returned employee = +employee );
return success;
}

public String saveAction() {
//need way to tell update vs insert ?
log.debug(In saveAction );
EmployeeService.updateEmployee(employee);
return success;
}

The prepareForEdit method is called from a link next to the name of
each employee on the employees.jsp. After clicking the link the
success result will navigate you to emloyeeForm.jsp...

The part I'm not so sure about is the setup of the EmployeeAction..
I'm having to initialize EmployeeVO employee = new EmployeeVO(); 
because if I don't have this, I'll end up with conversion errors since
the employee is null when the form submits. Is it better to not create
this new instance and maybe use saveState on the form instead?

Also on the form I'm doing...

h:inputText value=#{employeeAction.employee.name}/

I like the above since it saves me from having to add extra set/gets
in my EmployeeAction class to deal with the EmployeeVO nested inside
of EmployeeAction.However maybe there are some major drawbacks to
doing it that way I've implemented it?

Thanks for any comments.


Re: best way to initialize BackingBean?

2005-08-31 Thread Mike Kienenberger
On 8/31/05, Craig McClanahan [EMAIL PROTECTED] wrote:
  In other words, you want to use DI for configuring properties on a by-class
 converter?  That, sadly, isn't supported unless you were to override the
 Application instance provided by your JSF impementation (or if your JSF
 implementation provided this feature as part of its own implementation, hint
 hint :-).  The technique I described doesn't reference any by-id or by-type
 registered converters ... it creates anonymous instances.

Yeah, after I sent the message, I saw that we were discussion two
separate issues.
DI of managed beans into a by-class converter was what I was referring
to as a weakness in JSF converter/managed-beans configuration, and not
injecting the converter into something else.

Ken Weiner's methodology looks like it can solve this problem (which,
as you repeat above, it does by overriding the Application instance).


RE: ajax ajax ajax

2005-08-31 Thread Balaji Kalyansundaram



Hi
Enrique

I'm
not developing using Ajax.But I found the components in http://wiki.apache.org/myfaces/AJAX_Framework
working in Firefox. So I though that it is not the issue with
Firefox 1.0.6.

Balaji

  -Original Message-From: Enrique Medina
  [mailto:[EMAIL PROTECTED]Sent: Wednesday, 31 August 2005 11:02
  PMTo: MyFaces DiscussionSubject: Re: ajax ajax
  ajaxHi Balaji,I have just downloaded Firefox
  1.0.6 and still doesn't work for me...Could you please post a quick
  step-by-step guide of your configuration?Thanks.
  2005/8/31, Balaji Kalyansundaram [EMAIL PROTECTED]:
  
It works in Firefox
1.0.6


  -Original
  Message-From: Enrique Medina [mailto:[EMAIL PROTECTED]]Sent: Tuesday, 30 August
  2005 8:48 PMTo: MyFaces DiscussionSubject: Re: ajax
  ajax ajaxAlso is not working for me in Firefox 1.0
  :-(Error: [Exception... "Component returned failure code:
  0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.getResponseHe
  ader]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"
  location: "JS frame :: http://localhost:8080/DeltaR/faces/myFacesExtensionResource/ajax.UIAjaxViewComponent/11245933/JSFAJAX.js
  :: anonymous :: line 48" data: no]Source File: http://localhost:8080/DeltaR/faces/myFacesExtensionResource/ajax.UIAjaxViewComponent/11245933/JSFAJAX.js
  Line: 48where the source line is:  	  var idsFromResponse = req.getResponseHeader("Ajax-Update-Ids");
  2005/8/30, Arash Bijanzadeh [EMAIL PROTECTED]:
  
On 8/15/05, Werner Punz [EMAIL PROTECTED] 
wrote:

Just
  checked the wiki again, some russian guy postedlinks to his
  projectthat stuff looks really interestinghttp://wiki.apache.org/myfaces/AJAX_Framework
  It is not working on mozilla
1.7.8 with error message AJAX not found!--
from debian manifesto:Debian Linux is a brand-new kind of Linux
distribution. Rather than being developed by one isolated individua
l or group, as other distributions of Linux have been developed in
thepast, Debian is being developed openly in the spirit of Linux and
GNU. 

  
  
This correspondence is for the
  named persons only. It may contain confidential or privileged
  information or both. No confidentiality or privilege is waived or
  lost by any mis transmission. If you receive this correspondence
  in error please delete it from your system immediately and notify the
  sender. You must not disclose, copy or relay on any part of this
  correspondence, if you are not the intended recipient. Any
  opinions expressed in this message are those of the individual sender
  except where the sender expressly, and with the authority, states
  them to be the opinions of the Department of Emergency Services,
  Queensland.

This correspondence is for the named persons only. 
It may contain confidential or privileged information or both. 
No confidentiality or privilege is waived or lost by any mis transmission. 
If you receive this correspondence in error please delete it from your system immediately and notify the sender. 
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. 
Any opinions expressed in this message are those of the individual sender except where the sender expressly, 
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.


Re: saveState confusion/question

2005-08-31 Thread Mike Kienenberger
How's it breaking?  The little info that you've provided seems fine.

However, you might find it more efficient to do this since you're
doing the same thing with an hidden field.

x:saveState id=employee value=#{employeeAction.employee.id}/

-Mike

On 8/31/05, Rick Reumann [EMAIL PROTECTED] wrote:
 I'd like to use saveState to avoid having to use hidden vars on a form...
 
 h:inputText value=#{employeeAction.employee.name}/
 h:inputText value=#{employeeAction.employee.id}/ --- use saveState 
 instead?
 
 EmployeeAction has a reference to Employee:
 
 managed-bean
 managed-bean-nameemployeeAction/managed-bean-name
 managed-bean-classnet.reumann.EmployeeAction/managed-bean-class
 managed-bean-scoperequest/managed-bean-scope
 managed-property
 property-nameemployeesListBean/property-name
 value#{employeesListBean}/value
 /managed-property
 managed-property
 property-nameemployee/property-name
 value#{employee}/value
 /managed-property
 /managed-bean
 
 I have both EmployeeAction and Employee implementing Serializable.
 
 I've tried
 
 x:saveState id=employeeAction value=#{employeeAction}/
 
 and
 
 x:saveState id=employee value=#{employeeAction.employee}/
 
 I'm having difficulty getting saveState to work. Any tips much appreciated.
 
 Things work fine if use the hidden vars.



Cannot sort x:DataTable Page structure issue?

2005-08-31 Thread Christian
Hello everyone,

Problem: I want to use the x:DataTable tag. It works, with and without
J-Script, if I use the page structure of the myfaces example (see below)
with my managed bean. -So far so good -. If i copy and paste the working
x:DataTable-Tag in my page structure (see below), to the place where I
want it to appear, it is displayed correctly the first time but cannot
be sorted, i.e. the sort-page-respose does not contain any change,
neither with client or server-side state saving, neither with or without
J-Script.

Question: Any ideas? 
 
Note1: I wrote the managed bean referring to the example extending an
abstract sortablelist. The problem does not seem to be here.   

Note2: My page structure is more complicated than the example, due to
the fact that I use tiles with the myfaces JspTilesViewHandlerImpl. 

Note3: I used to have many struggles with my page structure in the past.
I thought I'd done it right now. 

Thanks to all of you in advance
Regards
Christian

Myfaces example page structure
--
%@ taglib... %
html
 body
  f:view
   f:loadBundle .../
 x:dataTable styleClass=standardTable
  // code according to example 
 /x:dataTable
  /f:view
 /body
/html

My Structure

html
f:view
  head
   link rel=stylesheet .../
 f:loadBundle ... /
 title h:outputText ...//title
  /head
   body
 f:subview
  h:form
   h:panelGrid

f:facet name=header 
  h:panelGrid
  []  
  /h:panelGrid
/f:facet

f:subview id=menu
  h:panelGrid
  []  
  /h:panelGrid
/f:subview

f:subview id=content 
x:dataTable styleClass=standardTable
### code according to example ###
/x:dataTable  
/f:subview

f:facet name=footer
 h:panelGroup styleClass=footer 
   []
 /h:panelGroup
/f:facet

   /h:panelGrid
  /h:form
 /f:subview
   /body
/f:view
/html



RE: JSF + Spring + Hibernate

2005-08-31 Thread Joshua Davis
 The scope of the Hibernate session must match the scope of 
 any lazily 
 loaded objects or collections.  That's one of the rules of Hibernate 
 (or any other ORM that I've used, for that matter).  Putting a proxy 
 object in web session scope while the Hibernate session is 
 in request 
 scope breaks that rule.  You need to either use a transfer 
 object, or 
 cause Hibernate to initialize the proxy by either setting 
 the lazy attribute to false, or using
 Hibernate.initialize().   You can also re-associate the 
 object with the
 Hibernate session as was mentioned before.
 
 [EMAIL PROTECTED]
 
 
   
 
 I think you may have skipped the rest of my email.  I 
 detailed the ways I'm working around that.

Yep, I read it.

  I understand it 
 breaks the Hibernate contract, I was merely mentioning it as 
 a possible issue because everyone had simply been talking 
 about problems within a single request.  I just wanted to 
 point out that that is not the only issue with lazily loaded 
 objects and you need to be careful about putting them in the 
 HTTP session.
 
 What do you mean by use a transfer object? 

Transfer Object is a design pattern frequently used with EJB:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html
.
Your managed beans could copy the Hibernate-mapped objects (I call them
Persistent Domain Objects) into simple POJOs that aren't mapped.  Leave
these in the session, stick them in a cache, store them in base64 encoded
hidden input fields, or whatever.

 That's the 
 first time I've ever heard anyone mention that.  The problem 
 with telling Hibernate to initialize the object graph is 
 that, in most cases I think, the use of Hibernate is 
 abstracted away from the webapp layer.  So your backing beans 
 don't really know they need to do that and even if they did 
 they couldn't.

The DAO should do it.  The backing beans (business session pattern) can ask
the DAO to do it in an abstract way.

  And setting the lazy attribute to false is a 
 workaround, but could lead to large graphs being loaded into 
 many users HTTP sessions.  

This works for simple graphs only.  For complex graphs, your DAO (which is
the only thing in your system that should import Hibernate) can pick and
chose which objects to initialize.   What this is doing is essentially
turning your PDOs into Transfer Objects.

 Reassociating the object with the session has a similar 
 problem as trying to initialize the object from within the 
 webapp layer before putting it in the session.  Your webapp 
 simply does not know that you are using Hibernate.  And even 
 if it did, it has no access to the actual Hibernate session.
 I toyed around at one time with the idea of trying to create 
 a servlet filter that would automatically reassociate 
 anything in the HTTP session with the Hibernate session.  
 There are a couple of problems with that tho.  First off, 
 it's not always easy to determine what objects are Hibernate 
 persisted objects and which aren't.  Second, if the actual 
 Hibernate object is wrapped in a backing bean that is 
 actually put in the HTTP session simply scanning objects in 
 the HTTP session won't work.  Finally, what convinced me it 
 was a bad idea is that the only ways to reassociate an object 
 with a Hibernate session that I was able to find is to use 
 merge(), update(), or lock().  The first two will update the 
 database with the object you provide, and locking requires 
 the underlying data in the db hasn't changed.  So you'd lose 
 any changes that could have occured while the object was in 
 the session.

Yikes! That sounds complicated.  ;)
The only reason you would want to reassociate the objects is if you want to
update them.  If you are just using the session as a cache, then these
objects should not be mapped.   That will cause all kinds of headaches.

 So, like I said, just refetching the Hibernate objects for 
 each request is much easier and doesn't cause too much extra 
 load on the database if your using the 2nd level cache.

Bingo!  You've got it there.  To me, it makes sense to use Transfer Objects,
or at least make the integration layer (where the DAOs live) able to provide
initialized sub-graphs - mapped objects turned into Transfer Objects.
Which brings me back to JSF...  My current JSF application uses DAOs that
provide the mapped objects to the business beans.   These beans create
transfer objects that are accessed by the view.   When actions that require
db modification occur, the DAO is used to look up the object again and the
new values are set into the mapped object from the transfer object.  This is
a little bit more programming if you have a separate class for the mapped
object and the transfer object, but it's not much more work at all if you
use the initialized subgraph concept.  The benefit is that there is no need
for any fancy session reassociation or anything like that.   The
presentation layer and the persistence (integration) layer are 

Process the Submitted Data Table and Create Another List

2005-08-31 Thread Caroline Jen
I have create a data table A based on a List.  To
create this data table A with a checkbox in each row
of the table, I specify the following:

a. managed-bean-class: packageName.ListAction
b. managed-bean-name: listAction
c. The List is called personnel.  
d. The properties of the PersonnelBean are the columns
of data Table.  
e. I have a selected boolean property on the
PersonnelBean that can be used to mark which persons
have been selected.

I am going to submit all the data in table A,
iterate through all the rows and create another List
based on marked checkboxes.  And I have four questions
regarding how to process the data. My questions are
embedded in the code below.  For display ing the next
data table B that contains all the selected records
of data table A:

a. managed-bean-class: packageName.SelectAction. 
b. managed-bean-name: selectAction
c. The List to be created is called departPersonnel
[code]
import 
public class SelectAction
{
List departPersonnel = null;

public SelectAction()
{
SelectDelegate sd = new SelectDelegate();
// Question 1. Should I put the next two line
of code here?
//   or I should put the
next two line of code in the
// SelectDelegate
class and call the 
//
updateDepartPersonnel()
//   method of that class
without supplying a parameter?

DataModel personnelData =
ListAction().getPersonnel(); 
List personnel =
(List)personnelData.getWrappedData();

departPersonnel = sd.updateDepartPersonnel(
personnel );
}
// Question 2. A bean should have an empty
constructor and a pair of
//get and set methods for
each of its properties.  I 
//   certainly do not have an
empty constructor.  What is the
//   correct way of doing it? 

public List getDepartPersonnel()
{
return this.departPersonnel;
}

public void setDepartPersonnel( List data )
{
this departPersonnel= data;
}

}
[/code]
[code]
import .
public class SelectDelegate
{
List departPersonnel = null;

// Method to update all the selected personnel
records
public List updateDepartPersonnel() 
{
DataModel personnelData =
ListAction().getPersonnel();
List personnel =
(List)personnelData.getWrappedData();

// Iterate through the data rows ...
int first = 0;
int rows = personnel.size();
for (int index = first; index  (first +
rows); index++) 
{
// Question 3. Does the statement below
obtain all the properties 
//of a particular
row?
PersonnelBean personnelBean =
(PersonnelBean)personnel.get(index);  
 
// If this row is selected, add all data
fields the corresponding personnel information
// Question 4.  The selected is the
boolean property of the 
//PersonnelBean. 
Should I code
//if
(personnelBean.selected) { ... } instead?
if (personnelBean.isSelected())
   {
departPersonnel.add( personnelBean );
}
 
}

return departPersonnel;

}

[/code]




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs