Re: [S2] Beans list in Dynamic form and ParametersInterceptor problem
Hi. I've solved the problem. And the solution was... reading the documentation with great attention!!! In particular, from http://struts.apache.org/2.0.11/docs/type-conversion.html, the paragraph "Relationship to Parameter Names": 1 - Use JavaBeans! The framework can only create objects if the objects obey the JavaBean specification and provide no-arg constructions, as well as getters and setters where appropriate 2 - Remember that person.name will call getPerson().setName(), but if in order for the framework to create the Person object for you, a setPerson must also exist So: in the bean class, I've added a no-arg constructor; in the action class, I've added a property Song and a setSong method. And now I'm able to fill the list of beans modified from the form in the jsp, and use it in the action. I summerize all for future benefits. -Problem: submit a dynamic form created with a list of beans and use these beans in the action. -BEAN Provide a no-arg constructor and getters and setters for all properties. public class Song implements Serializable { private String SongId; private String StartDate; private String EndDate; private String StatusLoad; private String StatusSellable; public Song(){} public String getStartDate() {return StartDate;} public void setStartDate(String startDate) {StartDate = startDate;} public String getEndDate() {return EndDate;} public void setEndDate(String endDate) {EndDate = endDate;} public String getStatusLoad() {return StatusLoad;} public void setStatusLoad(String statusLoad) {StatusLoad = statusLoad;} public String getStatusSellable() {return StatusSellable;} public void setStatusSellable(String statusSellable) {StatusSellable = statusSellable;} public String getSongId() {return SongId;} public void setSongId(String songId) {SongId = songId;} } -ACTION Provide the beans list property with get and set, and a bean property with set. public class ResubmitAction extends BaseAction { private List songs = new ArrayList(); private Song song = null; public String resubmitCatalog() { ... //use the beans list coming from the form if (this.songs != null) { log.debug("song list size "+songs.size()); Iterator iter = this.songs.iterator(); while (iter.hasNext()) { Song tmp = (Song) iter.next(); if (tmp != null) { log.debug("--\n"+tmp.toString()+"\n--"); } } } } public List getSongs() {return songs;} public void setSongs(List songs) {this.songs = songs;} public void setSong(Song song) {this.song = song;} } -CONVERSION PROPERTIES FILE Create a ActionName-conversion.properties file in the same path of the action, so in my case ResubmitAction-conversion.properties where ResubmitAction.class is located. Element_songs=console.beans.Song CreateIfNull_songs=true In the first version of the file there was also the line KeyProperty_songs=SongId but this is useless because in the jsp I don't use the unique id of the bean for iteration throw the list. -JSP Create the form using iterator tag and use stat.index to reference the current iteration index. Pay attention to the ognl expression. START DATE END DATE STATUS LOAD STATUS SELLABLE and the resulting html is (the beans list has 2 elements): That's all. And I think it's enough... It was hard, but with an happy end. Thanks to all for replies to my first post. -- View this message in context: http://www.nabble.com/-S2--Beans-list-in-Dynamic-form-and-ParametersInterceptor-problem-tp15016850p15038327.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] Beans list in Dynamic form and ParametersInterceptor problem
Hi David, the OutOfMemoryError was solved using %{#stat.index} in the inputs, as suggested by Laurie Harper. You're right about the web server heap space, but the cause of the error was obviously my wrong ognl expression. Does this stack trace begin with a java.lang.OutOfMemoryError as well? Have you tried increasing the heap space size for your Web Server? Just a thought . . . Regards, David Hernandez -- View this message in context: http://www.nabble.com/-S2--Beans-list-in-Dynamic-form-and-ParametersInterceptor-problem-tp15016850p15027374.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] Beans list in Dynamic form and ParametersInterceptor problem
The problem of songs list size is solved using #stat.index. But not the parameters error. The list size now is 1, but the element inside is null. So, it can't create song beans and put it into the list. In the conversion props file the Element_songs is correctly set to the Song bean class. The KeyProperty is useless now using the iterator index? Here some logs: DEBUG (interceptor.ParametersInterceptor:148) - Setting params songs[1].endDate => [ 01.01.2099 ] [ ] songs[0].endDate => [ 01.01.2099 ] songs[0].statusLoad => [ Publish ] songs[0].statusSellable => [ 1 ] songs[1].songId => [ 9121591 ] songs[1].statusLoad => [ Publish ] songs[1].statusSellable => [ 1 ] songs[0].songId => [ 9121587 ] songs[0].startDate => [ 29.11.2007 ] songs[1].startDate => [ 29.11.2007 ] ERROR (interceptor.ParametersInterceptor:204) - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'songs[0].endDate' on 'class it.telecomitalia.orchestrator.console.actions.ResubmitAction: Error setting expression 'songs[0].endDate' with value '[Ljava.lang.String;@16825b5' (...) Reading the manual at http://struts.apache.org/2.0.11/docs/type-conversion.html it says: "Notice the () notation! Do not use [] notation, which is for Maps only!" but changing the notation from songs[%{#stat.index}].property to songs(%{#stat.index}).property in the jsp, the form isn't populated. -- View this message in context: http://www.nabble.com/-S2--Beans-list-in-Dynamic-form-and-ParametersInterceptor-problem-tp15016850p15022328.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]
[S2] Beans list in Dynamic form and ParametersInterceptor problem
Hi. I'm having problem in submitting a dynamic form created with a list of beans. I'm able to build the jsp with the form and (it seems...) to pass parameters to action, but I'm not able to get the correct list of beans after submitting the form. I've tried with a list of 2 beans. Something really strange happens: the list in the action is not null (ok, this shouldn't be strange, if I've done all correctly) and has a size equals to the id of a bean (and this is really strange, maybe there's something wrong?...). Due to the list size, at the end of the action there is also OutOfMemoryError (Java heap space). So, is it an ognl expression problem? I've tried many version but without success. name="#Song[SongId].startDate" name="%{#Song[SongId]}.endDate" name="songs[SongId].statusLoad" name="songs[#Song.SongId].statusSellable" name="%{songs[#Song.SongId]}.endDate" name="%{#songs[Song.SongId]}.statusLoad" I'm using struts 2.0.11. Some code: -ACTION public class ResubmitAction extends BaseAction { private List songs = new ArrayList(); public String resubmitCatalog() { ... if(songs != null) { log.debug("song size "+songs.size()); } } public List getSongs() {return songs;} public void setSongs(List songs) {this.songs = songs;} } -BEAN public class Song implements Serializable { private String SongId; ... private String StartDate; private String EndDate; private String StatusLoad; private String StatusSellable; ... public String getStartDate() {return StartDate;} public void setStartDate(String startDate) {StartDate = startDate;} public String getEndDate() {return EndDate;} public void setEndDate(String endDate) {EndDate = endDate;} public String getStatusLoad() {return StatusLoad;} public void setStatusLoad(String statusLoad) {StatusLoad = statusLoad;} public String getStatusSellable() {return StatusSellable;} public void setStatusSellable(String statusSellable) {StatusSellable = statusSellable;} public String getSongId() {return SongId;} public void setSongId(String songId) {SongId = songId;} } -CONVERSION PROP ResubmitAction-Conversion.properties (in the same path of ResubmitAction.java) KeyProperty_songs=SongId Element_songs=console.beans.Song CreateIfNull_songs=true -JSP START DATE END DATE STATUS LOAD STATUS SELLABLE ... and the HTML is: and another group of input with the second id 9121591 -LOG DEBUG (interceptor.ParametersInterceptor:148) - Setting params (...) songs[9121591].startDate => [ XXX ] songs[9121587].endDate => [ XXX ] songs[9121591].statusLoad => [ XXX ] songs[9121587].statusSellable => [ XXX ] songs[9121587].SongId => [ 9121587 ] songs[9121591].endDate => [ XXX ] songs[9121587].startDate => [ XXX ] songs[9121591].SongId => [ 9121591 ] songs[9121591].statusSellable => [ XXX ] songs[9121587].statusLoad => [ XXX ] ERROR (interceptor.ParametersInterceptor:204) - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'songs[9121587].SongId' on 'class it.telecomitalia.orchestrator.console.actions.ResubmitAction: Error setting expression 'songs[9121587].SongId' with value '[Ljava.lang.String;@3ed81c' ERROR (interceptor.ParametersInterceptor:204) - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'songs[9121587].endDate' on 'class it.telecomitalia.orchestrator.console.actions.ResubmitAction: Error setting expression 'songs[9121587].endDate' with value '[Ljava.lang.String;@1de52ea' ERROR (interceptor.ParametersInterceptor:204) - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'songs[9121587].startDate' on 'class it.telecomitalia.orchestrator.console.actions.ResubmitAction: Error setting expression 'songs[9121587].startDate' with value '[Ljava.lang.String;@1158ce4' (...) song size = 9121591 (...) ERROR java.lang.OutOfMemoryError: Java heap space Thanks in advance. -- View this message in context: http://www.nabble.com/-S2--Beans-list-in-Dynamic-form-and-ParametersInterceptor-problem-tp15016850p15016850.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: Failed while destroying filter during shutdown
Updated struts from 2.0.6 to 2.0.8 (that fixed "FilterDispatcher not cleaning up correctly") but nothing changes. Maybe it's not a FilterDispatcher problem... totojack wrote: > > I've deployed a webapp with struts2 on weblogic 8.1/java 1.4.1_02. > It works fine, but when I make a redeploy it throws an exception with the > following two stack traces. > The NoClassDefFoundError seems strange to me, because the two jars > struts2-core.jar and backpost-util-concurrent.jar (for retrotranslation of > struts2) contain the classes correctly. > Maybe something related with weblogic? > -- View this message in context: http://www.nabble.com/Failed-while-destroying-filter-during-shutdown-tf3884020.html#a9816 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: Cannot access request variable in stack context from jsp
That's right!!! Thanks Aram Aram Mkhitaryan wrote: > > Hi, > > Try > > Best, > Aram > > Aram Mkhitaryan > > 52, 25 Lvovyan, Yerevan 375000, Armenia > > Mobile: +374 91 518456 > E-mail: [EMAIL PROTECTED] > > -- View this message in context: http://www.nabble.com/Cannot-access-request-variable-in-stack-context-from-jsp-tf3888285.html#a11023805 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cannot access request variable in stack context from jsp
I'm trying to access a variable in stack context form jsp using the struts tag . The struts debug tag (in struts2) shows me that the key "request" has this array/map of values: {javax.servlet.include.servlet_path=/console/Menu.jsp, struts.request_uri=/console/View.action, struts.view_uri=/console/View.jsp, [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], javax.servlet.include.request_uri=/console/Menu2.jsp, javax.servlet.include.context_path=/} but if I try to write the value of struts.view_uri in the jsp using the tag nothing appears. I've also tried to use without results. Am i using in a wrong way the ognl syntax? Thanks. -- View this message in context: http://www.nabble.com/Cannot-access-request-variable-in-stack-context-from-jsp-tf3888285.html#a11022155 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Failed while destroying filter during shutdown
I've deployed a webapp with struts2 on weblogic 8.1/java 1.4.1_02. It works fine, but when I make a redeploy it throws an exception with the following two stack traces. The NoClassDefFoundError seems strange to me, because the two jars struts2-core.jar and backpost-util-concurrent.jar (for retrotranslation of struts2) contain the classes correctly. Maybe something related with weblogic? Thanks. (CopyOnWriteArrayList.java:35) at com.opensymphony.xwork2.config.ConfigurationManager.setConfigurationProviders(ConfigurationManager.java:100) at com.opensymphony.xwork2.config.ConfigurationManager.destroyConfiguration(ConfigurationManager.java:141) at org.apache.struts2.dispatcher.Dispatcher.cleanup(Dispatcher.java:283) at org.apache.struts2.dispatcher.FilterDispatcher.destroy(FilterDispatcher.java:221) at weblogic.servlet.internal.WebAppServletContext$FilterDestroyAction.run(WebAppServletContext.java:6394) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.destroyFilters(WebAppServletContext.java:5786) at weblogic.servlet.internal.WebAppServletContext.destroy(WebAppServletContext.java:5682) at weblogic.servlet.internal.ServletContextManager.removeContext(ServletContextManager.java:188) at weblogic.servlet.internal.HttpServer.unloadWebApp(HttpServer.java:740) at weblogic.servlet.internal.WebAppModule.destroyContexts(WebAppModule.java:767) at weblogic.servlet.internal.WebAppModule.rollback(WebAppModule.java:745) at weblogic.j2ee.J2EEApplicationContainer.rollbackModule(J2EEApplicationContainer.java:3057) at weblogic.j2ee.J2EEApplicationContainer.rectifyClassLoaders(J2EEApplicationContainer.java:1429) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1176) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2602) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2552) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2474) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) > -- View this message in context: http://www.nabble.com/Failed-while-destroying-filter-during-shutdown-tf3884020.html#a11008451 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]