Re: Struts 2 - Repopulate controls when validation fails

2008-06-27 Thread Lukasz Lenart
Hi,

2008/6/26 bob fuller [EMAIL 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/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Multiple action declarations with the same Action class

2008-06-27 Thread Chandramouli P

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//actionaction path=/action2 
type=com.sample.app.TestAction name=formBean2 scope=request forward 
name=actForward2 path=/test/pages/page2.jsp//actionaction 
path=/action3 type=com.sample.app.TestAction name=formBean3 
scope=request forward name=actForward3 
path=/test/pages/page3.jsp//actionaction path=/action4 
type=com.sample.app.TestAction name=formBean4 scope=request forward 
name=actForward4 path=/test/pages/page4.jsp//actionThanks  
Regards,Chandramouli P.
_
No Harvard, No Oxford. We are here. Find out !!
http://ss1.richmedia.in/recurl.asp?pid=500

Re: Multiple action declarations with the same Action class

2008-06-27 Thread Marc Ende

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//actionaction path=/action2 type=com.sample.app.TestAction name=formBean2 scope=request forward name=actForward2 path=/test/pages/page2.jsp//actionaction path=/action3 type=com.sample.app.TestAction 
name=formBean3 scope=request forward name=actForward3 path=/test/pages/page3.jsp//actionaction path=/action4 type=com.sample.app.TestAction name=formBean4 scope=request forward name=actForward4 
path=/test/pages/page4.jsp//actionThanks  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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit Testing - change ObjectFactory - override config

2008-06-27 Thread Lukasz Lenart
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/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] TypeConversion and generics

2008-06-27 Thread Lukasz Lenart
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/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Strange problem with content disposition

2008-06-27 Thread Paranoid_Fabio


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=inputNamedownloadStream /param
  param name=contentDispositionfilename=${fileName} /param
  param name=bufferSize1024 /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!
 
 

-- 
View this message in context: 
http://www.nabble.com/Strange-problem-with-content-disposition-tp18137974p18149975.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



OT: Tiles and Tags

2008-06-27 Thread Marc Eckart
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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OT: Tiles and Tags

2008-06-27 Thread Antonio Petrelli
2008/6/27 Marc Eckart [EMAIL 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Jasypt and Struts2/Spring/JPA(Hibernate)

2008-06-27 Thread Esteve Camps Chust
Hi,

has anyone coded this? May you send any example?

Thanks to all ;)

Esteve


Re: Struts Themes Problem - help

2008-06-27 Thread Dave Newton
--- On Fri, 6/27/08, Narayana S [EMAIL PROTECTED] wrote:
  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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Multiple action declarations with the same Action class

2008-06-27 Thread Dave Newton
--- On Fri, 6/27/08, Marc Ende [EMAIL PROTECTED] wrote:
 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//actionaction
 path=/action2
 type=com.sample.app.TestAction
 name=formBean2 scope=request   
  forward name=actForward2
 path=/test/pages/page2.jsp//actionaction
 path=/action3
 type=com.sample.app.TestAction
 name=formBean3 scope=request   
  forward name=actForward3
 path=/test/pages/page3.jsp//actionaction
 path=/action4
 type=com.sample.app.TestAction
 name=formBean4 scope=request   
  forward name=actForward4
 path=/test/pages/page4.jsp//actionThanks
  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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Jasypt and Struts2/Spring/JPA(Hibernate)

2008-06-27 Thread Dave Newton
--- On Fri, 6/27/08, Esteve Camps Chust [EMAIL PROTECTED] wrote:
 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OT: Tiles and Tags

2008-06-27 Thread Marc Eckart
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 [EMAIL PROTECTED]:
 2008/6/27 Marc Eckart [EMAIL 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Submitting a collection to Struts action

2008-06-27 Thread gokul balasubramanian
Hello,I have a page with a collection of users. So I populate the form bean 
before displaying itnbsp;and pass it to the view action.nbsp;I use the 
lt;logic:iterategt; tag to display them. These users can be 
modified.nbsp;When I submit the form I am unable to iterate over the 
collection andnbsp;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?Anynbsp;help is much appreciated.CheersGokul



Re: Jasypt and Struts2/Spring/JPA(Hibernate)

2008-06-27 Thread Esteve Camps Chust
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 [EMAIL PROTECTED]:

 --- On Fri, 6/27/08, Esteve Camps Chust [EMAIL PROTECTED] wrote:
  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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Jasypt and Struts2/Spring/JPA(Hibernate)

2008-06-27 Thread Dave Newton
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 [EMAIL PROTECTED] wrote:

 From: Esteve Camps Chust [EMAIL PROTECTED]
 Subject: Re: Jasypt and Struts2/Spring/JPA(Hibernate)
 To: Struts Users Mailing List user@struts.apache.org, [EMAIL 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 [EMAIL PROTECTED]:
 
  --- On Fri, 6/27/08, Esteve Camps Chust
 [EMAIL PROTECTED] wrote:
   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:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OT: Tiles and Tags

2008-06-27 Thread Antonio Petrelli
2008/6/27 Marc Eckart [EMAIL 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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] TypeConversion and generics

2008-06-27 Thread Pierre Thibaudeau
2008/6/27 Lukasz Lenart [EMAIL 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...


Re: s:fielderror / - how to provide an understandable error message to the enduser?

2008-06-27 Thread xianwinwin

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 [EMAIL PROTECTED] wrote:
 
 From: xianwinwin [EMAIL PROTECTED]
 Subject: s:fielderror /  - how to provide an understandable error
 message to the enduser?
 To: user@struts.apache.org
 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:
 
 
 %@ taglib prefix=s
 uri=/struts-tags %
 
 udpate FailBR
 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--%3Ehow-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: [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/%3Cs%3Afielderror--%3Ehow-to-provide-an-understandable-error-message-to-the-enduser--tp18144819p18154826.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: s:fielderror / - how to provide an understandable error message to the enduser?

2008-06-27 Thread Dave Newton
--- On Fri, 6/27/08, xianwinwin [EMAIL PROTECTED] wrote:
 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

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 SetJob 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
-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18155823.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: s:fielderror / - how to provide an understandable error message to the enduser?

2008-06-27 Thread xianwinwin

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 [EMAIL PROTECTED] wrote:
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/%3Cs%3Afielderror--%3Ehow-to-provide-an-understandable-error-message-to-the-enduser--tp18144819p18156267.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: s:fielderror / - how to provide an understandable error message to the enduser?

2008-06-27 Thread Dave Newton
--- On Fri, 6/27/08, xianwinwin [EMAIL PROTECTED] wrote:
 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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Dave Newton
--- On Fri, 6/27/08, Milan Milanovic [EMAIL PROTECTED] wrote:
 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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18156840.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic



newton.dave wrote:
 
 --- On Fri, 6/27/08, Milan Milanovic [EMAIL PROTECTED] wrote:
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18156895.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
2008/6/27 Milan Milanovic [EMAIL 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/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
 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-namecontextConfigLocation/param-name
param-value/WEB-INF/classes/application-context*.xml/param-value
  /context-param

  context-param
param-namewebAppRootKey/param-name
param-valueapp.webroot/param-value
  /context-param

  context-param
param-namelog4jConfigLocation/param-name
param-value/WEB-INF/classes/log4j.properties/param-value
  /context-param

  filter
filter-nameopenSessionInView/filter-name

filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
  /filter

  filter
filter-nameencodingFilter/filter-name

filter-classorg.springframework.web.filter.CharacterEncodingFilter/filter-class
init-param
  param-nameencoding/param-name
  param-valueUTF-8/param-value
/init-param
init-param
  param-nameforceEncoding/param-name
  param-valuetrue/param-value
/init-param
  /filter

  filter-mapping
filter-nameopenSessionInView/filter-name
url-pattern/*/url-pattern
  /filter-mapping

  filter-mapping
filter-nameencodingFilter/filter-name
url-pattern/*/url-pattern
  /filter-mapping

  listener

listener-classorg.springframework.web.util.Log4jConfigListener/listener-class
  /listener

  listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
  /listener

/web-app


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

I wrote this in my first post in this thread, I need to read
person.getJobs() when person object is loaded in my action class for this
Struts + AJAX+ Spring + Hibernate example provided in Struts docs, that's
it.

--
Thx, Milan


Lukasz Lenart wrote:
 
 2008/6/27 Milan Milanovic [EMAIL 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/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18157038.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

thank you on this example. One question, is this going to work with this
Struts 2 + Spring 2 + JPA + AJAX application from Struts 2 docs, i.e., I
don't need to change code ?

--
Thx, Milan


Lukasz Lenart wrote:
 
 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-namecontextConfigLocation/param-name
 param-value/WEB-INF/classes/application-context*.xml/param-value
   /context-param
 
   context-param
 param-namewebAppRootKey/param-name
 param-valueapp.webroot/param-value
   /context-param
 
   context-param
 param-namelog4jConfigLocation/param-name
 param-value/WEB-INF/classes/log4j.properties/param-value
   /context-param
 
   filter
 filter-nameopenSessionInView/filter-name

 filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
   /filter
 
   filter
 filter-nameencodingFilter/filter-name

 filter-classorg.springframework.web.filter.CharacterEncodingFilter/filter-class
 init-param
   param-nameencoding/param-name
   param-valueUTF-8/param-value
 /init-param
 init-param
   param-nameforceEncoding/param-name
   param-valuetrue/param-value
 /init-param
   /filter
 
   filter-mapping
 filter-nameopenSessionInView/filter-name
 url-pattern/*/url-pattern
   /filter-mapping
 
   filter-mapping
 filter-nameencodingFilter/filter-name
 url-pattern/*/url-pattern
   /filter-mapping
 
   listener

 listener-classorg.springframework.web.util.Log4jConfigListener/listener-class
   /listener
 
   listener

 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
   /listener
 
 /web-app
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18157069.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 I wrote this in my first post in this thread, I need to read
 person.getJobs() when person object is loaded in my action class for this
 Struts + AJAX+ Spring + Hibernate example provided in Struts docs, that's
 it.

Just add that filter and that's all, you don't have to change anything
else with your app.


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

I tried to define web.xml as you give here, but when I deploy my application
I get this exception:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'sessionFactory' is defined
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:360)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:914)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:737)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:243)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:227)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:171)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
...

?

In this application 
http://struts.apache.org/2.0.11.1/docs/struts-2-spring-2-jpa-ajax.html
Struts 2 + Spring + JPA + AJAX  there is no defined bean with name
'sessionFactory'.
What can I do ?

--
Thx in advance, Milan


Lukasz Lenart wrote:
 
 2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 I wrote this in my first post in this thread, I need to read
 person.getJobs() when person object is loaded in my action class for this
 Struts + AJAX+ Spring + Hibernate example provided in Struts docs, that's
 it.
 
 Just add that filter and that's all, you don't have to change anything
 else with your app.
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18157734.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
Hi,

2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 I tried to define web.xml as you give here, but when I deploy my application
 I get this exception:

Just look to the doc, link I've sent you, there is such note:

Looks up the SessionFactory in Spring's root web application context.
Supports a sessionFactoryBeanName filter init-param in web.xml; the
default bean name is sessionFactory. Looks up the SessionFactory on
each request, to avoid initialization order issues (when using
ContextLoaderServlet, the root application context will get
initialized after this filter).


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

AFAIK I just need to define sessionFactory bean in my applicationContext.xml
to work with my JPA-enabled classes (just like in the Person example) ? How
can I do that ?

--
Thx, Milan 


Milan Milanovic wrote:
 
 Hi Lukasz,
 
 I tried to define web.xml as you give here, but when I deploy my
 application I get this exception:
 
 org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
 named 'sessionFactory' is defined
   at
 org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:360)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:914)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at
 org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:737)
   at
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:243)
   at
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:227)
   at
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:171)
   at
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
   at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
   at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at
 org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
   at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
 ...
 
 ?
 
 In this application 
 http://struts.apache.org/2.0.11.1/docs/struts-2-spring-2-jpa-ajax.html
 Struts 2 + Spring + JPA + AJAX  there is no defined bean with name
 'sessionFactory'.
 What can I do ?
 
 --
 Thx in advance, Milan
 
 
 Lukasz Lenart wrote:
 
 2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 I wrote this in my first post in this thread, I need to read
 person.getJobs() when person object is loaded in my action class for
 this
 Struts + AJAX+ Spring + Hibernate example provided in Struts docs,
 that's
 it.
 
 Just add that filter and that's all, you don't have to change anything
 else with your app.
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18158236.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: s:fielderror / - how to provide an understandable error message to the enduser?

2008-06-27 Thread xianwinwin

GOT IT

thanks Dave!


newton.dave wrote:
 
 --- On Fri, 6/27/08, xianwinwin [EMAIL PROTECTED] wrote:
 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
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/%3Cs%3Afielderror--%3Ehow-to-provide-an-understandable-error-message-to-the-enduser--tp18144819p18158441.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 AFAIK I just need to define sessionFactory bean in my applicationContext.xml
 to work with my JPA-enabled classes (just like in the Person example) ? How
 can I do that ?

Sorry!! My big mistake ;-) Right now I discovered that you use JPA,
not Hibernate. In such example there is such configuration below, did
you setup it?

?xml version=1.0 encoding=UTF-8?
web-app id=person version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
display-nameperson/display-name

!-- Include this if you are using Hibernate --
filter
filter-nameSpring OpenEntityManagerInViewFilter/filter-name
filter-class
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
/filter-class
/filter

filter-mapping
filter-nameSpring OpenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping

filter
filter-namestruts2/filter-name
filter-class
org.apache.struts2.dispatcher.FilterDispatcher
/filter-class
/filter

filter-mapping
filter-namestruts2/filter-name
url-pattern/*/url-pattern
/filter-mapping


welcome-file-list
welcome-fileindex.jsp/welcome-file
/welcome-file-list

listener
listener-class
org.springframework.web.context.ContextLoaderListener
/listener-class
/listener
/web-app


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

great, thanks!

Yes, I put this new mapping to my web.xml and now my application works. But
again when I retrieve
person from database with: person = service.find(...); and call
person.getJobs() I again get:


org.hibernate.LazyInitializationException: could not initialize proxy - no
Session
at
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
at
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
at
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
at 
com.myapp.model.Person$$EnhancerByCGLIB$$292cb8bb.getJobs(generated)
...

Why :-( ?

--
Thx very much, Milan


Lukasz Lenart wrote:
 
 2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 AFAIK I just need to define sessionFactory bean in my
 applicationContext.xml
 to work with my JPA-enabled classes (just like in the Person example) ?
 How
 can I do that ?
 
 Sorry!! My big mistake ;-) Right now I discovered that you use JPA,
 not Hibernate. In such example there is such configuration below, did
 you setup it?
 
 ?xml version=1.0 encoding=UTF-8?
 web-app id=person version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 display-nameperson/display-name
 
 !-- Include this if you are using Hibernate --
 filter
 filter-nameSpring OpenEntityManagerInViewFilter/filter-name
 filter-class

 org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
 /filter-class
 /filter
 
 filter-mapping
 filter-nameSpring OpenEntityManagerInViewFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping
 
 filter
 filter-namestruts2/filter-name
 filter-class
 org.apache.struts2.dispatcher.FilterDispatcher
 /filter-class
 /filter
 
 filter-mapping
 filter-namestruts2/filter-name
 url-pattern/*/url-pattern
 /filter-mapping
 
 
 welcome-file-list
 welcome-fileindex.jsp/welcome-file
 /welcome-file-list
 
 listener
 listener-class
 org.springframework.web.context.ContextLoaderListener
 /listener-class
 /listener
 /web-app
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18158801.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to read data from nested list elements

2008-06-27 Thread Reddy, Ramachandra (IS Consultant)


Guys found the solution 
Check the usage of nested tags that can handle any levels.

http://www.learntechnology.net/content/struts/struts_nested.jsp


Warm Regards
Ramachandra Reddy



-Original Message-
From: Reddy, Ramachandra (IS Consultant) 
Sent: Thursday, June 26, 2008 12:44 PM
To: 'user@struts.apache.org'
Subject: How to read data from nested list elements


Hi Folks,
I have particular requirement where I have nested elements and within that 
again some elements… So the nesting is up to 3 levels. 

Top most element is   
ModulesList= it has N modules
 Module = it has N  Parts 
Part= it has N Elements

Here is the class hieirarchy
Parent class that holds all modules.
public class FSModuleListForm extends ActionForm {

    private List mModuleList = new ArrayList();
  public List getModuleList() {return mModuleList;}
  public void setModuleList(List aModuleList) {mModuleList=aModuleList;}
  
public FSModuleForm getModule(int index) 
  {
  return (FSModuleForm) mModuleList.get(index);
  }

public void reset(ActionMapping aMapping, HttpServletRequest aRequest)
    {
    super.reset(aMapping, aRequest);
    moduleList = new ArrayList();
    for (int i=0; i  25; i++)
    {
        mModuleList.add(i, new FSModuleForm());
    }
    }

}
==
//Module Description 
  public class FSModuleForm extends ActionForm
    {
    Public FSModuleForm()   
    { 
      moduleId = -1;
      moduleName=null;
      moduleType=null;
      moduleLabel=null;
      partsList = new ArrayList();

      //Lets initialize the list
      for (int i= 0 ; i  10; i++ ){
          partsList.add(i,new FSPartForm());
      }
    }  
    public FSPartForm getPart(int index) {
      return (FSPartForm) partsList.get(index);
    }
    public void reset(ActionMapping aMapping, HttpServletRequest 
aRequest)
        {
      partsList = new ArrayList();
        //Lets initialize the list
        for (int i= 0 ; i  10; i++ ){
        partsList.add(i,new FSPartForm());
          }
    }
  
  }
==

// PART Description
public class FSPartForm extends ActionForm {
  
  
  public FSPartForm()
   {
      partId=-1;
      sortOrder=0;
      partName=null;
      partLabel=null;
      partType=null;
      optionalFlag=null;
      partFootnote=null;
      elementList= new ArrayList();
    //Lets initialize the list
      for (int i= 0 ; i  20; i++ ){
          elementList.add(i,new FSElementForm());
      }
   }   

  public FSElementForm getElement(int index) 
  {
    
  return (FSElementForm) mElementList.get(index);
  }
  public void reset(ActionMapping aMapping, HttpServletRequest aRequest)
      for (int i= 0 ; i  50; i++ ){
            elementList.add(i,new FSElementForm());
        }
  }

}

==
//Elemet Description.
public FSElementForm extends ActionForm {
 public FSElementForm()
  {
  
   elementId=-1;
   elementName=null;
   elementType=null;
   optionalFlag=null;
   defaultValue=null;
   sortOrder=0;
  }
  
}

Here is my JSP

  logic:iterate id=module name=FSModuleListForm property=moduleList
    tr
  tr   !—Module info →
  bean:write name=module 
property=moduleName / tr
    Desc:html:text name=module 
property=moduleDesc   indexed=true /
    Label:html:text name=module 
property=moduleLabel  indexed=true /
    html:hidden name=module 
property=moduleId    indexed=true /
  /tr
  logic:present id=part name=module 
property=partsList
    logic:iterate id=part name=module 
property=partsList
  tr
    trbean:write name=part 
property=partName //tr
    trLabel:html:text 
name=part property=partLabel    indexed=true //tr
    html:hidden name=part 
property=partId indexed=true /
  /tr
    !—code to get each element 
will go here →
    /logic:iterate
  

Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

I even tried to do this:

org.hibernate.Session session = ((org.hibernate.ejb.HibernateEntityManager)
service.getEntityManager()).getSession();

session.lock( persoon.getJobs(), LockMode.NONE);

But, it is the same :-(.

--
Thx, Milan



Milan Milanovic wrote:
 
 Hi Lukasz,
 
 great, thanks!
 
 Yes, I put this new mapping to my web.xml and now my application works.
 But again when I retrieve
 person from database with: person = service.find(...); and call
 person.getJobs() I again get:
 
 
 org.hibernate.LazyInitializationException: could not initialize proxy - no
 Session
   at
 org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
   at
 org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
   at
 org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
   at 
 com.myapp.model.Person$$EnhancerByCGLIB$$292cb8bb.getJobs(generated)
 ...
 
 Why :-( ?
 
 --
 Thx very much, Milan
 
 
 Lukasz Lenart wrote:
 
 2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 AFAIK I just need to define sessionFactory bean in my
 applicationContext.xml
 to work with my JPA-enabled classes (just like in the Person example) ?
 How
 can I do that ?
 
 Sorry!! My big mistake ;-) Right now I discovered that you use JPA,
 not Hibernate. In such example there is such configuration below, did
 you setup it?
 
 ?xml version=1.0 encoding=UTF-8?
 web-app id=person version=2.4
 xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 display-nameperson/display-name
 
 !-- Include this if you are using Hibernate --
 filter
 filter-nameSpring OpenEntityManagerInViewFilter/filter-name
 filter-class

 org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
 /filter-class
 /filter
 
 filter-mapping
 filter-nameSpring OpenEntityManagerInViewFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping
 
 filter
 filter-namestruts2/filter-name
 filter-class
 org.apache.struts2.dispatcher.FilterDispatcher
 /filter-class
 /filter
 
 filter-mapping
 filter-namestruts2/filter-name
 url-pattern/*/url-pattern
 /filter-mapping
 
 
 welcome-file-list
 welcome-fileindex.jsp/welcome-file
 /welcome-file-list
 
 listener
 listener-class
 org.springframework.web.context.ContextLoaderListener
 /listener-class
 /listener
 /web-app
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18159037.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 great, thanks!

 Yes, I put this new mapping to my web.xml and now my application works. But
 again when I retrieve
 person from database with: person = service.find(...); and call
 person.getJobs() I again get:


 org.hibernate.LazyInitializationException: could not initialize proxy - no

That's strange, did you exactly follow configuration instructions in
that example? Could you paste your config files? And also how did you
configure person and job entity?


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

sorry about this amount of messages.

I actually do this (because of deleting):

Person person= service.getEntityManager().getReference(Person.class, id);

and then, when I do this:

session.lock( person, LockMode.NONE);

I get:

org.hibernate.SessionException: Session is closed!
at
org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:580)
at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:576)
...

If I call person.getJobs() then I get LazyInitializationException.

What can I do ?

--
Thx, Milan



Lukasz Lenart wrote:
 
 2008/6/27 Milan Milanovic [EMAIL PROTECTED]:

 Hi Lukasz,

 AFAIK I just need to define sessionFactory bean in my
 applicationContext.xml
 to work with my JPA-enabled classes (just like in the Person example) ?
 How
 can I do that ?
 
 Sorry!! My big mistake ;-) Right now I discovered that you use JPA,
 not Hibernate. In such example there is such configuration below, did
 you setup it?
 
 ?xml version=1.0 encoding=UTF-8?
 web-app id=person version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 display-nameperson/display-name
 
 !-- Include this if you are using Hibernate --
 filter
 filter-nameSpring OpenEntityManagerInViewFilter/filter-name
 filter-class

 org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
 /filter-class
 /filter
 
 filter-mapping
 filter-nameSpring OpenEntityManagerInViewFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping
 
 filter
 filter-namestruts2/filter-name
 filter-class
 org.apache.struts2.dispatcher.FilterDispatcher
 /filter-class
 /filter
 
 filter-mapping
 filter-namestruts2/filter-name
 url-pattern/*/url-pattern
 /filter-mapping
 
 
 welcome-file-list
 welcome-fileindex.jsp/welcome-file
 /welcome-file-list
 
 listener
 listener-class
 org.springframework.web.context.ContextLoaderListener
 /listener-class
 /listener
 /web-app
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18159155.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [s2] Whats the most strutsy way of doing....

2008-06-27 Thread Al Sutton

Hi Jeromy,

Thanks for the comments.

I'm trying to steer away from javascript for the solution in order to 
maximise browser compatibility (this app may be used on older mobile 
phones).


I'm hoping that AES encryption isn't cracked ;), and by the inclusion of 
some random noise in the properties list it should reduce the chances of 
a simple brute force attack by increasing the length of the encrypted 
data and not making the plain text obvious.


I can understand the problems with your plugin, My architecture stores 
only the userId in the session and gets the user from the database as 
needed (due to the back end being JPA/Hibernate and the user having 
ManyToOne and OneToMany relationships I can't simply store the user in 
the session). The system I'm going to implement will decrypt the data 
from the cookie, verify it as valid, and then populate the session with 
the neccessary information, all of which will be serializable objects 
(Long, String, etc.)


Thanks again,

Al.


Jeromy Evans wrote:

Al Sutton wrote:

Dave,

I'm completely agree it's a great idea and useful thing to do, but 
the problem is what to put into the cookie and how to map it to the 
user.


My current favourite is encrypt the properties you want to store 
(using AES for speed and JCE support), then decrypt and inject when 
needed. Cookies should be considered limited to 4K (due to the joys 
of RFC2109 Section 6.3), so as long as the data fits joy shall be 
mine :).


Al.


Hi Al,
Just another variation I use where the useragent requires javascript:
authenticate the user and generate a token; the token doesn't contain 
any sensitive data;
the token is saved in a cookie and included in all requests (as 
cookie, header or param)
an s2 interceptor checks the token is matched to an authenticated 
user. it injects relevant details to actions
  (eg. a store maps tokens to users; server-side manages expiry, 
concurrent logins etc)


It's not as fast as encoding login information in the cookie but it 
can't be broken.  I use the same method to sign XHR requests.
If the user has checked the remember me box the javascript gets the 
token from the cookie and resumes using it.  The server it knows not 
to invalidate that token.


Vulnerabilities:
 - The token should be unguessable to minimize forged requests;
 - as javascript is inscecure, tokens can be stolen from the cookie 
(eg. by an advertisement, XSS)


I wrote the above as an S2 plugin. The only problem with releasing it 
as a plugin is that the service that checks tokens can't be 
Xwork'@Inject'ed into the interceptor (rather it has to be injected 
via spring or guice) due to its potential external dependencies (eg. 
an EntityManager).  The same plugin also allows me to apply roles to 
action methods (jsr-250).


cheers,
Jeromy Evans


-
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]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

this is my web.xml

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

display-namePerson/display-name

!-- Points to the Spring Context --
context-param
param-namecontextConfigLocation/param-name
param-value/WEB-INF/applicationContext*.xml/param-value
/context-param

!-- Points to the Log4J Context --
context-param
param-namelog4jConfigLocation/param-name
param-value/WEB-INF/classes/log4j.properties/param-value
/context-param

mime-mapping
extensioncss/extension
mime-typetext/css/mime-type
/mime-mapping

filter
filter-nameAcegi Filter Chain Proxy/filter-name
filter-class
org.acegisecurity.util.FilterToBeanProxy
/filter-class
init-param
param-nametargetClass/param-name
param-value
org.acegisecurity.util.FilterChainProxy
/param-value
/init-param
/filter

!-- Spring related filters --
filter
filter-nameSpring OpenEntityManagerInViewFilter/filter-name
filter-class
   
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
/filter-class
/filter

!-- Struts 2 Servlet--
filter
filter-namestruts2/filter-name
filter-class
org.apache.struts2.dispatcher.FilterDispatcher
/filter-class
/filter

filter
filter-namesitemesh/filter-name
filter-class
com.opensymphony.module.sitemesh.filter.PageFilter
/filter-class
init-param
param-namedebug.pagewriter/param-name
param-valuetrue/param-value
/init-param
/filter

filter-mapping
filter-nameAcegi Filter Chain Proxy/filter-name
url-pattern/j_acegi_security_check/url-pattern
/filter-mapping
filter-mapping
filter-nameAcegi Filter Chain Proxy/filter-name
url-pattern/j_acegi_logout/url-pattern
/filter-mapping
filter-mapping
filter-nameAcegi Filter Chain Proxy/filter-name
url-pattern*.action/url-pattern
/filter-mapping
filter-mapping
filter-nameAcegi Filter Chain Proxy/filter-name
url-pattern*.jsp/url-pattern
/filter-mapping
filter-mapping
filter-namestruts2/filter-name
url-pattern/*/url-pattern
/filter-mapping

filter-mapping
filter-nameSpring OpenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping

filter-mapping
filter-namesitemesh/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherFORWARD/dispatcher
/filter-mapping

!-- Spring related listeners --
listener
listener-class
org.springframework.web.context.ContextLoaderListener
/listener-class
/listener
listener
listener-class
org.acegisecurity.ui.session.HttpSessionEventPublisher
/listener-class
/listener

session-config
session-timeout180/session-timeout
/session-config

!-- Add mappings for SiteMesh-related servlets here --
welcome-file-list
welcome-fileindex.jsp/welcome-file
/welcome-file-list

error-page
error-code404/error-code
location/404.jsp/location
/error-page
error-page
error-code500/error-code
location/error.jsp/location
/error-page

jsp-config
jsp-property-group
url-pattern*.jsp/url-pattern
page-encodingutf-8/page-encoding
/jsp-property-group
/jsp-config
/web-app

and this is my applicationContext.xml:

?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:aop=http://www.springframework.org/schema/aop;
xmlns:tx=http://www.springframework.org/schema/tx;
xsi:schemaLocation=
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop

Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
Move OpenEntityManagerInViewFilter mapping before Struts2 mapping like below

filter-mapping
  filter-nameSpring OpenEntityManagerInViewFilter/filter-name
  url-pattern/*/url-pattern
/filter-mapping

filter-mapping
  filter-namestruts2/filter-name
  url-pattern/*/url-pattern
/filter-mapping

If Acegi also use JPA. move OpenEntityManagerInViewFilter to the top.


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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Milan Milanovic

Hi Lukasz,

I moved it and now it works!! Great man, thank you very very much!
I hope that everything else will work good with this pattern ;-).

No, my Acegi is not using JPA, it uses just basic
(applicationContext-acegy-security.xml) configuration.

I think that this solution should be added somewhere in that Struts 2 +
Spring 2 + JPA + AJAX application example, because a lot of people will have
the same problem.

--
Thx one more time, Milan



Lukasz Lenart wrote:
 
 Move OpenEntityManagerInViewFilter mapping before Struts2 mapping like
 below
 
 filter-mapping
   filter-nameSpring OpenEntityManagerInViewFilter/filter-name
   url-pattern/*/url-pattern
 /filter-mapping
 
 filter-mapping
   filter-namestruts2/filter-name
   url-pattern/*/url-pattern
 /filter-mapping
 
 If Acegi also use JPA. move OpenEntityManagerInViewFilter to the top.
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-with-Struts-2-%2B-Spring-2-%2B-JPA-%2B-AJAX-application-tp18155823p18159501.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: LazyInitializationException with Struts 2 + Spring 2 + JPA + AJAX application

2008-06-27 Thread Lukasz Lenart
 I think that this solution should be added somewhere in that Struts 2 +
 Spring 2 + JPA + AJAX application example, because a lot of people will have
 the same problem.

The right order is already in the example, you made simple mistypo ;-)


Best regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts2: Ajax Pagination using JQuery

2008-06-27 Thread Raghu
Hi, I want to implement ajax pagination on my struts2 page but I am not sure
how to implement that. I am not very good in javascript and jquery but
learning them..

I have a table which will show 10 user comments at a time and there will be
pagination links for fetching next set of comments using Ajax using Jquery
$.getJSON( ) method.

I am using struts2 json plug in and it return json result. Now problem is
how to set this Json result to my struts2 tags on jsp page?

If anyone could help me on this problem then it will be great.

table width= 500 border=0 cellspacing=0
cellpadding=0
  s:if test=article.comments.size  0

s:iterator value=article.comments

tr
  td width=50
   a href=# class=wname s:property
value=userName/ /a
  /td
  td width=150
 posted on
s:date name=commentDate
format=dd-MMM- hh:mm aa /
  /td
   td width=200

  /td
/tr
  tr 
  td colspan=3
s:property value=comments/
  /td
  /tr
   /s:iterator
  span id=comments-Pagination Pagination links
goes here.. /span
 /s:if
 s:else
 No Comment Found.
 /s:else

/table

Thanks
Raghu


Re: Submitting a collection to Struts action

2008-06-27 Thread Milan Milanovic

Hi,

you have multiple options. First, if you store your users in database, then
in your execute method you can retrieve them from database, or you can store
them in user session scope:

http://www.roseindia.net/struts/struts2/struts2ajax/struts2-session.shtml
Session scope 

--
Regards, Milan



gokul  balasubramanian wrote:
 
 Hello,I have a page with a collection of users. So I populate the form
 bean before displaying itnbsp;and pass it to the view action.nbsp;I use
 the lt;logic:iterategt; tag to display them. These users can be
 modified.nbsp;When I submit the form I am unable to iterate over the
 collection andnbsp;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?Anynbsp;help is much appreciated.CheersGokul
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Submitting-a-collection-to-Struts-action-tp18153072p18163282.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2: Ajax Pagination using JQuery

2008-06-27 Thread David Durham, Jr.
On Fri, Jun 27, 2008 at 1:43 PM, Raghu [EMAIL PROTECTED] wrote:
 Hi, I want to implement ajax pagination on my struts2 page but I am not sure
 how to implement that. I am not very good in javascript and jquery but
 learning them..


You might be interested in something like this:

http://webplicity.net/flexigrid/

Regards,
Dave

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]