On Mon, Apr 28, 2008 at 1:20 PM, Martin Homik <[EMAIL PROTECTED]> wrote: > > Thanks a lot, uncommenting OpenSessionInViewFilter worked. What is its > drawback? Why is it commented by default?
It's commented out by default so we can support iBATIS w/o having different web.xml files. > > One more observation. While the OGNL expression 'members.size()' worked in > both jetty:run and jetty:run-war, the call to the non-property method > 'membersSize()' was successful only with jetty:run-war. Note, I made a > mistake in my previous answer: I named the non-property method > 'getMembersSize()' which is wrong. > > Another question: What's wrong with fmt:message when used with jetty:run? My > latest phrases are not replaced. There is no problem with jetty:run-war. If you use "jetty:run", you have to run "appfuse:full-source" or "war:inplace" first so the webapp is packaged in src/main/webapp/WEB-INF (and underlying directories). Matt > Strange. > > Martin > > > > > > > mraible wrote: > > > > Have you tried uncommenting the OpenSessionInViewFilter in your web.xml? > > > > Matt > > > > On Mon, Apr 28, 2008 at 12:11 PM, Martin Homik <[EMAIL PROTECTED]> wrote: > >> > >> I actually tried to solve the problem by using OGNL. > >> > >> <s:iterator value="myGroups"> > >> Group name: <s:property value="name"/> > >> Size: <s:property value='members.size()'/> members > >> </s:iterator> > >> > >> In my second attempt, I called a non-property method: > >> > >> In JSP: > >> ... > >> Size: <s:property value='membersSize()'/> members > >> ... > >> In POJO: > >> @Transient > >> public int getMembersSize() { > >> return members.size(); > >> } > >> > >> > >> In both cases I ended up with a LazyInitializationException. > >> > >> [seepo] ERROR [btpool0-1] LazyInitializationException.<init>(19) | > >> failed to > >> lazily initialize a collection of role: org.seepo.model.Group.members, > >> no > >> session or session was closed > >> org.hibernate.LazyInitializationException: failed to lazily initialize a > >> collection of role: org.seepo.model.Group.members, no session or session > >> was > >> closed > >> > >> > >> Any idea? Your link to the page which describes JSTL functions says that > >> these functions are for String manipulations. I did not try it, but I > >> guess, > >> they won't work with collections, will they? > >> > >> Martin > >> > >> > >> > >> > >> > >> mraible wrote: > >> > > >> > You should be able to get members.size() if you use OGNL and a > >> > <s:property> tag. You can also use JSTL functions and the "length" > >> > function. > >> > > >> > http://java.sun.com/j2ee/1.4/docs/tutorial-update2/doc/JSTL8.html > >> > > >> > Matt > >> > > >> > On Mon, Apr 28, 2008 at 9:16 AM, Martin Homik <[EMAIL PROTECTED]> > wrote: > >> >> > >> >> Problem: > >> >> * I have a "Group" POJO which keeps a list of its "members" > >> (ManyToMany > >> >> relation). > >> >> * The GroupAction class stores a list of my current groups and it > >> has a > >> >> group field for > >> >> accessing information of a single group. In principle, the > >> stucture > >> >> is > >> >> very similar to the > >> >> PersonAction of the online tutorial. > >> >> > >> >> Question: In the JSP, I iterate through the groups and print some > >> group > >> >> information. For each group, I'd like to print the number of > >> members. > >> >> How do > >> >> I get it? Can I access somehow members.size() in the JSP? Or am I > >> on a > >> >> completely wrong path? > >> >> > >> >> Note: I tried a few things by try-and-error and sometimes I ended up > >> >> with a > >> >> Hibernate LazyInitializationException. Now, I just don't know at > >> what > >> >> end to > >> >> continue? Is it something that > >> >> i) can be solved simply via JSP and some expression, or > >> >> ii) do I have to do something in the Action class, or > >> >> iii) does it go further down into the persistence layer? > >> >> > >> >> Hope, my mail is not too short and you understand my problem. > >> >> -- > >> >> View this message in context: > >> >> > >> > http://www.nabble.com/How-to-access-collection-fields-in-Struts2--tp16941170s2369p16941170.html > >> >> Sent from the AppFuse - User mailing list archive at Nabble.com. > >> >> > >> >> > >> >> > >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > >> >> > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >> > > >> > > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/How-to-access-collection-fields-in-Struts2--tp16941170s2369p16944803.html > >> > >> > >> Sent from the AppFuse - User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: > http://www.nabble.com/How-to-access-collection-fields-in-Struts2--tp16941170s2369p16945853.html > > > Sent from the AppFuse - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]