Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 27 Jun 2008 14:58:22 -0000 Issue 8115

user-digest-help

2008-06-27


Author LoginPost Reply

user Digest 27 Jun 2008 14:58:22 -0000 Issue 8115

Topics (messages 188232 through 188261):

Re: [struts] Slow performance with Struts2
 188232 by: yorlick kilroy

Re: Struts 2 - Repopulate controls when validation fails
 188233 by: Lukasz Lenart

Multiple action declarations with the same Action class
 188234 by: Chandramouli P
 188235 by: Marc Ende
 188243 by: Dave Newton

Re: Unit Testing - change ObjectFactory - override config
 188236 by: Lukasz Lenart

Re: [S2] TypeConversion and generics
 188237 by: Lukasz Lenart
 188250 by: Pierre Thibaudeau

Re: Strange problem with content disposition
 188238 by: Paranoid_Fabio

Re: Tiles and Tags
 188239 by: Marc Eckart
 188240 by: Antonio Petrelli
 188245 by: Marc Eckart
 188249 by: Antonio Petrelli

Jasypt and Struts2/Spring/JPA(Hibernate)
 188241 by: Esteve Camps Chust
 188244 by: Dave Newton
 188247 by: Esteve Camps Chust
 188248 by: Dave Newton

Re: Struts Themes Problem - help
 188242 by: Dave Newton

Submitting a collection to Struts action
 188246 by: gokul balasubramanian

Re: <s:fielderror /> - how to provide an understandable error message to the enduser?
 188251 by: xianwinwin
 188252 by: Dave Newton
 188255 by: xianwinwin
 188256 by: Dave Newton

LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application
 188253 by: Milan Milanovic
 188254 by: Lukasz Lenart
 188257 by: Dave Newton
 188258 by: Milan Milanovic
 188259 by: Milan Milanovic
 188260 by: Lukasz Lenart
 188261 by: Lukasz Lenart

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------

Attachment: user_188232.ezm (zipped)
On Fri, Jun 27, 2008 at 7:25 AM, yorlick kilroy <wgtlogs@(protected):

> Hi Al,
>
> thx! you made my day :-) that did the trick!
> replacing freemarker 2.3.8 with 2.3.13 speeded up my application by almost
> 100%
> It still doesn't come anywhere near my old struts2 application but I guess
> its a fairly small trade-off when considering what struts2 has to offer.


correction: I meant "old Struts1 application" not Struts2


>
> --- joe
>
>
> On Thu, Jun 26, 2008 at 5:09 PM, Al Sutton <al.sutton@(protected):
>
>> If your benchmark uses multiple threads throw in a freemarker upgrade to
>> 2.3.13 and have another spin :).
>>
>> One thing you might want to bear in mind is that if you're using a
>> persistance framework there maybe some back end fetching taking place
>> between a.b.c and a.b.c.d. Even though you write simple beans and accessors
>> you can't guarentee whats happening to your objects under the covers.
>>
>> Al.
>>
>>
>> yorlick kilroy wrote:
>>
>>> I replaced OGNL 2.6.11 with the latest 2.7.2 Version.
>>> I did a bit of benchmarking comparing the two and it absolutely surprised
>>> me, that 2.7.2 in some cases is almost twice as slow as 2.6.11
>>> The test scenario:
>>> iterate a large java.util.List in a jsp. the List contains a pretty
>>> large
>>> tree of objects. in the jsp I access a String property in the last node
>>> of
>>> this object graph. OGNL 2.6.11 takes roughly 600 ms to complete, 2.7.2
>>> roughly 1050 ms
>>>
>>> From that I gather that OGNL wasn't designed for high performance when
>>> processing large and complex object trees in jsps. I guess I'll have to
>>> go
>>> back and do it like in the old Struts1 days: use shallow objects like in
>>> ActionForms
>>>
>>> On Wed, Jun 25, 2008 at 8:31 PM, Dale Newfield <Dale@(protected)>
>>> wrote:
>>>
>>>
>>>
>>>> yorlick kilroy wrote:
>>>>
>>>>
>>>>
>>>>> Still... the "problem" seems to be the OGNL implementation in struts2.
>>>>>
>>>>>
>>>>>
>>>> I'm guessing here, but maybe your issues are related to:
>>>>
>>>> http://jira.opensymphony.com/browse/OGNL-141
>>>>
>>>> Which has been pushed off in Xwork to 2.5:
>>>>
>>>> http://jira.opensymphony.com/browse/XW-631
>>>>
>>>> And which has been pushed off in Struts2 until at least 2.1.3:
>>>>
>>>> https://issues.apache.org/struts/browse/WW-2128
>>>>
>>>> You're welcome to update the version of ognl you're using in your own
>>>> app
>>>> (but remember to add javassist if so).
>>>>
>>>> <s:iterate ... >
>>>>
>>>>
>>>>>   <s:property value="#object.a.b.c.name"/>
>>>>>   <s:property value="#object.a.b.c.phone"/>
>>>>> </s:iterate>
>>>>>
>>>>>
>>>>>
>>>> Theoretically this translates to a straight lookup for #object, then
>>>> getA().getB().getC().getName()...
>>>> If A, B, and C are just accessors, it should be fast. If they do much
>>>> work
>>>> to determine what to return, you're doing that work 2*N times (where N
>>>> is
>>>> the number of times through the loop) instead of just once...why would
>>>> you
>>>> put a long lookup like that in an iterator if it doesn't change with
>>>> each
>>>> iteration?
>>>>
>>>> -Dale
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>

Attachment: user_188233.ezm (zipped)
Hi,

2008/6/26 bob fuller <bobfuller30004@(protected)>:
>
> The approach I am taking is from the Struts 2 FAQ...
>
> http://struts.apache.org/2.x/docs/how-do-we-repopulate-controls-when-validation-fails.html
>
> Why should it be avoided?

I don't remmeber exactly why, someone on this group mentioned that. In
my opinion, using Preparable interface is a better option, but maybe
I'm wrong ;-)


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188234.ezm (zipped)

Hi,This is my first post to the user list.We have started working in struts recently.Is it possible to use one Action class for multiple action declarations in the struts-config.xml?Consider the code below:<action path="/action1" type="com.sample.app.TestAction" name="formBean1" scope="request">   <forward name="actForward1" path="/test/pages/page1.jsp"/></action><action path="/action2" type="com.sample.app.TestAction" name="formBean2" scope="request">   <forward name="actForward2" path="/test/pages/page2.jsp"/></action><action path="/action3" type="com.sample.app.TestAction" name="formBean3" scope="request">   <forward name="actForward3" path="/test/pages/page3.jsp"/></action><action path="/action4" type="com.sample.app.TestAction" name="formBean4" scope="request">   <forward name="actForward4" path="/test/pages/page4.jsp"/></action>Thanks & Regards,Chandramouli P.
_________________________________________________________________
No Harvard, No Oxford. We are here. Find out !!
http://ss1.richmedia.in/recurl.asp?pid=500

Attachment: user_188235.ezm (zipped)
Hello

Chandramouli P schrieb:
> Hi,This is my first post to the user list.We have started working in struts recently.Is it possible to use one Action class for multiple action declarations in the struts-config.xml?Consider the code below:<action path="/action1" type="com.sample.app.TestAction" name="formBean1" scope="request">   <forward name="actForward1" path="/test/pages/page1.jsp"/></action><action path="/action2" type="com.sample.app.TestAction" name="formBean2" scope="request">   <forward name="actForward2" path="/test/pages/page2.jsp"/></action><action path="/action3" type="com.sample.app.TestAction" name="formBean3" scope="request">   <forward name="actForward3" path="/test/pages/page3.jsp"/></action><action path="/action4" type="com.sample.app.TestAction" name="formBean4" scope="request">   <forward name="actForward4" path="/test/pages/page4.jsp"/></action>Thanks & Regards,Chandramouli P

Of course you can have multiple action declarations for a single
Action-Class. You can also specify a seperate method within the action
for every declared action.

Marc

Attachment: user_188243.ezm (zipped)
--- On Fri, 6/27/08, Marc Ende <mlists@(protected):
> Chandramouli P schrieb:
> > Hi,This is my first post to the user list.We have
> started working in struts recently.Is it possible to use
> one Action class for multiple action declarations in the
> struts-config.xml?Consider the code below:<action
> path="/action1"
> type="com.sample.app.TestAction"
> name="formBean1" scope="request">  
> <forward name="actForward1"
> path="/test/pages/page1.jsp"/></action><action
> path="/action2"
> type="com.sample.app.TestAction"
> name="formBean2" scope="request">  
> <forward name="actForward2"
> path="/test/pages/page2.jsp"/></action><action
> path="/action3"
> type="com.sample.app.TestAction"
> name="formBean3" scope="request">  
> <forward name="actForward3"
> path="/test/pages/page3.jsp"/></action><action
> path="/action4"
> type="com.sample.app.TestAction"
> name="formBean4" scope="request">  
> <forward name="actForward4"
> path="/test/pages/page4.jsp"/></action>Thanks
> & Regards,Chandramouli P
>
> Of course you can have multiple action declarations for a
> single Action-Class. You can also specify a seperate method within
> the action for every declared action.

In S1, which appears to be what's being used (for a new project?!) using multiple methods would indicate they'd want to use one of the DispatchAction-like mechanisms.

Dave


Attachment: user_188236.ezm (zipped)
Hi,

How do you start your unit testing? If with Ant, you should prepare
separate struts.xml just for testing and setup it when you starting
junit task. The same you have by convention when you use maven.


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188237.ezm (zipped)
Hi,

Right now, I don't have any other suggestions, I will try to test
something like you during weekend, maybe then I will come back to you
with some idea ;-)


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188250.ezm (zipped)
2008/6/27 Lukasz Lenart <lukasz.lenart@(protected)>:

> Right now, I don't have any other suggestions, I will try to test
> something like you during weekend, maybe then I will come back to you
> with some idea ;-)
>

Thanks Lukasz!

What I just did---and it worked---was to remove the abstract property setter
from the abstract generified parent class. While the abstract getter is
essential in the abstract parent (because used by other methods in the
parent), the setter was not.  (I should have seen that one earlier!!!)

In other words, at my end, the pressure's off my back. Though I am still
puzzled by the fact that the presence of an explicit converter wouldn't have
solved the situation...

Attachment: user_188238.ezm (zipped)


Yes. You're right. Thank you very much.


Paranoid_Fabio wrote:
>
> Hello. I've a very strange problem using content disposition in stream
> result:
>
> < result name="success" type="stream" >
> < param name="contentType">${contentType}< /param>
> < param name="inputName">downloadStream< /param>
> < param name="contentDisposition">filename=${fileName}< /param>
> < param name="bufferSize">1024< /param>
> </result >
>
> fileName is a field of my action class.
> When filename contains no spaces, everything goes fine. But if filename is
> something like "hello song.mp3"
> the browser shows that the file is "hello". I'm sure that the filename is
> correct in my action class because i logged it out.
> Any idea????
>
> thank u!
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_188239.ezm (zipped)
Hi,

we use struts2 with tiles. We have a main layout with a custom tag:

<menu:menu menuBar="Main" menuItemKey="menu.item.customer" />

Now we want to make the attributes of the menu tag configurable with tiles.
I have no clue how to do this.

Or is there an other way with freemarker or something else?

Thanks in advance.

Best regards,

Marc

Attachment: user_188240.ezm (zipped)
2008/6/27 Marc Eckart <marc.eckart@(protected)>:
> Now we want to make the attributes of the menu tag configurable with tiles.
> I have no clue how to do this.

What are you trying to accomplish? Be clearer please.

Antonio

Attachment: user_188245.ezm (zipped)
Sorry :-)
I want to set the attributes of the menu tag like menuBar or
menuItemKey from a tiles.xml

I tried to set the attribute with:

 <menu:menu menuBar="<tiles:useAttribute name="menuBar"/>"
menuItemKey="menu.item.customersearch" />

I get then /> in the menuBar member. I think nesting tiles tags in
custom tags does not work? But how can I do this?

My tiles definition is this:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD
Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
 <definition name="schufa.HelloWorldPage" extends=".mainLayout" >
   <put-attribute name="titleKey" value="title.schufa"/>
   <put-attribute name="menuItemKey" value="menu.item.customersearch"/>
   <put-attribute name="menuBar" value="Main"/>
   <put-attribute name="body"
value="/de/seb/schufa/view/HelloWorldTiles.ftl" type="template" />
 </definition>  
</tiles-definitions>

2008/6/27 Antonio Petrelli <antonio.petrelli@(protected)>:
> 2008/6/27 Marc Eckart <marc.eckart@(protected)>:
>> Now we want to make the attributes of the menu tag configurable with tiles.
>> I have no clue how to do this.
>
> What are you trying to accomplish? Be clearer please.
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_188249.ezm (zipped)
2008/6/27 Marc Eckart <marc.eckart@(protected)>:
> Sorry :-)
> I want to set the attributes of the menu tag like menuBar or
> menuItemKey from a tiles.xml

Please ask the Tiles Users mailing list:
http://tiles.apache.org/mail.html

Antonio

Attachment: user_188241.ezm (zipped)
Hi,

has anyone coded this? May you send any example?

Thanks to all ;)

Esteve

Attachment: user_188244.ezm (zipped)
--- On Fri, 6/27/08, Esteve Camps Chust <ecamps@(protected):
> has anyone coded this? May you send any example?

The encryption library? What would an example look like?

I'm not sure how this is related to Struts, unless you're asking about the S2/Spring/JPA, of which there is an example at [1] (although it doesn't look like anybody has edited it much lately).

The Jasypt page has examples with both Hibernate and Spring--have you considered reading the Jasypt documentation?

Dave


Attachment: user_188247.ezm (zipped)
ok Dave, for the moment I had no found what I was looking for, but it's true
sometime's we ask to lists before accessing the docs. I will take a look at
Jasypt website again.

Thanks and sorry to bother you ;)

Esteve

2008/6/27 Dave Newton <newton.dave@(protected)>:

> --- On Fri, 6/27/08, Esteve Camps Chust <ecamps@(protected):
> > has anyone coded this? May you send any example?
>
> The encryption library? What would an example look like?
>
> I'm not sure how this is related to Struts, unless you're asking about the
> S2/Spring/JPA, of which there is an example at [1] (although it doesn't look
> like anybody has edited it much lately).
>
> The Jasypt page has examples with both Hibernate and Spring--have you
> considered reading the Jasypt documentation?
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_188248.ezm (zipped)
I did, of course, forget to include the link to the S2/Spring/JPA example :( It's at:

http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html

Dave

--- On Fri, 6/27/08, Esteve Camps Chust <ecamps@(protected):

> From: Esteve Camps Chust <ecamps@(protected)>
> Subject: Re: Jasypt and Struts2/Spring/JPA(Hibernate)
> To: "Struts Users Mailing List" <user@(protected)
> Date: Friday, June 27, 2008, 7:29 AM
> ok Dave, for the moment I had no found what I was looking
> for, but it's true
> sometime's we ask to lists before accessing the docs. I
> will take a look at
> Jasypt website again.
>
> Thanks and sorry to bother you ;)
>
> Esteve
>
> 2008/6/27 Dave Newton <newton.dave@(protected)>:
>
> > --- On Fri, 6/27/08, Esteve Camps Chust
> <ecamps@(protected):
> > > has anyone coded this? May you send any example?
> >
> > The encryption library? What would an example look
> like?
> >
> > I'm not sure how this is related to Struts, unless
> you're asking about the
> > S2/Spring/JPA, of which there is an example at [1]
> (although it doesn't look
> > like anybody has edited it much lately).
> >
> > The Jasypt page has examples with both Hibernate and
> Spring--have you
> > considered reading the Jasypt documentation?
> >
> > Dave
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > For additional commands, e-mail:
> user-help@(protected)
> >
> >

Attachment: user_188242.ezm (zipped)
--- On Fri, 6/27/08, Narayana S <narayanasgs1@(protected):
> but here it introduced one more problem, with the xhtml
> theme we get the field level validation error messages below
> the individual control, but the simple theme is not giving any
> validation error messages. to get the errors i used <s:fielderror />
> ,it is giving all the field level errors at one place.
>
> is there any way i can get the filed level error messages
> as they come in xhtml theme with simple theme ?

...

Have you looked at the documentation for the tag you're using?

http://struts.apache.org/2.x/docs/fielderror.html

Did you look at the themes and templates documentation, the starting point of which is:

http://struts.apache.org/2.x/docs/themes-and-templates.html

Dave "Never wanted to be a dentist, but pulls a lot of teeth" Newton


Attachment: user_188246.ezm (zipped)
Hello,I have a page with a collection of users. So I populate the form bean before displaying it&nbsp;and pass it to the view action.&nbsp;I use the &lt;logic:iterate&gt; tag to display them. These users can be modified.&nbsp;When I submit the form I am unable to iterate over the collection and&nbsp;found that it had a 'null' value. I am not sure how I am supposed to solve this. How do I retrieve the modified collection of users in the Struts Action?Any&nbsp;help is much appreciated.CheersGokul


Attachment: user_188251.ezm (zipped)

Hi Dave,
I'm not sure I fully understand your reply;
I found the interceptor validatoin

          <interceptor-ref name="validation" />

assuming I remove it, as you suggested, what should come instead and how can
I configure the error messages.

thank you



newton.dave wrote:
>
> Type conversion errors are added separately from validation errors.
>
> Among the options is to remove the conversion error interceptor from your
> interceptor stack and use only the validation errors.
>
> Dave
>
> --- On Thu, 6/26/08, xianwinwin <xianwinwin@(protected):
>
>> From: xianwinwin <xianwinwin@(protected)>
>> Subject: <s:fielderror /> - how to provide an understandable error
>> message to the enduser?
>> To: user@(protected)
>> Date: Thursday, June 26, 2008, 6:35 PM
>> Hi all,
>>
>> If the end-user input wrong date-type (eg., date format is
>> incorrect, or for
>> 'number of people' he types 'Q') the
>> 'input' is fired and it shows the error
>> message.
>>
>> I do that with the 'return input' and the jsp page
>> (this is ajax-id) looks
>> like this:
>>
>>
>> <%@(protected)"
>> uri="/struts-tags" %>
>>
>> udpate Fail<BR>
>> <s:fielderror />
>>
>>
>> the problem is that the user see something like this:
>> Update fail:
>> Invalid field value for field "Car.returnDate".
>>
>> obviously returnDate is a field name in Car (that's
>> great for the
>> developers); but my question is this: How can I show a nice
>> understandable
>> error message such as: 'error with car return date'
>>
>>
>> thanks for any pointers
>> * once again, this is only when the data-type is incorrect.
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cs%3Afielderror--%3E----how-to-provide-an-understandable-error-message-to-the-enduser--tp18144819p18144819.html
>> Sent from the Struts - User mailing list archive at
>> Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail:
>> user-help@(protected)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_188252.ezm (zipped)
--- On Fri, 6/27/08, xianwinwin <xianwinwin@(protected):
> I'm not sure I fully understand your reply;
> I found the interceptor validatoin
>  <interceptor-ref name="validation" />
> assuming I remove it, as you suggested, what should come
> instead and how can I configure the error messages.

> newton.dave wrote:
>> Among the options is to remove the
>> ****conversion error interceptor**** <<
>> from your interceptor stack and use
>> only the validation errors.

Dave


Attachment: user_188255.ezm (zipped)

removed - so the conversionError is not working. ok, how can I provide my own
errors now?
- is it possible using notation for that?

thanks Dave


newton.dave wrote:
>
> --- On Fri, 6/27/08, xianwinwin <xianwinwin@(protected):
>> I'm not sure I fully understand your reply;
>> I found the interceptor validatoin
>>  <interceptor-ref name="validation" />
>> assuming I remove it, as you suggested, what should come
>> instead and how can I configure the error messages.
>
>> newton.dave wrote:
>>> Among the options is to remove the
>>> ****conversion error interceptor**** <<
>>> from your interceptor stack and use
>>> only the validation errors.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_188256.ezm (zipped)
--- On Fri, 6/27/08, xianwinwin <xianwinwin@(protected):
> removed - so the conversionError is not working. ok, how can
> I provide my own errors now?

Doesn't your existing validation handle the results of a failed conversion? i.e., the property would be null (or whatever)?

Dave


Attachment: user_188253.ezm (zipped)

Hi,

I'm using your template application
http://struts.apache.org/2.0.11.1/docs/struts-2-spring-2-jpa-ajax.html
http://struts.apache.org/2.0.11.1/docs/struts-2-spring-2-jpa-ajax.html .

The difference is that in my application class Person have a Set<Job> jobs.
But, when I try to load person with person = service.find(id);and then to
access to jobs, e.g., person.getJobs(), I get LazyInitializationException !!

I now that Hibernate session is closed, I've tried with
Hibernate.initialize(person.getJobs()), but it is the same ! Please, help
because I think this is MAJOR problem with every Struts + Spring + Hibernate
application.

Thank you in advance.

--
Milan
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_188254.ezm (zipped)
Hi,

Add OpenSessionInViewFilter [1] filter to your web.xml

[1] http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188257.ezm (zipped)
--- On Fri, 6/27/08, Milan Milanovic <milanmilanovich@(protected):
> I now that Hibernate session is closed, I've tried with
> Hibernate.initialize(person.getJobs()), but it is the same!

... wouldn't the session still be closed?

http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Hibernate.html#initialize(java.lang.Object)

It says right there that one way for this method to fail is if the session is closed. If you didn't open a session I'm not sure what you were expecting.

> Please, help because I think this is MAJOR problem with every
> Struts + Spring + Hibernate application.

As such, you'll want to look at the *Hibernate* docs.

Dave


Attachment: user_188258.ezm (zipped)

Hi,

thank you. Do you know for any example of using this filter for application
like I mentioned ?



Lukasz Lenart wrote:
>
> Hi,
>
> Add OpenSessionInViewFilter [1] filter to your web.xml
>
> [1]
> http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_188259.ezm (zipped)



newton.dave wrote:
>
> --- On Fri, 6/27/08, Milan Milanovic <milanmilanovich@(protected):
>>> I now that Hibernate session is closed, I've tried with
>>> Hibernate.initialize(person.getJobs()), but it is the same!
>>
>>... wouldn't the session still be closed?
>
>>http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Hibernate.html#initialize(java.lang.Object)
>
>>It says right there that one way for this method to fail is if the session
is closed. If you didn't open a >session I'm not sure what you were
expecting.
>
> Yes, this is exactly why I asked how to solve this situation.
>
>>> Please, help because I think this is MAJOR problem with every
>>> Struts + Spring + Hibernate application.
>>
>>As such, you'll want to look at the *Hibernate* docs.
>
> I see that I can use OpenSessionInViewFilter, just I now need some example
> for this kind of application.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_188260.ezm (zipped)
2008/6/27 Milan Milanovic <milanmilanovich@(protected)>:
>
> Hi,
>
> thank you. Do you know for any example of using this filter for application
> like I mentioned ?

I'm not quite sure what you need, but this is the common why, how to
solve such problem with web applications.


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188261.ezm (zipped)
> I see that I can use OpenSessionInViewFilter, just I now need some example
> for this kind of application.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/classes/application-context*.xml</param-value>
</context-param>

<context-param>
  <param-name>webAppRootKey</param-name>
  <param-value>app.webroot</param-value>
</context-param>

<context-param>
  <param-name>log4jConfigLocation</param-name>
  <param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>

<filter>
  <filter-name>openSessionInView</filter-name>
  <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>

<filter>
  <filter-name>encodingFilter</filter-name>
  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  <init-param>
   <param-name>encoding</param-name>
   <param-value>UTF-8</param-value>
  </init-param>
  <init-param>
   <param-name>forceEncoding</param-name>
   <param-value>true</param-value>
  </init-param>
</filter>

<filter-mapping>
  <filter-name>openSessionInView</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
  <filter-name>encodingFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

<listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

</web-app>


Regards
--
Lukasz
http://www.lenart.org.pl/
©2008 gg3721.com - Jax Systems, LLC, U.S.A.