Pagination with struts 2.x
Hi, What is the best approach to display database table content page wise using struts 2? We used display tag few years back, but there seems another taglib pager taglib. Is pager tag lib a better option or is there any inherent support in struts 2 for paging? Thanks harinath -- View this message in context: http://www.nabble.com/Pagination-with-struts-2.x-tp22594233p22594233.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
[S2] encode attribute of : correct encoding?
I fail to understand how to use the "encode" attribute of the . Here's an example that puzzles me... Let's try, alternately, to set "encode" to "true" and "false". Here goes: Élizabeth yields: /myAction?entityName=%C3%83%C2%89lizabeth while Élizabeth yields /myAction?entityName=%C3%83%C2%89lizabeth which is exactly identical to the previously generated URL! Therefore what is the point of the "encode" attribute? Moreover, when 'myAction' retrieves the 'entityName' parameter, it converts it to: "Ãlizabeth". ??? BTW, when Google encodes the query string "Élizabeth" (without the quotes), it does so as: http://www.google.com/search?q=%C9lizabeth * * * My setup: Tomcat 6.0.16, Java1.6.0_11, Struts 2.1.6 The JSP page where the tag appears contains the following lines (each in its proper place): <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %> I have a Tomcat encoding filter that sets each request's encoding to: "text/html;charset=UTF-8" - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
I got your code to run (paseted below). Just so I am sure I am doing what you are trying to do: 1. I made no changes to Setter or SetterList so that I don't break your design. Only to the action and the jsp 2. I assume what you want is to be able to display and edit and create the settings (I did not do delete)? 3. I assume you are using Struts 2.1.6 (I should have asked -- sorry) Some observations: 1. You don't need a converter at all. Why? Because you are sending the title and value as separate Strings and want to create a Settings object with those items as its state. Instantiating an object and injecting it with a couple of Strings does not require a converter. If you have a String representation of the Setting as a whole (e.g. "theTitle&theValue) then you would need a converter to parse the String and create a Setting object. 2. You don't need entries in *-converters.xml Why? Becaus of 1. 3. You don't need to expose?a property of type StringList. Why? Your JSP only uses the fact that it is a List. StringList is an implementation. So you only need a getter/setter that returns/takes a ?List? Note: I am posting from Japan and I noticed I sometimes get characters that are non-printing here appearing in the paste -- I think it is the encoding so please clean it up if that happens Action: public class SettingAction extends ActionSupport { ?private static final long serialVersionUID = -7082992787920559583L; ?private Setting newSetting; ?private SettingList settings = new SettingList(); ?public String execute() { ??if (newSetting != null) { ???//give it an id ???newSetting.setId("" + settings.size()); ???settings.add(newSetting); ??} ??return SUCCESS; ?} ?public void setSettings(List settings) { ??this.settings = new SettingList(); ??for (Setting setting : settings) { ???this.settings.add(setting); ??} ?} ?public List getSettings() { ??return settings; ?} ?public Setting getNewSetting() { ??return newSetting; ?} ?public void setNewSetting(Setting newSetting) { ??this.newSetting = newSetting; ?}; } JSP: ? ?? ??? '> : ??? ??? ?? ? ? ? ? ? Cheers Chris M -Original Message- From: ryangr To: user@struts.apache.org Sent: Wed, 18 Mar 2009 10:55 pm Subject: Re: Type conversion exceptions Here is the converter code: http://pastie.org/419709 Obviously it isn't doing anything other than outputting the values being passed in, but none of the values contain anything yet as the parameters are getting lost somewhere so there's no point in processing them yet. musomesa wrote: > > I have downloaded your code and will study it so that I don't > misunderstand. Can you also post the converter? > If I see it I might?suggestions that fit what you are doing better. > Chris > -- View this message in context: http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Jetty 6.x vs Tomcat 6.x
Guys -- I have a loaded (Hibernate, Spring, Tiles) S2.1.6 application running on TC 6 and I want to speed up the development cycle. I have exhausted the trials to get TC 6.x to dynamically reload modified class changes and have reached the point where I have installed Jetty 6.x. My application is "sort of" running when deployed in that environment, however, there seems to be a strange phenomenon concerning JSP page compiles containing S2 tags. Is there an issue concerning the two JSP compilers? Peace, Scott -- View this message in context: http://www.nabble.com/Jetty-6.x-vs-Tomcat-6.x-tp22591346p22591346.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: File upload, validation and Preparable
BTW That's Struts 2.1.6 and Tomcat 5.5. Greg Lindholm wrote: > > Got a couple questions about file uploading. > > I've discovered that in the standard interceptor stack "fileUpload" is > after "prepare" interceptor. This means that the upload File, ContentType, > and FileName setters have not been called before prepare() method runs. > Is there a good reason for this? It seems like fileUpload should be > before prepare so that these "parameters" have been set and are available > to the prepare() method. What do you think? > > One of the problems I'm having is that if the page fails validation (on > some other field) then the user selection in the tag is lost. > The result="input" takes me back to the page but the File selection is > blank. Is there a way to preserve the users file selection when > validation fails? > > If I do a show source on the page after validation fails the input file > tag has it's value= attribute set the temp file name from the server. This > doesn't seem right? This is leaking server configuration (albeit not very > important) information back to the client. > > > > > > > -- View this message in context: http://www.nabble.com/File-upload%2C-validation-and-Preparable-tp22587156p22587594.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
File upload, validation and Preparable
Got a couple questions about file uploading. I've discovered that in the standard interceptor stack "fileUpload" is after "prepare" interceptor. This means that the upload File, ContentType, and FileName setters have not been called before prepare() method runs. Is there a good reason for this? It seems like fileUpload should be before prepare so that these "parameters" have been set and are available to the prepare() method. What do you think? One of the problems I'm having is that if the page fails validation (on some other field) then the user selection in the tag is lost. The result="input" takes me back to the page but the File selection is blank. Is there a way to preserve the users file selection when validation fails? If I do a show source on the page after validation fails the input file tag has it's value= attribute set the temp file name from the server. This doesn't seem right? This is leaking server configuration (albeit not very important) information back to the client.
Re: struts 2.1.6 verbose logging
When a property is not found, it is logged, which causes all those warnings, as for myself I find them very annoying. I have a patch somewhere collecting dust, that throws exceptions when a property is not found, or there is an error evaluating an expression in a tag. I think we should take that route and only show errors when they happen in tags and not the stack in general (which produces all this noise) musachy On Wed, Mar 18, 2009 at 3:01 PM, hernan gonzalez wrote: > "Struts 2.1 introduces more verbose logging than Struts 2.0. While > extremely valuable, some users may find these annoying." > http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html > > The extremely annoying thing is that struts 2.1 emits those warnings > (apparently) for each struts2 ui tag in each jsp page. ("Could not > find property [templateDir] ") > > In fact, a few (20 or 30) requests in my web application results in a > lot (about 1000) of warnings which are not (AFAIK) related to my > application, but to struts internals. > I like to be warned of missing properties in the stack, as they might > point to missing properies in my actions or bad spelt jsp tags... but > this is not very useful: > > # tail -n 2000 /usr/local/tomcat/logs/catalina.out | grep "Could not > find" | sed 's/http.* //' | sort | uniq -c > 24 WARN [[.freemarker.Request] > 24 WARN [[.freemarker.RequestParameters] > 29 WARN [[org.apache.catalina.jsp_file] > 29 WARN [[struts.valueStack] > 864 WARN [[templateDir] > 192 WARN [[theme] > > And no solution is provided, except for disabling those warnings completely. > I'd like to know if that implies something wrong (or slightly wrong) > about my jsp pages, or about struts. > > Hernán > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts 2.1.6 verbose logging
"Struts 2.1 introduces more verbose logging than Struts 2.0. While extremely valuable, some users may find these annoying." http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html The extremely annoying thing is that struts 2.1 emits those warnings (apparently) for each struts2 ui tag in each jsp page. ("Could not find property [templateDir] ") In fact, a few (20 or 30) requests in my web application results in a lot (about 1000) of warnings which are not (AFAIK) related to my application, but to struts internals. I like to be warned of missing properties in the stack, as they might point to missing properies in my actions or bad spelt jsp tags... but this is not very useful: # tail -n 2000 /usr/local/tomcat/logs/catalina.out | grep "Could not find" | sed 's/http.* //' | sort | uniq -c 24 WARN [[.freemarker.Request] 24 WARN [[.freemarker.RequestParameters] 29 WARN [[org.apache.catalina.jsp_file] 29 WARN [[struts.valueStack] 864 WARN [[templateDir] 192 WARN [[theme] And no solution is provided, except for disabling those warnings completely. I'd like to know if that implies something wrong (or slightly wrong) about my jsp pages, or about struts. Hernán - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] Struts 2 + Spring 2 + JPA example uses @PersistenceContext - is this a "bad thing"??
Many thanks for your efforts. I do have everyting in appcontext file. I am using @Transactional and I am not using jpasupport. Let me know what you find out and if jpasupport is necessary. On 3/18/09, Wes Wannemacher wrote: > I haven't read that blog post, but I do know that Spring treats > @PersistenceContext differently than an EJB container. If you've > configured everything within applicationContext.xml, rather than in > the AppServer, and if you are extending JpaDaoSupport then I would > think it should work properly. I will check it out tonight if I get a > chance. > > -Wes > > On Wed, Mar 18, 2009 at 1:39 PM, Musachy Barroso wrote: >> I had no idea it was not thread safe, in that case it is probably a >> good idea to get factory and create an entity manager every time. >> >> musachy >> >> On Wed, Mar 18, 2009 at 1:30 PM, Burton Rhodes >> wrote: >>> I set up the example for "Struts 2 + Spring 2 + JPA + AJAX" using the >>> OpenEntityManagerInViewFilter from the Struts website and all works >>> well. >>> (http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html). >>> It appears this example uses the @PersistenceContext annotation to >>> inject the EntityManger into each Service/Dao class... >>> >>> Then I read this blog about how you SHOULD NOT use @PersistenceContext >>> annotation in a webapp becasue of thread safety unless you implement a >>> SingleThreadModel. >>> >>> http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html >>> >>> Now I am confused... Should I instead use @PersistenceUnit to inject >>> the EntityManagerFactor into each Dao object? And if so, won't this >>> affect the OpenEntityManagerInViewFilter and cause Lazy exceptions? >>> Can someone shead some light on this for me or am I not understanding >>> this correctly? >>> >>> Apologies in advance if this is a bit off Struts topic... >>> >>> Thanks, >>> Burton >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> >> >> >> -- >> "Hey you! Would you help me to carry the stone?" Pink Floyd >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > Wes Wannemacher > Author - Struts 2 In Practice > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more > http://www.manning.com/wannemacher > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Sent from my mobile device - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts 2.1.6 jar sizes
fixed in xwork trunk. http://jira.opensymphony.com/browse/XW-684. The size is 713 kb now. thanks for reporting musachy On Wed, Mar 18, 2009 at 1:50 PM, Musachy Barroso wrote: > That is a good catch. I don't think we need it and it is there because > the groupid is wrong in the maven shade config: > > aspectj:aspectjrt > aspectj:aspectjweaver > > it should be: > > org.aspectj:aspectjrt > org.aspectj:aspectjweaver > > musachy > > On Wed, Mar 18, 2009 at 1:33 PM, hernan gonzalez wrote: >> I've just upgraded from 2.0.14 to 2.1.6. Everything smooth so far. >> >> I'm a little concerned about the jar sizes. Previuosly, we had a huge >> struts2-core-2.0.14.jar, 2.21 MB, most of it from the static/ folder >> (for dojo); now that dojo has been factored out from the core (wise >> move) struts2-core-2.1.6.jar weights 719 KB . Nice. >> >> But, on the other side, we have now a big increase in xwork jar, from >> 448 KB to 2.18 MB . >> I see the classes in org.aspectj.* accounts for much of the weight. I >> know, for a web application in these days 2 Mb is not a great deal, >> but anyway, I hate bloated software, and I wish to be assured that >> this is necessary. >> >> Hernán >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] Struts 2 + Spring 2 + JPA example uses @PersistenceContext - is this a "bad thing"??
I haven't read that blog post, but I do know that Spring treats @PersistenceContext differently than an EJB container. If you've configured everything within applicationContext.xml, rather than in the AppServer, and if you are extending JpaDaoSupport then I would think it should work properly. I will check it out tonight if I get a chance. -Wes On Wed, Mar 18, 2009 at 1:39 PM, Musachy Barroso wrote: > I had no idea it was not thread safe, in that case it is probably a > good idea to get factory and create an entity manager every time. > > musachy > > On Wed, Mar 18, 2009 at 1:30 PM, Burton Rhodes wrote: >> I set up the example for "Struts 2 + Spring 2 + JPA + AJAX" using the >> OpenEntityManagerInViewFilter from the Struts website and all works >> well. (http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html). >> It appears this example uses the @PersistenceContext annotation to >> inject the EntityManger into each Service/Dao class... >> >> Then I read this blog about how you SHOULD NOT use @PersistenceContext >> annotation in a webapp becasue of thread safety unless you implement a >> SingleThreadModel. >> >> http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html >> >> Now I am confused... Should I instead use @PersistenceUnit to inject >> the EntityManagerFactor into each Dao object? And if so, won't this >> affect the OpenEntityManagerInViewFilter and cause Lazy exceptions? >> Can someone shead some light on this for me or am I not understanding >> this correctly? >> >> Apologies in advance if this is a bit off Struts topic... >> >> Thanks, >> Burton >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] Struts 2 + Spring 2 + JPA example uses @PersistenceContext - is this a "bad thing"??
I have no idea :) musachy On Wed, Mar 18, 2009 at 1:52 PM, Burton Rhodes wrote: > Any thoughts on how this would affect the > OpenEntityManagerInViewFilter? I assume if you create a new EM for > each service/dao operation, the objects would become detached after > each method thus giving you a lazy exception for anything in the view > - rendering the OpenEntityManagerInViewFilter useless. Am I > understanding this correctly? > > On Wed, Mar 18, 2009 at 12:39 PM, Musachy Barroso wrote: >> I had no idea it was not thread safe, in that case it is probably a >> good idea to get factory and create an entity manager every time. >> >> musachy >> >> On Wed, Mar 18, 2009 at 1:30 PM, Burton Rhodes >> wrote: >>> I set up the example for "Struts 2 + Spring 2 + JPA + AJAX" using the >>> OpenEntityManagerInViewFilter from the Struts website and all works >>> well. >>> (http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html). >>> It appears this example uses the @PersistenceContext annotation to >>> inject the EntityManger into each Service/Dao class... >>> >>> Then I read this blog about how you SHOULD NOT use @PersistenceContext >>> annotation in a webapp becasue of thread safety unless you implement a >>> SingleThreadModel. >>> >>> http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html >>> >>> Now I am confused... Should I instead use @PersistenceUnit to inject >>> the EntityManagerFactor into each Dao object? And if so, won't this >>> affect the OpenEntityManagerInViewFilter and cause Lazy exceptions? >>> Can someone shead some light on this for me or am I not understanding >>> this correctly? >>> >>> Apologies in advance if this is a bit off Struts topic... >>> >>> Thanks, >>> Burton >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> >> >> >> -- >> "Hey you! Would you help me to carry the stone?" Pink Floyd >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] Struts 2 + Spring 2 + JPA example uses @PersistenceContext - is this a "bad thing"??
Any thoughts on how this would affect the OpenEntityManagerInViewFilter? I assume if you create a new EM for each service/dao operation, the objects would become detached after each method thus giving you a lazy exception for anything in the view - rendering the OpenEntityManagerInViewFilter useless. Am I understanding this correctly? On Wed, Mar 18, 2009 at 12:39 PM, Musachy Barroso wrote: > I had no idea it was not thread safe, in that case it is probably a > good idea to get factory and create an entity manager every time. > > musachy > > On Wed, Mar 18, 2009 at 1:30 PM, Burton Rhodes wrote: >> I set up the example for "Struts 2 + Spring 2 + JPA + AJAX" using the >> OpenEntityManagerInViewFilter from the Struts website and all works >> well. (http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html). >> It appears this example uses the @PersistenceContext annotation to >> inject the EntityManger into each Service/Dao class... >> >> Then I read this blog about how you SHOULD NOT use @PersistenceContext >> annotation in a webapp becasue of thread safety unless you implement a >> SingleThreadModel. >> >> http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html >> >> Now I am confused... Should I instead use @PersistenceUnit to inject >> the EntityManagerFactor into each Dao object? And if so, won't this >> affect the OpenEntityManagerInViewFilter and cause Lazy exceptions? >> Can someone shead some light on this for me or am I not understanding >> this correctly? >> >> Apologies in advance if this is a bit off Struts topic... >> >> Thanks, >> Burton >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts 2.1.6 jar sizes
That is a good catch. I don't think we need it and it is there because the groupid is wrong in the maven shade config: aspectj:aspectjrt aspectj:aspectjweaver it should be: org.aspectj:aspectjrt org.aspectj:aspectjweaver musachy On Wed, Mar 18, 2009 at 1:33 PM, hernan gonzalez wrote: > I've just upgraded from 2.0.14 to 2.1.6. Everything smooth so far. > > I'm a little concerned about the jar sizes. Previuosly, we had a huge > struts2-core-2.0.14.jar, 2.21 MB, most of it from the static/ folder > (for dojo); now that dojo has been factored out from the core (wise > move) struts2-core-2.1.6.jar weights 719 KB . Nice. > > But, on the other side, we have now a big increase in xwork jar, from > 448 KB to 2.18 MB . > I see the classes in org.aspectj.* accounts for much of the weight. I > know, for a web application in these days 2 Mb is not a great deal, > but anyway, I hate bloated software, and I wish to be assured that > this is necessary. > > Hernán > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [S2] Struts 2 + Spring 2 + JPA example uses @PersistenceContext - is this a "bad thing"??
I had no idea it was not thread safe, in that case it is probably a good idea to get factory and create an entity manager every time. musachy On Wed, Mar 18, 2009 at 1:30 PM, Burton Rhodes wrote: > I set up the example for "Struts 2 + Spring 2 + JPA + AJAX" using the > OpenEntityManagerInViewFilter from the Struts website and all works > well. (http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html). > It appears this example uses the @PersistenceContext annotation to > inject the EntityManger into each Service/Dao class... > > Then I read this blog about how you SHOULD NOT use @PersistenceContext > annotation in a webapp becasue of thread safety unless you implement a > SingleThreadModel. > > http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html > > Now I am confused... Should I instead use @PersistenceUnit to inject > the EntityManagerFactor into each Dao object? And if so, won't this > affect the OpenEntityManagerInViewFilter and cause Lazy exceptions? > Can someone shead some light on this for me or am I not understanding > this correctly? > > Apologies in advance if this is a bit off Struts topic... > > Thanks, > Burton > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts 2.1.6 jar sizes
I've just upgraded from 2.0.14 to 2.1.6. Everything smooth so far. I'm a little concerned about the jar sizes. Previuosly, we had a huge struts2-core-2.0.14.jar, 2.21 MB, most of it from the static/ folder (for dojo); now that dojo has been factored out from the core (wise move) struts2-core-2.1.6.jar weights 719 KB . Nice. But, on the other side, we have now a big increase in xwork jar, from 448 KB to 2.18 MB . I see the classes in org.aspectj.* accounts for much of the weight. I know, for a web application in these days 2 Mb is not a great deal, but anyway, I hate bloated software, and I wish to be assured that this is necessary. Hernán - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
[S2] Struts 2 + Spring 2 + JPA example uses @PersistenceContext - is this a "bad thing"??
I set up the example for "Struts 2 + Spring 2 + JPA + AJAX" using the OpenEntityManagerInViewFilter from the Struts website and all works well. (http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html). It appears this example uses the @PersistenceContext annotation to inject the EntityManger into each Service/Dao class... Then I read this blog about how you SHOULD NOT use @PersistenceContext annotation in a webapp becasue of thread safety unless you implement a SingleThreadModel. http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html Now I am confused... Should I instead use @PersistenceUnit to inject the EntityManagerFactor into each Dao object? And if so, won't this affect the OpenEntityManagerInViewFilter and cause Lazy exceptions? Can someone shead some light on this for me or am I not understanding this correctly? Apologies in advance if this is a bit off Struts topic... Thanks, Burton - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Required field only works with text fields?
Dave, Thanks for the suggestion, I changed the validator to read as: @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.EAGER) @JoinColumn(name = "STATUS") @FieldExpressionValidator(message = "Default message", key="validate.status", expression = "status != null") public Status getStatus() { return status; } The validation is applied, but no message is displayed. With: @ExpressionValidator(message = "Default message", key="validate.status", expression = "status != null") The validation is applied and the validation message appears at the top of my page where I have an tag. Is there something else I need to do to make the FieldExpressionValidator work? MG -Original Message- From: Dave Newton [mailto:newton.d...@yahoo.com] Sent: Tuesday, March 17, 2009 6:01 PM To: Struts Users Mailing List Subject: Re: Required field only works with text fields? Griffith, Michael * wrote: > The following validation annotation seems to work: > > @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, > fetch=FetchType.EAGER) > @JoinColumn(name = "STATUS") > @ExpressionValidator(message = "Default message", > key="validate.status", expression = "status != null" ) public Status > getStatus() { > return status; > } > > However, the validation message appears in block, > not nicely next to the field that failed validation as does the other > validators. You'd probably need a @FieldExpressionValidator in order for it to be associated with a field, but this is just a guess. > I might have expected this if I had specified shortCircut=true, but I > don't. I'm not really sure what the shortCircuit flag is supposed to do. IIRC its intent is to prevent multiple validation errors for the same field. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Sitemesh 2.4 and Struts 2.0.14
I don't think anyone is, if you find a fix, we would appreciate a patch :) musachy On Wed, Mar 18, 2009 at 10:32 AM, Dan Slack wrote: > Hi, > > > > First, I apologize if this has already been mentioned, but I recently > attempted to upgrade to Sitemesh 2.4 to bad results. I guess in Sitemesh > 2.4, the "PageFilter" was deprecated, and all code has been removed. This > means that "applyDecorators" method is not being called anymore, which means > that the method in VelocityPageFilter never gets called for Velocity files > (and Freemarker templates I'd assume). So, I had to revert back to Sitemesh > 2.3. > > > > I did a brief search, but, didn't see anything (I also looked briefly into > Struts 2.1.x plugin, and saw that it was also assuming that the PageFilter > is calling "applyDecorators"). Is anybody aware of any efforts to update the > Sitemesh plugin for 2.4.x? > > > > Thanks, > > > > Dan Slack > Langui Systems Inc. > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: redirect parameters lost when using convention plugin 2.1.6
Fixed in trunk. Jira ticket: https://issues.apache.org/struts/browse/WW-3046 thanks for reporting musachy On Wed, Mar 18, 2009 at 9:42 AM, Musachy Barroso wrote: > The problem is that "redirect" does not not use "params", only > "redirect-action" does. So to use redirect, you need to do something > like(or set "location" in the annotation): > > /someurl.action?myparam=%{somevalue} > > and yeah, the documentation is wrong, and this is not consistent. I > will update redirect to be similar to redirect-action. > > musachy > > On Tue, Mar 17, 2009 at 11:24 PM, John Liptak wrote: >> >> I'm in the process of upgrading an app from 2.0.11.2 to 2.1.6. >> >> I've been following the instructions at >> http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Updatestruts.xmlConfiguration >> converting from 2.0 to 2.1 . >> >> Since we are currently using the zero config plugin, I'm also looking at the >> convention plugin >> http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-Resultsandresultcodes >> here . >> >> The issue I'm having is that parameters that are set on the redirect are >> lost. I'm getting the OGNL exception that the trouble shooting guide says >> I'm supposed to get, but then the parameters are not sent as part of the >> redirect. >> >> Things that might be causing issues: >> 1.) I've kept the naming of the original URLs using @Action annotations >> 2.) I've set the action extention to only be "action" and not "action," >> 3.) I'm using Weblogic 10.2 >> >> I've tried all of the different ways I know to do a redirect: >> 1.) Class level using params >> �...@result(name = "redirect", location = "pingDestination.action", type = >> "redirect", >> params = { "aParam", "a parameter" } ) >> 2.) Class level using location >> @Result(name = "redirect2", location = >> "/test/pingDestination.action?aParam=${message}", type = "redirect" ) >> 3.) Action level >> @Action(value = "/test/pingRedirect3", >> result...@result(name = "redirect", location = >> "pingDestination.action", type = "redirect", >> params = { "parse" , "true", "aParam", "a parameter" } )}, >> params = { "parse" , "true", "aParam", "another parameter" }) >> public String executeRedirect3() throws Exception {... >> 4.) I tried two different SNAPSHOT builds of 2.1.7 but the new config >> loading and WebLogic don't like each other. >> >> Any ideas? >> >> Here is my struts.xml >> > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" >> "http://struts.apache.org/dtds/struts-2.0.dtd";> >> >> >> > value="org.apache.struts2.spring.StrutsSpringObjectFactory" /> >> >> >> > value="action,actions,struts,struts2,view" /> >> >> >> >> >> > result="error"/> >> > result="error"/> >> > result="error"/> >> > result="error"/> >> >> >> >> > type="chain">/WEB-INF/common/Error.jsp >> >> >> >> >> >> >> >> >> >> -- >> View this message in context: >> http://www.nabble.com/redirect-parameters-lost-when-using-convention-plugin-2.1.6-tp22572248p22572248.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Sitemesh 2.4 and Struts 2.0.14
Hi, First, I apologize if this has already been mentioned, but I recently attempted to upgrade to Sitemesh 2.4 to bad results. I guess in Sitemesh 2.4, the "PageFilter" was deprecated, and all code has been removed. This means that "applyDecorators" method is not being called anymore, which means that the method in VelocityPageFilter never gets called for Velocity files (and Freemarker templates I'd assume). So, I had to revert back to Sitemesh 2.3. I did a brief search, but, didn't see anything (I also looked briefly into Struts 2.1.x plugin, and saw that it was also assuming that the PageFilter is calling "applyDecorators"). Is anybody aware of any efforts to update the Sitemesh plugin for 2.4.x? Thanks, Dan Slack Langui Systems Inc.
Re: Type conversion exceptions
Here is the converter code: http://pastie.org/419709 Obviously it isn't doing anything other than outputting the values being passed in, but none of the values contain anything yet as the parameters are getting lost somewhere so there's no point in processing them yet. musomesa wrote: > > I have downloaded your code and will study it so that I don't > misunderstand. Can you also post the converter? > If I see it I might?suggestions that fit what you are doing better. > Chris > -- View this message in context: http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: redirect parameters lost when using convention plugin 2.1.6
The problem is that "redirect" does not not use "params", only "redirect-action" does. So to use redirect, you need to do something like(or set "location" in the annotation): /someurl.action?myparam=%{somevalue} and yeah, the documentation is wrong, and this is not consistent. I will update redirect to be similar to redirect-action. musachy On Tue, Mar 17, 2009 at 11:24 PM, John Liptak wrote: > > I'm in the process of upgrading an app from 2.0.11.2 to 2.1.6. > > I've been following the instructions at > http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Updatestruts.xmlConfiguration > converting from 2.0 to 2.1 . > > Since we are currently using the zero config plugin, I'm also looking at the > convention plugin > http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-Resultsandresultcodes > here . > > The issue I'm having is that parameters that are set on the redirect are > lost. I'm getting the OGNL exception that the trouble shooting guide says > I'm supposed to get, but then the parameters are not sent as part of the > redirect. > > Things that might be causing issues: > 1.) I've kept the naming of the original URLs using @Action annotations > 2.) I've set the action extention to only be "action" and not "action," > 3.) I'm using Weblogic 10.2 > > I've tried all of the different ways I know to do a redirect: > 1.) Class level using params > �...@result(name = "redirect", location = "pingDestination.action", type = > "redirect", > params = { "aParam", "a parameter" } ) > 2.) Class level using location > @Result(name = "redirect2", location = > "/test/pingDestination.action?aParam=${message}", type = "redirect" ) > 3.) Action level > @Action(value = "/test/pingRedirect3", > result...@result(name = "redirect", location = > "pingDestination.action", type = "redirect", > params = { "parse" , "true", "aParam", "a parameter" } )}, > params = { "parse" , "true", "aParam", "another parameter" }) > public String executeRedirect3() throws Exception {... > 4.) I tried two different SNAPSHOT builds of 2.1.7 but the new config > loading and WebLogic don't like each other. > > Any ideas? > > Here is my struts.xml > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" > "http://struts.apache.org/dtds/struts-2.0.dtd";> > > > value="org.apache.struts2.spring.StrutsSpringObjectFactory" /> > > > value="action,actions,struts,struts2,view" /> > > > > > result="error"/> > result="error"/> > result="error"/> > result="error"/> > > > > type="chain">/WEB-INF/common/Error.jsp > > > > > > > > > > -- > View this message in context: > http://www.nabble.com/redirect-parameters-lost-when-using-convention-plugin-2.1.6-tp22572248p22572248.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
I have downloaded your code and will study it so that I don't misunderstand. Can you also post the converter? If I see it I might?suggestions that fit what you are doing better. Chris -Original Message- From: Lukasz Lenart To: Struts Users Mailing List Sent: Wed, 18 Mar 2009 6:10 pm Subject: Re: Type conversion exceptions 2009/3/18 : > But then how do you plan to write a converter to convert a String[] to a SettingList? It's already done, just to the configuration has to be adjusted > Also why is aggregation a bad design? It isn't but exposing directly internal field (ArrayList) it is. Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
2009/3/18 : > But then how do you plan to write a converter to convert a String[] to a > SettingList? It's already done, just to the configuration has to be adjusted > Also why is aggregation a bad design? It isn't but exposing directly internal field (ArrayList) it is. Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
But then how do you plan to write a converter to convert a String[] to a SettingList? Also why is aggregation a bad design? Regards Chris M -Original Message- From: Lukasz Lenart To: Struts Users Mailing List Sent: Wed, 18 Mar 2009 5:50 pm Subject: Re: Type conversion exceptions 2009/3/18 : > My bad -- I didn't realize SettingList extends ArrayList. Suggestion: make it aggregation so that SettingList has a property of type ArrayList and your type conversion problems will go away. In such case SettingList is useless, it will be bad design Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
2009/3/18 : > My bad -- I didn't realize SettingList extends ArrayList. Suggestion: make it > aggregation so that SettingList has a property of type ArrayList and > your type conversion problems will go away. In such case SettingList is useless, it will be bad design Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
My bad -- I didn't realize SettingList extends ArrayList. Suggestion: make it aggregation so that SettingList has a property of type ArrayList and your type conversion problems will go away. Chris -Original Message- From: ryangr To: user@struts.apache.org Sent: Wed, 18 Mar 2009 6:59 am Subject: Re: Type conversion exceptions Okay, I'm officially very confused as to what should and shouldn't be used since apparently the documentation example is not correct. Let me level set with what each of my files contains again: [xwork-conversion.properties] Element_settings=com.rjssoft.webdocs.setting.Setting According to the documentation, this tells the settings element that it is supposed to contain Setting objects which is true and needs to be in the conversion properties. [Setting.java] See this link for the code: http://pastie.org/419187 [SettingList.java] See this link for the code: http://pastie.org/419190 SettingLists are simple ArrayLists containing Setting beans. [SettingAction.java] See this link for the code: http://pastie.org/419191 The relevant section is where we go from the view.jsp, submit the form which then tries to call the update() method of SettingAction...it never gets there because it throws the exceptions noted in previous emails. [view.jsp] See this link for the relevant code: http://pastie.org/419192 What am I missing that isn't in the documentation or is incorrect? Ryan Lukasz Lenart wrote: > > 2009/3/17 ryangr : >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting > > What this is for? > >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter > > This tells Xwork which converter to call if it will need to convert > Array to SettingList > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/Type-conversion-exceptions-tp22497261p22568785.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional com mands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
2009/3/17 ryangr : > [xwork-conversion.properties] > Element_settings=com.rjssoft.webdocs.setting.Setting That's ok but your SettingList is not full List implementation and you have to specified how to convert array to SettingList that's why you have to specified also converter for SettingList above. I will try to prepare something similar today evening and test. Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Type conversion exceptions
This line is the problem: com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter You only need to define the converter for a Setting object and not for SettingList Also, spaces around the '=' sign are mandatory Cheers Chris M? > >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter > -Original Message- From: ryangr To: user@struts.apache.org Sent: Wed, 18 Mar 2009 6:59 am Subject: Re: Type conversion exceptions Okay, I'm officially very confused as to what should and shouldn't be used since apparently the documentation example is not correct. Let me level set with what each of my files contains again: [xwork-conversion.properties] Element_settings=com.rjssoft.webdocs.setting.Setting According to the documentation, this tells the settings element that it is supposed to contain Setting objects which is true and needs to be in the conversion properties. [Setting.java] See this link for the code: http://pastie.org/419187 [SettingList.java] See this link for the code: http://pastie.org/419190 SettingLists are simple ArrayLists containing Setting beans. [SettingAction.java] See this link for the code: http://pastie.org/419191 The relevant section is where we go from the view.jsp, submit the form which then tries to call the update() method of SettingAction...it never gets there because it throws the exceptions noted in previous emails. [view.jsp] See this link for the relevant code: http://pastie.org/419192 What am I missing that isn't in the documentation or is incorrect? Ryan Lukasz Lenart wrote: > > 2009/3/17 ryangr : >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting > > What this is for? > >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter > > This tells Xwork which converter to call if it will need to convert > Array to SettingList > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/Type-conversion-exceptions-tp22497261p22568785.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional com mands, e-mail: user-h...@struts.apache.org
Theme Selection Options
Hi, I have a jsp with a custom theme set on my form tag like this . "myxhtml" is our custom theme extends xhtml theme. I extended the Struts2 basic TextFieldTag to toggle it based on the custom visible property. Everything is working fine but I end up getting a empty row b/w two controls if the visiblity is false... I tried to overcome this by setting the "simple" theme programatically in the tag class like this if(visible){ textField.setCssStyle("visibility:visible;"); } else { textField.setSize("0"); textField.setCssStyle("visibility:hidden;width:0px;height:0px;"); textField.setLabel(null); // Label should be empty when field is hidden textField.setKey(null); // I18n key should also be empty for the given field textField.setTheme("simple"); } but this is not working, it still shows the additonal empty row of data by adding "input tag with hidden visibility". I expect this tag to just print out a "input tag with hidden visibility" becase I set the theme as "Simple" if visible property is false.. Can anybody let me know where i'm going wrong here? Regards, Muthu -- View this message in context: http://www.nabble.com/Theme-Selection-Options-tp22573846p22573846.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org