Re: dojo 1.1 in struts 2.0.11 portlets
tom tom wrote: Thanks Jeromy, Is there any reason why YUI datagrid instead of dojo 1.1 grid, Isn't it risky to depend on YUI datagrid, Thanks Moving to YUI datagrid is no riskier than moving to Dojo 1.1. They're both good libraries. Dojo 1.1 is very different than 0.4 but not as different as YUI. Each use different programming models and approaches (as do the other libraries I referenced) so choose one that you're comfortable or productive with. In fact, the very first thing I did with YUI was create a small test action with an ajax datagrid. Anyway watch this video tutorial about the DojoX datagrid: http://dojocampus.org/content/2008/02/17/dojox-grid/ Hope that helps, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
about birt use in struts 2
hi i am one developing reporting apllication in struts 2.0.11 and using sitemesh 2.3 plugin for decorate it now my problem is that when i use my decoraters and my birt tag in jsp like in finalpara.jspi have give tag birt:report id=11A reportDesign=%=report.Report% format=html isHostPage=true birt:param name=mnthqry value=%=mthqry %/birt:param birt:param name=RPTTITLE value=%=rlevel%/birt:param birt:param name=brqry value=%=chlqry%/birt:param birt:param name=RepFor value=/birt:param birt:param name=pusername value=%=ActionContext.getContext().getSession().get(username).toString() %/birt:param birt:param name=brandqry value=%=brandqry %/birt:param birt:param name=itemqry value=%=itemqry %/birt:param % if(request.getParameter(pendingzone) !=null) {% birt:param name=ZoneName value=%=pendingzone%/birt:param %} % /birt:report parameter ishostpage true will override complete page and shows only report on this page i have exclude my action which shows finalpara.jsp ,servlet which executes while report engine run like frameset,run,prieview like my decorater.xml is -- decorators defaultdir=/decorators excludes pattern/styles/*/pattern pattern/scripts/*/pattern pattern/images/*/pattern pattern/index.html/pattern pattern/Error.jsp/pattern pattern/yui/*/pattern pattern/struts/* /pattern pattern/dojo/*/pattern pattern/struts/ajax/*/pattern pattern/js/yui/*/pattern pattern/jasper/*/pattern pattern/scriptlib/*/pattern pattern/birt.tld/pattern pattern/FinalPara.do/pattern pattern/frameset/*/pattern pattern/run/*/pattern pattern/preview/*/pattern pattern/parameter/*/pattern /excludes decorator name=main page=main.jsp pattern/*/pattern /decorator decorator name=header page=header.jsp/ decorator name=footer page=pagefooter.jsp/ decorator name=panel page=panel.jsp / --- but it continue to show header ,footer and my report display in decorater body i required complete blank page for my report please help me -- View this message in context: http://www.nabble.com/about-birt-use-in-struts-2-tp17077314p17077314.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: Support for Struts 2 in NetBeans IDE
Yes. A test release is out and we will be releasing the first version soon. As a developer of the plugin, I would like to know your feedback on the plugin. -Rohan Pedro Herrera wrote: I found this NetBeans plugin. Is it working well ? https://nbstruts2support.dev.java.net/ netBeansPluginStrtus2 Herrera -- - Rohan Ranade http://blogs.sun.com/gridbag - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2: Action chaining behaving differently when validations fire
2008/5/5 egetchell [EMAIL PROTECTED]: I just re-read my post and noticed that the Struts configuration for the testB action somehow got mangled. The correct configuration for TestB is action name=testB class=testB method=submit result name=input type=chain testA display /result /action I'd suspect that validation errors are being chained to another action, so after the flow has been forwarded to testA it never reaches the display method. I'm not sure if you can get around it other (easy) way than removing validation interceptors from testA. best regards, Pawel -- Paweł Badeński Student MS Software Engineering Wroclaw University of Technology Wrocław, Poland
Re: Struts 2: Action chaining behaving differently when validations fire
I just came up with another idea. You could also try to move validation up the stack, so it's happening before chain.. It might be tricky tough (as Struts spec states: Sometimes the order of the Interceptors makes a difference.). best regards Pawel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
need post operation after action.
I used wildcard mapping to define several methods that may be called for a struts action class. But each of those methods contain duplicate lines of code that need to be called before the method returns. Is there a way in struts to wire up a post operation after the action method (whichever it happens to be) gets called? thanks, filipe ps: yes.. I could do the following... but I'd rather leave this as a last resort... public String execute() { post(); return SUCCESS; } public String save() { post(); return SUCCESS; } All other action methods public void post_operation() { blah blah blah; }
Upgrade from 2.06 to 2.011.1 Error
After upgrading my libraries and TLD from 2.06 to 2.0.11.1, I am getting the following error. 2008-05-06 10:42:36,648 ERROR (http-0.0.0.0-8080-2:) [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/sca].[ jsp]] Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: /jsps/npc/DownloadContractsWithErrors.jsp(43,2) According to TLD or attribute directive in tag file, attribute action does not accept any expressions Do I have the correct TLD?
Re: need post operation after action.
--- Fernandes, Filipe [EMAIL PROTECTED] wrote: I used wildcard mapping to define several methods that may be called for a struts action class. But each of those methods contain duplicate lines of code that need to be called before the method returns. Is there a way in struts to wire up a post operation after the action method (whichever it happens to be) gets called? You basically want the opposite of prepare, but running before the result is rendered. AFAIK there's nothing like that built in to S2, and I'm not as opposed to your solution as some people might be. By explicitly putting the call in the method it's crystal-clear what's happening, where, why, and how. One solution I used, sort of a horrible interceptor/AOP hybrid, was to define an interface that accepted a Spring-configured list of pre- and post-processing to run during action method execution... It was less complicated than Spring AOP (and didn't sound as scary) and was application-specific (in that the pre-/post-processing methods had some idea what types of things they'd be expected to do). Not sure if I'd do it like that again, although it suited my purposes at the time. Just an idea, and I'll be interested in what other people have to say. With Spring's AOP available I'm not as sure I like the more custom mechanism I used, but it *was* easier for us at the time. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Upgrade from 2.06 to 2.011.1 Error
--- Hoying, Ken [EMAIL PROTECTED] wrote: After upgrading my libraries and TLD from 2.06 to 2.0.11.1, I am getting the following error. 2008-05-06 10:42:36,648 ERROR (http-0.0.0.0-8080-2:) [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/sca].[ jsp]] Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: /jsps/npc/DownloadContractsWithErrors.jsp(43,2) According to TLD or attribute directive in tag file, attribute action does not accept any expressions Do I have the correct TLD? Yep. See the release notes for 2.0.10/2.0.11 for the short explanation, or any number of list messages posted since then for workarounds and solutions. http://struts.apache.org/2.x/docs/release-notes-2010.html http://struts.apache.org/2.x/docs/release-notes-2011.html Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Upgrade from 2.06 to 2.011.1 Error
Thanks, Dave. I saw the short blurb in the release notes on the changes for security. I did not see any work around. The only one I have been able to come up with is to use the previous versions TLD with the new code. I am not sure that I want to have to rewrite all of my JSP pages to not use JSTL in Struts tags. It appears from some of the documentation that I am seeing on 2.1 that I may have to rewrite again anyhow as Ajax and Dojo support sounds like it is going to be separate and use plugins instead. Editorial: I cannot help but wonder if these consecutive painful upgrades are going to have an adverse affect on Struts2 adoption, future user base and perception. I have been a big proponent of Struts2 up till now, but must admit that I am finding myself questioning if there are not better frameworks with friendlier release strategies available. If it was a vendor rather than open source that did this to me, I would be one very unhappy customer. Thanks, Ken -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 12:14 PM To: Struts Users Mailing List Subject: Re: Upgrade from 2.06 to 2.011.1 Error --- Hoying, Ken [EMAIL PROTECTED] wrote: After upgrading my libraries and TLD from 2.06 to 2.0.11.1, I am getting the following error. 2008-05-06 10:42:36,648 ERROR (http-0.0.0.0-8080-2:) [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/sca].[ jsp]] Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: /jsps/npc/DownloadContractsWithErrors.jsp(43,2) According to TLD or attribute directive in tag file, attribute action does not accept any expressions Do I have the correct TLD? Yep. See the release notes for 2.0.10/2.0.11 for the short explanation, or any number of list messages posted since then for workarounds and solutions. http://struts.apache.org/2.x/docs/release-notes-2010.html http://struts.apache.org/2.x/docs/release-notes-2011.html 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]
Struts tag to safe print a value
Hi all, I have been trawling the docs, but haven't yet found a tag listed that will do this. I need to display some text on the screen, which may contain newlines, or stray html tags. I'd like the newlines converted to br/, and have other html tags stripped/quoted or otherwise rendered harmless. Is there a struts tag that does this? Regards, Graham -- smime.p7s Description: S/MIME Cryptographic Signature
Re: struts2 migration
We use EL/JSP in some of our pages, and I have been told by a coworker that after 2.0.9 EL is disabled. So moving would be difficult, unless there is some way to re-enable it? What is the standard way of referencing variables. My boss prefers that I not disable errors, is there a way to disable it for log4j.rootLogger=ERROR, file1 and enable it for another file? When I tried this, I got a Duplicate property key error. log4j.logger.org.apache.struts2.dispatcher.Dispatcher=OFF,file1 log4j.logger.org.apache.struts2.dispatcher.Dispatcher=WARN,struts On Mon, May 5, 2008 at 6:44 PM, Jeromy Evans [EMAIL PROTECTED] wrote: kal stevens wrote: My company has migrated from struts1 to struts2, and we have had a few continual problems that we can not figure out how to deal with. First when we redeploy our application we have to remove everything in the work/Catalina directory, or the application may not be redeployed correctly. we have tried both a symbolic link from the webapps directory to a war file, and from the webapps directory to an exploded directory. Can someone point me to any information on how to fix this? or what might be causing the issue. Struts2 leaves some threadlocals active that prevent it from shutting down cleanly. There is no fix in 2.0.11.x. There is a fix in 2.1.x. https://issues.apache.org/struts/browse/WW-2167 If there is a 2.0.12 release I'd vote for this 'fix' to be applied. Another issue is that when someone types in a bogus url we get an entry in the log4j logging So if someone types in www.example.com/member/visitors.do we get 2008-05-05 17:23:31,898 ERROR [Dispatcher] Could not find action or result There is no Action mapped for namespace /member and action name visitors. - [unknown location] Is there a recommended way of dealing with this? Change the setting for log4j. Set the logging level for org.apache.struts2.dispatcher.Dispatcher to none. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts Taglib
I've added a custom taglib in my project. One of these tags does some logic to generate a series of links. Given one target URL, I want to create X links to that URL with one changed parameter. If the given URL has parameters, I want them to all be preserved except for one named 'pageNumber' which may be altered or added if missing I would like to use struts URL tags in this. Ideally my tag handler would generate s:url and s:a tags that could then be processed by struts. I don't see a way to do this though. The only real way I immediately see is to use a s:url tag before my tag to put a value on the stack then say something like prefix:myTag url=${sURL} to get a string in my handler. Then I'd have to parse for the pageNumber variable to make sure I don't duplicate it, and generate html links directly. I'd really strongly prefer some way of doing the above where I can generate struts tags to be re-processed. I know this is more of a general JSP oriented question, but it's worth asking here. Is there a clear way to do this sort of thing?
Re: s:datetimepicker 2
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, i did it like that: in package_??.properties (?? for the locale) dateformat=dd.MM. in my jsp: s:set name=dateformat value=%{getTextd('dateformat'}) / s:datetimepicker format=%{dateformat} ... / Maybe it works for you ~ volker Ian Meikle schrieb: | Hi, | | In the doc for s:datetimepicker it says: The value sent to the server | is a locale-independent value, in a hidden | field as defined by the name attribute. The value will be formatted | conforming to RFC3 339 (-MM-dd'T'HH:mm:ss) | | From my debugging two values are sent to the server. | 1) dojo.attributeName | 2) attributename | | 1) is in the RFC format 2) is in the typed in format. | | This means that the typed in format is the one converted and set into my | object after being procesed by XWorkBasicConverter.doConvertToDate | For a pure date field this conversion code uses the request locale to | convert the string into a date. | However because the typed in string is not as per locale (see my previous | post on s:datetimepicker this conversion fails). | If I change the template for the picker and swap the params so that | attributeName actually gets the value in RFC format, the | conversion also fails because this format is not checked for pure date | fields, only datetime fields. | | Can anyone shed some light on this ? | | Regards | Ian | | CSC Solutions Norge AS | Registered Office: Sandsliåsen 57, 5254 Sandsli, Norway | Registered in Norway No: 958 958 455 | | - | This is a PRIVATE message. If you are not the intended recipient, please | delete without copying and kindly advise us by e-mail of the mistake in | delivery. | NOTE: Regardless of content, this e-mail shall not operate to bind CSC to | any order or other contract unless pursuant to explicit written agreement | or government initiative expressly permitting the use of e-mail for such | purpose. | - | - -- - --- Volker Karlmeier Friedrich-Freye-Str. 61 45481 Mülheim/Ruhr Tel. : (+49) 208-7785675 Mobil: (+49) 176-21056587 Mail : [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFIIKeXaEMQXBIqssERApLfAJ9CjpbwSMoGqL2DqgjKP+bjvrfl9wCfYaqx JalJr0FeT3sQ5fSuQXqoNYE= =V+oP -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts] Struts Taglib
Michael Gagnon wrote: I've added a custom taglib in my project I would like to use struts URL tags in this. Ideally my tag handler would generate s:url and s:a tags that could then be processed by struts. I don't see a way to do this though A tag is a Java object. You can always instantiate org.apache.struts2.views.jsp.URLTag in your custom tag, set the appropriate attributes (don't forget to setJspContext()), and call doTag() on it. -Dale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Does Execute and Wait Interceptor work with ServletRequestAware interface?
I am using the Execute and Wait Interceptor on my login action. This action needs to access the HTTPRequest object so that it can get the HTTPSessionId, and the request headers and store all of this in the database as well as putting the userObject in the session itself. Documentation says that when using ExecAndWait I need to implement SessionAware interface and access my session via the sessionMap. However, the only way I can get the request headers and the sessionID is by implementing ServletRequestAware, getting the request object first, and then getting the real HTTPSession from there (not the SessionMap). I am in a quandry. Do I need to implement both interfaces? Is ServletRequestAware as reliable when using execAndWait as SessionAware is? -- View this message in context: http://www.nabble.com/Does-Execute-and-Wait-Interceptor-work-with-ServletRequestAware-interface--tp17090576p17090576.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]
Why does struts assign indexedValues from 2nd index.......please help
I wanted to find a way to handle dynamic number of arguments for my poll-posting form which should be able to handle dynamic number of choice fields. So i maintained a list (pollChoices -- java.util.List type) for maintaining dynamic number of choice fields. == PollForm.java == package com.myapp.struts.formbeans; import org.apache.struts.action.*; import javax.servlet.http.*; import java.util.*; import org.apache.commons.lang.*; /** * * @author Sai */ public class PollForm extends ActionForm { private String pollQuestion; private String numberOfDays; private ArrayList pollChoices; /** Creates a new instance of BasicForm */ public PollForm() { } public void reset(ActionMapping map, HttpServletRequest req) { System.out.println(Reset start...); setPollQuestion(); setNumberOfDays(); pollChoices = new ArrayList(); System.out.println(Reset end...); } public ActionErrors validate(ActionMapping map, HttpServletRequest req) { System.out.println(Validate method...); ActionErrors errors = new ActionErrors(); if(StringUtils.isBlank(pollQuestion)) errors.add(pollQuestion,new ActionMessage(errors.required,Poll Question)); if(StringUtils.isBlank(numberOfDays)) errors.add(numberOfDays,new ActionMessage(errors.required,Number of days)); if(pollChoices.size() 2) errors.add(pollChoice,new ActionMessage(errors.required,Atleast two poll choices)); return errors; } public String getPollQuestion() { return pollQuestion; } public void setPollQuestion(String pollQuestion) { this.pollQuestion = pollQuestion; } public String getNumberOfDays() { return numberOfDays; } public void setNumberOfDays(String numberOfDays) { this.numberOfDays = numberOfDays; } public String getPollChoice(int index) { if(index = pollChoices.size()) { pollChoices.add(index,new String()); } return (String) pollChoices.get(index); } public void setPollChoice(int index,String choice) { System.out.println(size: +pollChoices.size()+- index:+index); if(index pollChoices.size()) pollChoices.set(index,choice); else pollChoices.add(index,choice); } } === The html-form looks like below html:form method=get action=/multipleForm html:text property=pollQuestion /br/br/ html:text property=numberOfDays /br/br/ html:text property=pollChoice[0] /br/br/ html:text property=pollChoice[1] /br/br/ html:text property=pollChoice[2] /br/br/ html:text property=pollChoice[3] /br/br/ html:text property=pollChoice[4] /br/br/ html:text property=pollChoice[5] /br/br/ html:text property=pollChoice[6] /br/br/ html:text property=pollChoice[7] /br/br/ html:submit / /html:form = I'm using struts 1.2.7 Now the problem is when struts populates my pollChoice fields using bean-utils setIndexedProperty method it's setting is starting from index 2. I mean this is the output when i ran my program. Reset start... Reset end... size: 0- index:2 size: 0- index:3 size: 0- index:1 size: 0- index:0 size: 0- index:7 size: 0- index:6 size: 0- index:4 size: 0- index:5 Validate method... Note: I've provided, System.out.println(size: +pollChoices.size()+- index:+index); inside my PollForm.java to see how struts sets my form. As i said i'm getting an error, that's because the size is 0 and the index it's trying to set is greater than that.
Re: Why does struts assign indexedValues from 2nd index.......please help
I've tried another example also... ListForm.java = package com.myapp.struts.formbeans; import org.apache.struts.action.*; import javax.servlet.http.*; import java.util.*; /** * * @author Sai */ public class ListForm extends ActionForm { private int size = 3; private List friends = new ArrayList(size); public List getFriends( ) { return friends; } public String getFriend(int index) { if (index = friends.size( )) { friends.add(index, new String()); } return (String) friends.get(index); } public void setFriend(int index, String name) { System.out.println(size: +friends.size()+- index:+index); } public void reset(ActionMapping mapping, HttpServletRequest request) { // prepopulate the list with empty strings friends = new ArrayList( ); for (int i=0; isize;i++) friends.add(); } } pollsForm2.jsp == h2List Form Test/h2 html:form action=/multipleForm method=get Who are your 3 friends:br / Friend 1: html:text property=friend[0]/br / Friend 2: html:text property=friend[1]/br / Friend 3: html:text property=friend[2]/br / Friend 3: html:text property=friend[3]/br / Friend 3: html:text property=friend[4]/br / Friend 3: html:text property=friend[5]/br / Friend 3: html:text property=friend[6]/br / Friend 3: html:text property=friend[7]/br / html:submit/ /html:form The output while setting the request parameter values is as follows.. size: 3- index:0 size: 3- index:4 size: 3- index:3 size: 3- index:6 size: 3- index:7 size: 3- index:5 size: 3- index:1 size: 3- index:2 We can see here also struts is not settings the parameter values in order ( i mean according to the index ). It's trying to set object at 0 index, jumping by trying to set at 4 index. Why is this so??is this problem solved in struts 1.2.9 ( i'm currently using 1.2.7) ?? Any personal suggestions are also appreciated.. Friends, please help On Wed, May 7, 2008 at 1:30 AM, venkat reddy [EMAIL PROTECTED] wrote: I wanted to find a way to handle dynamic number of arguments for my poll-posting form which should be able to handle dynamic number of choice fields. So i maintained a list (pollChoices -- java.util.List type) for maintaining dynamic number of choice fields. == PollForm.java == package com.myapp.struts.formbeans; import org.apache.struts.action.*; import javax.servlet.http.*; import java.util.*; import org.apache.commons.lang.*; /** * * @author Sai */ public class PollForm extends ActionForm { private String pollQuestion; private String numberOfDays; private ArrayList pollChoices; /** Creates a new instance of BasicForm */ public PollForm() { } public void reset(ActionMapping map, HttpServletRequest req) { System.out.println(Reset start...); setPollQuestion(); setNumberOfDays(); pollChoices = new ArrayList(); System.out.println(Reset end...); } public ActionErrors validate(ActionMapping map, HttpServletRequest req) { System.out.println(Validate method...); ActionErrors errors = new ActionErrors(); if(StringUtils.isBlank(pollQuestion)) errors.add(pollQuestion,new ActionMessage(errors.required,Poll Question)); if(StringUtils.isBlank(numberOfDays)) errors.add(numberOfDays,new ActionMessage(errors.required,Number of days)); if(pollChoices.size() 2) errors.add(pollChoice,new ActionMessage(errors.required,Atleast two poll choices)); return errors; } public String getPollQuestion() { return pollQuestion; } public void setPollQuestion(String pollQuestion) { this.pollQuestion = pollQuestion; } public String getNumberOfDays() { return numberOfDays; } public void setNumberOfDays(String numberOfDays) { this.numberOfDays = numberOfDays; } public String getPollChoice(int index) { if(index = pollChoices.size()) { pollChoices.add(index,new String()); } return (String) pollChoices.get(index); } public void setPollChoice(int index,String choice) { System.out.println(size: +pollChoices.size()+- index:+index); if(index pollChoices.size()) pollChoices.set(index,choice); else pollChoices.add(index,choice); } } === The html-form looks like below html:form method=get action=/multipleForm html:text property=pollQuestion
Re: Does Execute and Wait Interceptor work with ServletRequestAware interface?
mojoRising wrote: I am using the Execute and Wait Interceptor on my login action. This action needs to access the HTTPRequest object so that it can get the HTTPSessionId, and the request headers and store all of this in the database as well as putting the userObject in the session itself. Documentation says that when using ExecAndWait I need to implement SessionAware interface and access my session via the sessionMap. However, the only way I can get the request headers and the sessionID is by implementing ServletRequestAware, getting the request object first, and then getting the real HTTPSession from there (not the SessionMap). I am in a quandry. Do I need to implement both interfaces? Is ServletRequestAware as reliable when using execAndWait as SessionAware is? The documentation doesn't say you specifically need to implement SessionAware, it just uses that as an example of how to reference resources you might otherwise acquire through ActionContext. Implementing ServletRequestAware should be fine. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why does struts assign indexedValues from 2nd index.......please help
I can't tell you why the parameters are being passed out-of-sequence (I would guess they're being shuffled through a HashMap somewhere) but it's easy to deal with: simply have your setter grow the list as necessary to accommodate the passed index. Something like this: public void setFriend(int index, String name) { while (friends.size() index) { friends.add(null); // or or whatever } friends.put(index, name); } HTH, L. venkat reddy wrote: I've tried another example also... ListForm.java = package com.myapp.struts.formbeans; import org.apache.struts.action.*; import javax.servlet.http.*; import java.util.*; /** * * @author Sai */ public class ListForm extends ActionForm { private int size = 3; private List friends = new ArrayList(size); public List getFriends( ) { return friends; } public String getFriend(int index) { if (index = friends.size( )) { friends.add(index, new String()); } return (String) friends.get(index); } public void setFriend(int index, String name) { System.out.println(size: +friends.size()+- index:+index); } public void reset(ActionMapping mapping, HttpServletRequest request) { // prepopulate the list with empty strings friends = new ArrayList( ); for (int i=0; isize;i++) friends.add(); } } pollsForm2.jsp == h2List Form Test/h2 html:form action=/multipleForm method=get Who are your 3 friends:br / Friend 1: html:text property=friend[0]/br / Friend 2: html:text property=friend[1]/br / Friend 3: html:text property=friend[2]/br / Friend 3: html:text property=friend[3]/br / Friend 3: html:text property=friend[4]/br / Friend 3: html:text property=friend[5]/br / Friend 3: html:text property=friend[6]/br / Friend 3: html:text property=friend[7]/br / html:submit/ /html:form The output while setting the request parameter values is as follows.. size: 3- index:0 size: 3- index:4 size: 3- index:3 size: 3- index:6 size: 3- index:7 size: 3- index:5 size: 3- index:1 size: 3- index:2 We can see here also struts is not settings the parameter values in order ( i mean according to the index ). It's trying to set object at 0 index, jumping by trying to set at 4 index. Why is this so??is this problem solved in struts 1.2.9 ( i'm currently using 1.2.7) ?? Any personal suggestions are also appreciated.. Friends, please help On Wed, May 7, 2008 at 1:30 AM, venkat reddy [EMAIL PROTECTED] wrote: I wanted to find a way to handle dynamic number of arguments for my poll-posting form which should be able to handle dynamic number of choice fields. So i maintained a list (pollChoices -- java.util.List type) for maintaining dynamic number of choice fields. == PollForm.java == package com.myapp.struts.formbeans; import org.apache.struts.action.*; import javax.servlet.http.*; import java.util.*; import org.apache.commons.lang.*; /** * * @author Sai */ public class PollForm extends ActionForm { private String pollQuestion; private String numberOfDays; private ArrayList pollChoices; /** Creates a new instance of BasicForm */ public PollForm() { } public void reset(ActionMapping map, HttpServletRequest req) { System.out.println(Reset start...); setPollQuestion(); setNumberOfDays(); pollChoices = new ArrayList(); System.out.println(Reset end...); } public ActionErrors validate(ActionMapping map, HttpServletRequest req) { System.out.println(Validate method...); ActionErrors errors = new ActionErrors(); if(StringUtils.isBlank(pollQuestion)) errors.add(pollQuestion,new ActionMessage(errors.required,Poll Question)); if(StringUtils.isBlank(numberOfDays)) errors.add(numberOfDays,new ActionMessage(errors.required,Number of days)); if(pollChoices.size() 2) errors.add(pollChoice,new ActionMessage(errors.required,Atleast two poll choices)); return errors; } public String getPollQuestion() { return pollQuestion; } public void setPollQuestion(String pollQuestion) { this.pollQuestion = pollQuestion; } public String getNumberOfDays() { return numberOfDays; } public void setNumberOfDays(String numberOfDays) { this.numberOfDays = numberOfDays; } public String getPollChoice(int index) { if(index = pollChoices.size()) { pollChoices.add(index,new String()); } return (String) pollChoices.get(index); } public void setPollChoice(int index,String choice) {
Re: Struts 2 Annotation Validation Problem
I solved this problem and I figure that nabble might want to record the end reason for the bug. Another method entirely, elsewhere on ProductDetailAction, had a @Transactional annotation. It didn't need one -- I was using injected transaction management and the OpenEntityManagerInViewFilter. Why the error message below was generated, instead of hey dummy, don't use @Transactional in this context, is beyond me, but at least it's fixed. jk On Wed, Apr 30, 2008 at 3:47 PM, Jim Kiley [EMAIL PROTECTED] wrote: Hi folks, I've run into a problem with Struts 2 validation annotations. In short -- I have a VisitorFieldValidator on an action POJO named ProductDetailAction. I have RequiredFieldValidator and RequiredStringValidator on one field within the visited object. Now -- ProductDetailAction did not (originally) inherit from ActionSupport. I could see validation errors cropping up in my log, but my save() method was still executing, because , as I understand it, without ActionSupport (or ValidationAware) there was no way for Struts to redirect my action back to my input() method when it found a validation error. If I change the hierarchy so that ProductDetailAction DOES inherit, indirectly, from ActionSupport, I can't even get to my input() method -- my productDetail JSP doesn't render. Instead I get the following exception: java.lang.IllegalArgumentException: The input() is not defined in action class $Proxy99 at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:412) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:88) (...) I get the same exception if I simply implement ValidationAware in the same way that ActionSupport does. I'm including relevant snippets of ProductDetailAction, Product, and struts.xml below. Does anyone have any insight as to why this might be happening? I'm stumped, and so are my coworkers. Thanks. Jim - ProductDetailAction.java - @Validation public class ProductDetailAction extends FormularyDetailAction { // note: FormularyDetailAction extends ActionSupport // snippery @Override @SkipValidation public String input() throws Exception { if(id==null || id 1) { this.product = new Product(); } else { this.product = formularyBso.fetchProduct(this.id); } return Action.INPUT; } @VisitorFieldValidator(message=) public Product getProduct() { return product; } // snippery } - Product.java - @Entity @Table(name=myrespironics.p_product_versions) @Validation public class Product extends FormularyProduct { //snip @RequiredFieldValidator(message=Please enter a value.) @RequiredStringValidator(message=Please enter a value.) public String getName() { return name; } //snip } - struts.xml - struts package name=user extends=struts-default interceptors interceptor-stack name=myInterceptors interceptor-ref name=exception/ interceptor-ref name=alias/ interceptor-ref name=params/ interceptor-ref name=servletConfig/ interceptor-ref name=prepare / interceptor-ref name=i18n/ interceptor-ref name=chain/ interceptor-ref name=modelDriven/ interceptor-ref name=fileUpload/ interceptor-ref name=checkbox/ interceptor-ref name=staticParams/ interceptor-ref name=params/ interceptor-ref name=conversionError/ interceptor-ref name=validation param name=excludeMethodsinput,back,cancel/param /interceptor-ref interceptor-ref name=workflow param name=excludeMethodsinput,back,cancel/param /interceptor-ref /interceptor-stack /interceptors default-interceptor-ref name=myInterceptors/ global-results result name=error/error.jsp/result /global-results action name=productDetail class=productDetailAction method=input result name=success type=redirect-actionproductList/result result name=input/WEB-INF/secure/formulary/productDetail.jsp/result result name=success-subcategory type=redirect-action param name=actionNamesubcategoryDetail/param param name=parsetrue/param param name=id${subcategoryId}/param /result /action /package /struts -- Jim Kiley Technical
Re: Struts 2 Annotation Validation Problem
Sorry I didn't catch this earlier, but I had the exact same problem. It would seem that when you use Spring's @Transactional annnotation, the class gets proxied... Which I would think is okay, except for the fact that inherited methods (such as ActionSupport.input()) do not make it into the proxied class. :( For me, I simply re-factored the @Transactional method out into a service class that I have injected into my Action class. IMO, it's ugly, but it works. -Wes On Tue, 2008-05-06 at 17:36 -0400, Jim Kiley wrote: I solved this problem and I figure that nabble might want to record the end reason for the bug. Another method entirely, elsewhere on ProductDetailAction, had a @Transactional annotation. It didn't need one -- I was using injected transaction management and the OpenEntityManagerInViewFilter. Why the error message below was generated, instead of hey dummy, don't use @Transactional in this context, is beyond me, but at least it's fixed. jk On Wed, Apr 30, 2008 at 3:47 PM, Jim Kiley [EMAIL PROTECTED] wrote: Hi folks, I've run into a problem with Struts 2 validation annotations. In short -- I have a VisitorFieldValidator on an action POJO named ProductDetailAction. I have RequiredFieldValidator and RequiredStringValidator on one field within the visited object. Now -- ProductDetailAction did not (originally) inherit from ActionSupport. I could see validation errors cropping up in my log, but my save() method was still executing, because , as I understand it, without ActionSupport (or ValidationAware) there was no way for Struts to redirect my action back to my input() method when it found a validation error. If I change the hierarchy so that ProductDetailAction DOES inherit, indirectly, from ActionSupport, I can't even get to my input() method -- my productDetail JSP doesn't render. Instead I get the following exception: java.lang.IllegalArgumentException: The input() is not defined in action class $Proxy99 at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:412) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:88) (...) I get the same exception if I simply implement ValidationAware in the same way that ActionSupport does. I'm including relevant snippets of ProductDetailAction, Product, and struts.xml below. Does anyone have any insight as to why this might be happening? I'm stumped, and so are my coworkers. Thanks. Jim - ProductDetailAction.java - @Validation public class ProductDetailAction extends FormularyDetailAction { // note: FormularyDetailAction extends ActionSupport // snippery @Override @SkipValidation public String input() throws Exception { if(id==null || id 1) { this.product = new Product(); } else { this.product = formularyBso.fetchProduct(this.id); } return Action.INPUT; } @VisitorFieldValidator(message=) public Product getProduct() { return product; } // snippery } - Product.java - @Entity @Table(name=myrespironics.p_product_versions) @Validation public class Product extends FormularyProduct { //snip @RequiredFieldValidator(message=Please enter a value.) @RequiredStringValidator(message=Please enter a value.) public String getName() { return name; } //snip } - struts.xml - struts package name=user extends=struts-default interceptors interceptor-stack name=myInterceptors interceptor-ref name=exception/ interceptor-ref name=alias/ interceptor-ref name=params/ interceptor-ref name=servletConfig/ interceptor-ref name=prepare / interceptor-ref name=i18n/ interceptor-ref name=chain/ interceptor-ref name=modelDriven/ interceptor-ref name=fileUpload/ interceptor-ref name=checkbox/ interceptor-ref name=staticParams/ interceptor-ref name=params/ interceptor-ref name=conversionError/ interceptor-ref name=validation param name=excludeMethodsinput,back,cancel/param /interceptor-ref interceptor-ref name=workflow param name=excludeMethodsinput,back,cancel/param /interceptor-ref /interceptor-stack /interceptors default-interceptor-ref name=myInterceptors/
Re: Struts 2 Annotation Validation Problem
It's weird and confusing that inherited methods don't make it into the proxy class. Took me an age to figure it out, in no small part because I couldn't find an easy way to inspect the proxy class's methods. My workaround was to eliminate the @Transactional annotation entirely, and I'm hoping that doesn't bite me later. jk On Tue, May 6, 2008 at 8:38 PM, Wes Wannemacher [EMAIL PROTECTED] wrote: Sorry I didn't catch this earlier, but I had the exact same problem. It would seem that when you use Spring's @Transactional annnotation, the class gets proxied... Which I would think is okay, except for the fact that inherited methods (such as ActionSupport.input()) do not make it into the proxied class. :( For me, I simply re-factored the @Transactional method out into a service class that I have injected into my Action class. IMO, it's ugly, but it works. -Wes On Tue, 2008-05-06 at 17:36 -0400, Jim Kiley wrote: I solved this problem and I figure that nabble might want to record the end reason for the bug. Another method entirely, elsewhere on ProductDetailAction, had a @Transactional annotation. It didn't need one -- I was using injected transaction management and the OpenEntityManagerInViewFilter. Why the error message below was generated, instead of hey dummy, don't use @Transactional in this context, is beyond me, but at least it's fixed. jk On Wed, Apr 30, 2008 at 3:47 PM, Jim Kiley [EMAIL PROTECTED] wrote: Hi folks, I've run into a problem with Struts 2 validation annotations. In short -- I have a VisitorFieldValidator on an action POJO named ProductDetailAction. I have RequiredFieldValidator and RequiredStringValidator on one field within the visited object. Now -- ProductDetailAction did not (originally) inherit from ActionSupport. I could see validation errors cropping up in my log, but my save() method was still executing, because , as I understand it, without ActionSupport (or ValidationAware) there was no way for Struts to redirect my action back to my input() method when it found a validation error. If I change the hierarchy so that ProductDetailAction DOES inherit, indirectly, from ActionSupport, I can't even get to my input() method -- my productDetail JSP doesn't render. Instead I get the following exception: java.lang.IllegalArgumentException: The input() is not defined in action class $Proxy99 at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:412) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:88) (...) I get the same exception if I simply implement ValidationAware in the same way that ActionSupport does. I'm including relevant snippets of ProductDetailAction, Product, and struts.xml below. Does anyone have any insight as to why this might be happening? I'm stumped, and so are my coworkers. Thanks. Jim - ProductDetailAction.java - @Validation public class ProductDetailAction extends FormularyDetailAction { // note: FormularyDetailAction extends ActionSupport // snippery @Override @SkipValidation public String input() throws Exception { if(id==null || id 1) { this.product = new Product(); } else { this.product = formularyBso.fetchProduct(this.id); } return Action.INPUT; } @VisitorFieldValidator(message=) public Product getProduct() { return product; } // snippery } - Product.java - @Entity @Table(name=myrespironics.p_product_versions) @Validation public class Product extends FormularyProduct { //snip @RequiredFieldValidator(message=Please enter a value.) @RequiredStringValidator(message=Please enter a value.) public String getName() { return name; } //snip } - struts.xml - struts package name=user extends=struts-default interceptors interceptor-stack name=myInterceptors interceptor-ref name=exception/ interceptor-ref name=alias/ interceptor-ref name=params/ interceptor-ref name=servletConfig/ interceptor-ref name=prepare / interceptor-ref name=i18n/ interceptor-ref name=chain/ interceptor-ref name=modelDriven/ interceptor-ref name=fileUpload/ interceptor-ref name=checkbox/ interceptor-ref
Re: Struts 2 Annotation Validation Problem
I could be wrong in my assumption, but I became suspicious when the action class wasn't in the stacktrace... On Tue, 2008-05-06 at 20:48 -0400, Jim Kiley wrote: It's weird and confusing that inherited methods don't make it into the proxy class. Took me an age to figure it out, in no small part because I couldn't find an easy way to inspect the proxy class's methods. My workaround was to eliminate the @Transactional annotation entirely, and I'm hoping that doesn't bite me later. jk On Tue, May 6, 2008 at 8:38 PM, Wes Wannemacher [EMAIL PROTECTED] wrote: Sorry I didn't catch this earlier, but I had the exact same problem. It would seem that when you use Spring's @Transactional annnotation, the class gets proxied... Which I would think is okay, except for the fact that inherited methods (such as ActionSupport.input()) do not make it into the proxied class. :( For me, I simply re-factored the @Transactional method out into a service class that I have injected into my Action class. IMO, it's ugly, but it works. -Wes On Tue, 2008-05-06 at 17:36 -0400, Jim Kiley wrote: I solved this problem and I figure that nabble might want to record the end reason for the bug. Another method entirely, elsewhere on ProductDetailAction, had a @Transactional annotation. It didn't need one -- I was using injected transaction management and the OpenEntityManagerInViewFilter. Why the error message below was generated, instead of hey dummy, don't use @Transactional in this context, is beyond me, but at least it's fixed. jk On Wed, Apr 30, 2008 at 3:47 PM, Jim Kiley [EMAIL PROTECTED] wrote: Hi folks, I've run into a problem with Struts 2 validation annotations. In short -- I have a VisitorFieldValidator on an action POJO named ProductDetailAction. I have RequiredFieldValidator and RequiredStringValidator on one field within the visited object. Now -- ProductDetailAction did not (originally) inherit from ActionSupport. I could see validation errors cropping up in my log, but my save() method was still executing, because , as I understand it, without ActionSupport (or ValidationAware) there was no way for Struts to redirect my action back to my input() method when it found a validation error. If I change the hierarchy so that ProductDetailAction DOES inherit, indirectly, from ActionSupport, I can't even get to my input() method -- my productDetail JSP doesn't render. Instead I get the following exception: java.lang.IllegalArgumentException: The input() is not defined in action class $Proxy99 at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:412) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:88) (...) I get the same exception if I simply implement ValidationAware in the same way that ActionSupport does. I'm including relevant snippets of ProductDetailAction, Product, and struts.xml below. Does anyone have any insight as to why this might be happening? I'm stumped, and so are my coworkers. Thanks. Jim - ProductDetailAction.java - @Validation public class ProductDetailAction extends FormularyDetailAction { // note: FormularyDetailAction extends ActionSupport // snippery @Override @SkipValidation public String input() throws Exception { if(id==null || id 1) { this.product = new Product(); } else { this.product = formularyBso.fetchProduct(this.id); } return Action.INPUT; } @VisitorFieldValidator(message=) public Product getProduct() { return product; } // snippery } - Product.java - @Entity @Table(name=myrespironics.p_product_versions) @Validation public class Product extends FormularyProduct { //snip @RequiredFieldValidator(message=Please enter a value.) @RequiredStringValidator(message=Please enter a value.) public String getName() { return name; } //snip } - struts.xml - struts package name=user extends=struts-default interceptors interceptor-stack name=myInterceptors interceptor-ref name=exception/ interceptor-ref name=alias/ interceptor-ref name=params/ interceptor-ref name=servletConfig/ interceptor-ref
Re: struts2 migration
kal stevens wrote: We use EL/JSP in some of our pages, and I have been told by a coworker that after 2.0.9 EL is disabled. So moving would be difficult, unless there is some way to re-enable it? What is the standard way of referencing variables. EL expressions are disabled within the attributes of struts2 tags. EL can use used elsewhere on the page. The OGNL used by struts tags can reference variables in the page context, request, session, application, action or valuestack, so in almost all cases there's a reasonable way to reference the same variable in EL and OGNL (see the #attr OGNL expression) My boss prefers that I not disable errors, is there a way to disable it for log4j.rootLogger=ERROR, file1 and enable it for another file? When I tried this, I got a Duplicate property key error. log4j.logger.org.apache.struts2.dispatcher.Dispatcher=OFF,file1 log4j.logger.org.apache.struts2.dispatcher.Dispatcher=WARN,struts Sorry, you'll need to check the documentation for log4j. Yes, it's should be possible. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: s:datetimepicker 2
Hi, Thanks for the response. We are using S2 2.0.11.1 and in this version the format attribute does not exist in s:datetimepicket So you suggestion will not work for us. Regards Ian CSC Solutions Norge AS Registered Office: Sandsliåsen 57, 5254 Sandsli, Norway Registered in Norway No: 958 958 455 - This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - Volker Karlmeier [EMAIL PROTECTED] 06.05.2008 20:46 Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: s:datetimepicker 2 -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, i did it like that: in package_??.properties (?? for the locale) dateformat=dd.MM. in my jsp: s:set name=dateformat value=%{getTextd('dateformat'}) / s:datetimepicker format=%{dateformat} ... / Maybe it works for you ~ volker Ian Meikle schrieb: | Hi, | | In the doc for s:datetimepicker it says: The value sent to the server | is a locale-independent value, in a hidden | field as defined by the name attribute. The value will be formatted | conforming to RFC3 339 (-MM-dd'T'HH:mm:ss) | | From my debugging two values are sent to the server. | 1) dojo.attributeName | 2) attributename | | 1) is in the RFC format 2) is in the typed in format. | | This means that the typed in format is the one converted and set into my | object after being procesed by XWorkBasicConverter.doConvertToDate | For a pure date field this conversion code uses the request locale to | convert the string into a date. | However because the typed in string is not as per locale (see my previous | post on s:datetimepicker this conversion fails). | If I change the template for the picker and swap the params so that | attributeName actually gets the value in RFC format, the | conversion also fails because this format is not checked for pure date | fields, only datetime fields. | | Can anyone shed some light on this ? | | Regards | Ian | | CSC Solutions Norge AS | Registered Office: Sandsliåsen 57, 5254 Sandsli, Norway | Registered in Norway No: 958 958 455 | | - | This is a PRIVATE message. If you are not the intended recipient, please | delete without copying and kindly advise us by e-mail of the mistake in | delivery. | NOTE: Regardless of content, this e-mail shall not operate to bind CSC to | any order or other contract unless pursuant to explicit written agreement | or government initiative expressly permitting the use of e-mail for such | purpose. | - | - -- - --- Volker Karlmeier Friedrich-Freye-Str. 61 45481 Mülheim/Ruhr Tel. : (+49) 208-7785675 Mobil: (+49) 176-21056587 Mail : [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFIIKeXaEMQXBIqssERApLfAJ9CjpbwSMoGqL2DqgjKP+bjvrfl9wCfYaqx JalJr0FeT3sQ5fSuQXqoNYE= =V+oP -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]