RE: Any way to inject Spring bean properties into Struts plugin properties?
> -Original Message- > From: Wes Wannemacher [mailto:w...@wantii.com] > Sent: Monday, August 31, 2009 1:35 PM > To: Struts Users Mailing List > Subject: Re: Any way to inject Spring bean properties into Struts > plugin properties? > > On Mon, Aug 31, 2009 at 4:30 PM, KARR, DAVID (ATTCINW) > wrote: > > > > After looking at the Spring injection page again, I see the > possibility > > that this only works with Struts2. Is that correct? > > > > That is correct... I do believe there is information on Spring + > Struts 1 here - > > http://static.springsource.org/spring/docs/2.5.x/reference/web- > integration.html#struts Well, this was promising, but this still only addresses Action properties, not Plugin properties. I imagine there's no easy way to get this done without significant rework of the application. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Any way to inject Spring bean properties into Struts plugin properties?
> -Original Message- > From: KARR, DAVID (ATTCINW) > Sent: Monday, August 31, 2009 1:25 PM > To: user@struts.apache.org > Subject: Any way to inject Spring bean properties into Struts plugin > properties? > > It's been quite a while since I've been in here, and I have some > questions about things just about that old. :) > > I've been asked to look at an app using Struts 1.2.7, to see whether I > can change it from using build-time environment properties to run-time, > using Spring. I've read about > (http://cwiki.apache.org/WW/spring.html), > which describes how to inject Spring bean properties into Action > properties. As the last-edited date on that page (2006) came just a > little bit after Struts 1.2.7 (in geologic time, at least :) ), I would > assume that advice is relevant to 1.2.7. After looking at the Spring injection page again, I see the possibility that this only works with Struts2. Is that correct? > However, the property values I need to inject are not in Action beans, > but in the plugin class specified in the Struts config.xml. Will the > previous advice about implementing Spring injection work exactly the > same with the plugin class, as it does with the Action class? > > Also, there's another even older app that is apparently using Expresso, > and which also has issues of build-time environment properties. I > can't > even find any mention of a possibility of injecting Spring properties > into Expresso classes. Is there any possibility of that? > > - > 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
Any way to inject Spring bean properties into Struts plugin properties?
It's been quite a while since I've been in here, and I have some questions about things just about that old. :) I've been asked to look at an app using Struts 1.2.7, to see whether I can change it from using build-time environment properties to run-time, using Spring. I've read about (http://cwiki.apache.org/WW/spring.html), which describes how to inject Spring bean properties into Action properties. As the last-edited date on that page (2006) came just a little bit after Struts 1.2.7 (in geologic time, at least :) ), I would assume that advice is relevant to 1.2.7. However, the property values I need to inject are not in Action beans, but in the plugin class specified in the Struts config.xml. Will the previous advice about implementing Spring injection work exactly the same with the plugin class, as it does with the Action class? Also, there's another even older app that is apparently using Expresso, and which also has issues of build-time environment properties. I can't even find any mention of a possibility of injecting Spring properties into Expresso classes. Is there any possibility of that? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Loading and Calling Java Script in Struts
You might be better off with something like this: > -Original Message- > From: Casinova [mailto:[EMAIL PROTECTED] > Sent: Friday, November 21, 2008 1:09 PM > To: user@struts.apache.org > Subject: Re: Loading and Calling Java Script in Struts > > > thanks for suggestion > i have struts 1.2.9 > > i have included jstl 1.1 and now i am using like > > <[EMAIL PROTECTED] uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%> > > paths are > > "/> > "/> > "/> > > please refer project structure as given above please suggest > it feels i am near to solution... > Thanks in advance > > > newton.dave wrote: > > > > Use either JSTL's tag, S1's equivalent, or S2's > equivalent. > > I don't remember what version of Struts you're using. > > > > Dave > > > > > > --- On Fri, 11/21/08, Casinova <[EMAIL PROTECTED]> wrote: > > > >> From: Casinova <[EMAIL PROTECTED]> > >> Subject: Re: Loading and Calling Java Script in Struts > >> To: user@struts.apache.org > >> Date: Friday, November 21, 2008, 1:54 PM Sorry to say you but not > >> getting what to type in src="" > >> Please can u brief me.. > >> > >> Thanks a lot > >> > >> > >> > >> newton.dave wrote: > >> > > >> > --- On Fri, 11/21/08, Casinova wrote: > >> >> u tried that but getting jquery null or not a > >> object error. > >> >> [...] > >> >> and right now i m giving absolute path like > >> >> > >> >>
RE: ExecAndWait (navigating back to the progress page)
I'm guessing the operation you're waiting for can take quite a while to complete. Otherwise modifying the architecture of this probably wouldn't be worth it. You might consider the flow of the original action to simply report a simple "submitted and processing" result, and then implement an Ajax-based timeout to quickly check the status of the long-running process. > -Original Message- > From: Chase [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 16, 2008 4:23 PM > To: user@struts.apache.org > Subject: ExecAndWait (navigating back to the progress page) > > I want my users to be able to leave the wait page and return. > Can this be done, what is the best way? > > I've got two actions. ActionA displays a form and the form > submits to ActionB. ActionB is using the ExecAndWait > interceptor. Right now users have to resubmit the form to get > back to their status page (possibly resubmitting the form if > ActionB has finished). How can I have ActionA display the > wait page of ActionB instead of the form? > > Also, is there anyway to make the ExecAndWait interceptor > function per context instead per session? This is a low > volume internal app. > > Thanks, > Chase > > - > 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]
Thoughts of using explicit regexps instead of wilcards for action mappings?
One thing that's always bothered me a bit about using wildcards for action mappings is that it's somewhat less self-documenting than I'd like. Although I like being more concise, I'd really rather have an alternative form that is still concise but still specifies what possible wildcard values to expect. For instance, if instead of specifying an action name like "MyStuff_*", I instead used a regular expression, like "MyStuff_(add|save|load|delete)", that is still more concise than having to repeat all the almost duplicate actions, but it says specifically what patterns to expect. The simplified wildcard system doesn't allow for this. Obviously, this would require a code change to allow regular expression action name matching instead of the simplified regexp that is used now. Has anyone ever considered this?
RE: [OT] What slows you down?
Check the archives for the note I wrote on 6/15 with subject "Some confusion trying to do ajax form submit". Musachy gave me some very useful info (read all his responses). > -Original Message- > From: Sarr, Nathan [mailto:[EMAIL PROTECTED] > Sent: Friday, June 20, 2008 11:16 AM > To: Struts Users Mailing List > Subject: RE: [OT] What slows you down? > > Hi David, > > That sounds great - thanks for tip. I'm going to grab the > Beta release ASAP. > > -Nate > > -Original Message- > From: Karr, David [mailto:[EMAIL PROTECTED] > Sent: Friday, June 20, 2008 1:47 PM > To: Struts Users Mailing List > Subject: RE: [OT] What slows you down? > > > -Original Message- > > From: Sarr, Nathan [mailto:[EMAIL PROTECTED] > > Sent: Friday, June 20, 2008 10:29 AM > > To: Struts Users Mailing List > > Subject: RE: [OT] What slows you down? > > > > 2. Validation - since I'm using Yahoo User Interface Libraries > > (YUI) and my actions are returning JSON or HTML fragments returning > > INPUT didn't really work out so I removed validation in > favor of doing > > it in the ActionSupport class. > > I'm not sure if there is much struts can do about this one. > > Note that in the upcoming 2.1.x release you can use the > "jsonValidationWorkflowStack" and automatically get action > errors directly in your JSON results, using the validation > framework out of the box. There's even a very small > JavaScript module that integrates with what's expected to be > there using the Struts tags, so you can do your submit and > display of errors entirely with the Ajax request. You could > then use the exact same form and do a regular non-Ajax submit > and do the exact same validations (if you wanted to). > > I verified this with a simple test case, using YUI 2.5.2 and > Struts2 2.1.2. > > - > 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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] What slows you down?
> -Original Message- > From: Sarr, Nathan [mailto:[EMAIL PROTECTED] > Sent: Friday, June 20, 2008 10:29 AM > To: Struts Users Mailing List > Subject: RE: [OT] What slows you down? > > 2. Validation - since I'm using Yahoo User Interface Libraries > (YUI) and my actions are returning JSON or HTML fragments > returning INPUT didn't really work out so I removed > validation in favor of doing it in the ActionSupport class. > I'm not sure if there is much struts can do about this one. Note that in the upcoming 2.1.x release you can use the "jsonValidationWorkflowStack" and automatically get action errors directly in your JSON results, using the validation framework out of the box. There's even a very small JavaScript module that integrates with what's expected to be there using the Struts tags, so you can do your submit and display of errors entirely with the Ajax request. You could then use the exact same form and do a regular non-Ajax submit and do the exact same validations (if you wanted to). I verified this with a simple test case, using YUI 2.5.2 and Struts2 2.1.2. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts2 and JSON integration problem (plugin)
> -Original Message- > From: xianwinwin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 17, 2008 11:38 AM > To: user@struts.apache.org > Subject: RE: struts2 and JSON integration problem (plugin) > > > 1. How did you add the reference in eclipse? Make sure it is > listed in the J2EE Module dependencies. > > After placing the JAR I right clicked on the > project-->Properties-->Java Build Path-->Libraries-->Add > External JAR--> jsonplugin-0.30.jar To be sure, do an Export of the WAR file and verify the jar file is in WEB-INF/lib. > 2. Is your URL right? Is the request being made? Is there > return data on the wire? > > yes, it is, the action works (called) by the autocompleter if > I change the extends from 'json-default' to 'Struts-default' That's not really what he's asking. He's asking if the request is being made NOW, with the app in the current state. I assume you're using Firebug. If you're not, fix that. You can see from that whether it made the request or not, and what data was sent, not to mention any response that was sent back. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts2 and JSON integration problem (plugin)
Saying something "doesn't work" doesn't work :) . That tells us nothing. What are you doing? What happens? I tried setting up simple examples based on the documentation in the Wiki, and it worked fine. In addition, there are some additional JSON changes in 2.1.2 beta which I've also been able to use successfully. > -Original Message- > From: xianwinwin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 17, 2008 9:22 AM > To: user@struts.apache.org > Subject: struts2 and JSON integration problem (plugin) > > > Hi all, > > I'm trying to integrate Struts2 with JSON; what is needed > beside a reference to the JAR? > I'm trying to use the plugin and for some reason when I > extends 'json-default' in the xml file - the action doesn't > work (it works when extending struts-default). > > I'm using eclipse, I added the jsonplugin-0.30 to my lib and > added the a reference in the project (java build path). > > Am I misssing something? should I have done anything with the > web.xml? > > thanks for any help > > my xml: > > > extends="json-default"> >class="com.struts.test.TestCompletionAction"> > > > > > > -- > View this message in context: > http://www.nabble.com/struts2-and-JSON-integration-problem-%28 plugin%29-tp17917051p17917051.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Some confusion trying to do ajax form submit
Perfect. Changing my interceptor-ref to the following resolved this: struts\..* > -Original Message- > From: Musachy Barroso [mailto:[EMAIL PROTECTED] > Sent: Monday, June 16, 2008 8:43 AM > To: Struts Users Mailing List > Subject: Re: Some confusion trying to do ajax form submit > > Don't worry about those exceptions. The params interceptor is > trying to bind those parameters to your action and it is > failing. If you want to silence the param interceptor, it has > a "excludeParams" property that takes a list of regular expressions: > > > dojo\..* > > > will ignore any parameter that has "dojo." in it. > > musachy > > On Mon, Jun 16, 2008 at 11:31 AM, Karr, David > <[EMAIL PROTECTED]> wrote: > > So far I think the client side is getting the correct > response, both > > with and without field errors (although I haven't plugged in the > > automated processing of the field errors on the client side yet). > > However, on the server side I'm seeing two exceptions (the other is > > for the other property, "validateOnly"): > > > > ognl.OgnlException: target is null for setProperty(null, > > "enableJSONValidation", [Ljava.lang.String;@a4ed99) > >at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651) > >at ognl.ASTProperty.setValueBody(ASTProperty.java:101) > >at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) > >at ognl.SimpleNode.setValue(SimpleNode.java:246) > >at ognl.ASTChain.setValueBody(ASTChain.java:172) > >at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) > >at ognl.SimpleNode.setValue(SimpleNode.java:246) > >at ognl.Ognl.setValue(Ognl.java:476) > >at > > com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:197) > >at > > > com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.ja > > va > > :150) > >at > > > com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.ja > > va > > :138) > >at > > > com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameter > > s( > > ParametersInterceptor.java:205) > > > > When examining the request parameters, the values for each > of these is > > a single element array with the value "true". > > > > In Firebug, it shows the POST parameters as: > > > > firstName joe > > lastNameblow > > struts.enableJSONValidation true > > > > As I said, despite these exceptions, the client side appears to be > > getting the correct response, so the server side is clearly > receiving > > and setting the "enableJSONValidation" flag. I don't know > what other > > symptoms the exception might be causing. I don't see anything yet. > > > >> -Original Message- > >> From: Musachy Barroso [mailto:[EMAIL PROTECTED] > >> Sent: Sunday, June 15, 2008 5:09 PM > >> To: Struts Users Mailing List > >> Subject: Re: Some confusion trying to do ajax form submit > >> > >> Take a look at this (2.1 only): > >> > >> http://struts.apache.org/2.0.11.1/docs/ajax-validation.html > >> > >> musachy > >> > >> On Sun, Jun 15, 2008 at 8:02 PM, Karr, David <[EMAIL PROTECTED]> > >> wrote: > >> > I have a simple page with validation that I got working with a > >> > conventional submit and action. > >> > > >> > I'm now trying to explore doing an Ajax form submit, and > getting a > >> > JSON response. I'm using YUI on the client side. I'd like > >> to see if > >> > I can get similar data in the JSON response that I would in > >> a normal > >> > submit, for instance, with field errors. > >> > > >> > There are a couple points I could use some help with, not > >> necessarily > >> > related to Ajax or JSON. Please don't hesitate to tell > me if I'm > >> > doing something else wrong, or something I should be aware of. > >> > > >> > My first attempt actually did execute the Ajax request, > and got the > >> > response, but it wasn't JSON. The responseText was just > >> the HTML of > >> > my source JSP, which is also the value of my "input" > >> result. I tried > >> > setting up the JSON action without an "input" result, but
RE: Some confusion trying to do ajax form submit
So far I think the client side is getting the correct response, both with and without field errors (although I haven't plugged in the automated processing of the field errors on the client side yet). However, on the server side I'm seeing two exceptions (the other is for the other property, "validateOnly"): ognl.OgnlException: target is null for setProperty(null, "enableJSONValidation", [Ljava.lang.String;@a4ed99) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651) at ognl.ASTProperty.setValueBody(ASTProperty.java:101) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.ASTChain.setValueBody(ASTChain.java:172) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.Ognl.setValue(Ognl.java:476) at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:197) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java :150) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java :138) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters( ParametersInterceptor.java:205) When examining the request parameters, the values for each of these is a single element array with the value "true". In Firebug, it shows the POST parameters as: firstName joe lastNameblow struts.enableJSONValidation true As I said, despite these exceptions, the client side appears to be getting the correct response, so the server side is clearly receiving and setting the "enableJSONValidation" flag. I don't know what other symptoms the exception might be causing. I don't see anything yet. > -Original Message- > From: Musachy Barroso [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 15, 2008 5:09 PM > To: Struts Users Mailing List > Subject: Re: Some confusion trying to do ajax form submit > > Take a look at this (2.1 only): > > http://struts.apache.org/2.0.11.1/docs/ajax-validation.html > > musachy > > On Sun, Jun 15, 2008 at 8:02 PM, Karr, David > <[EMAIL PROTECTED]> wrote: > > I have a simple page with validation that I got working with a > > conventional submit and action. > > > > I'm now trying to explore doing an Ajax form submit, and getting a > > JSON response. I'm using YUI on the client side. I'd like > to see if > > I can get similar data in the JSON response that I would in > a normal > > submit, for instance, with field errors. > > > > There are a couple points I could use some help with, not > necessarily > > related to Ajax or JSON. Please don't hesitate to tell me if I'm > > doing something else wrong, or something I should be aware of. > > > > My first attempt actually did execute the Ajax request, and got the > > response, but it wasn't JSON. The responseText was just > the HTML of > > my source JSP, which is also the value of my "input" > result. I tried > > setting up the JSON action without an "input" result, but > it seemed to > > complain if I didn't have that. I would have thought the "input" > > parameter wouldn't be relevant in a Ajax/JSON action. If I > filled in > > all the required fields so it didn't result in any field > errors, the > > response was JSON, and it was reasonable (although setting > > "wrapWithComments" didn't appear to have any effect). I > guess there's > > no automatic provision for reporting field errors in a JSON > response, > > so I guess I'll have to build something like that by hand? > > > > Note that I tried to enable the logging interceptor, but I > didn't see > > any output from it. > > > > I have a single action that I was intending to use to > handle both the > > ajax and non-ajax submit. I tried to make it use two > different action > > names in the form, but it seemed to have trouble with that. > > > > I noticed in the generated HTML, I had this in the HTML for the form > > tag: > > > >onsubmit="return YAHOO.strutsform.submitform();; > return true;" > > > > I'm not sure if that "return true;" will cause me trouble, as I'm > > trying to bypass the normal form submission. I think by returning > > false from "submitform", I achieved that, however. > > > > I'll include here the relevant files. Please comment where > appropriate. > > Thanks for your input. > > -
RE: Some confusion trying to do ajax form submit
I think I know what the problem is here. I think I'm mis-sending the extra validation parameters on the POST. I haven't fixed it yet, but I know it's not a problem with Struts. > -Original Message----- > From: Karr, David > Sent: Sunday, June 15, 2008 9:29 PM > To: Struts Users Mailing List > Subject: RE: Some confusion trying to do ajax form submit > > If it's useful to diagnose this, I made my action > ParameterAware so I could inspect the request parameters > directly. I received three parameter keys, "firstName", > "lastName", and "[object Object]". The first two are > expected. The last one is not expected, and that causes the > exception I'm seeing. > > > -Original Message- > > From: Karr, David > > Sent: Sunday, June 15, 2008 8:14 PM > > To: Struts Users Mailing List > > Subject: RE: Some confusion trying to do ajax form submit > > > > --- > > ognl.ExpressionSyntaxException: Malformed OGNL expression: > > [object Object] [ognl.ParseException: Encountered "Object" > at line 1, > > column 9. > > Was expecting one of: > > "," ... > > "=" ... > > "?" ... > > ... > > /-- Encapsulated exception \ > > ognl.ParseException: Encountered "Object" at line 1, column 9. > > Was expecting one of: > > "," ... > > ... > > \--/ > > expr: [object Object] val: [Ljava.lang.String;@fa97f context: > > [EMAIL PROTECTED] > root:[EMAIL PROTECTED], > > [EMAIL PROTECTED] value: > > [Ljava.lang.String;@fa97f > > Jun 15, 2008 8:06:10 PM > > com.opensymphony.xwork2.util.logging.commons.CommonsLogger error > > SEVERE: ParametersInterceptor - [setParameters]: Unexpected > Exception > > caught setting '[object Object]' on 'class > > com.wamu.strutsform.FormAction: Error setting expression '[object > > Object]' with value '[Ljava.lang.String;@fa97f' > > Jun 15, 2008 8:06:10 PM com.wamu.strutsform.FormAction jsonSubmit > > --- > > > > > > > -Original Message- > > > From: Musachy Barroso [mailto:[EMAIL PROTECTED] > > > Sent: Sunday, June 15, 2008 5:09 PM > > > To: Struts Users Mailing List > > > Subject: Re: Some confusion trying to do ajax form submit > > > > > > Take a look at this (2.1 only): > > > > > > http://struts.apache.org/2.0.11.1/docs/ajax-validation.html > > > > > > musachy > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Some confusion trying to do ajax form submit
If it's useful to diagnose this, I made my action ParameterAware so I could inspect the request parameters directly. I received three parameter keys, "firstName", "lastName", and "[object Object]". The first two are expected. The last one is not expected, and that causes the exception I'm seeing. > -----Original Message- > From: Karr, David > Sent: Sunday, June 15, 2008 8:14 PM > To: Struts Users Mailing List > Subject: RE: Some confusion trying to do ajax form submit > > --- > ognl.ExpressionSyntaxException: Malformed OGNL expression: > [object Object] [ognl.ParseException: Encountered "Object" at > line 1, column 9. > Was expecting one of: > "," ... > "=" ... > "?" ... > ... > /-- Encapsulated exception \ > ognl.ParseException: Encountered "Object" at line 1, column 9. > Was expecting one of: > "," ... > ... > \--/ > expr: [object Object] val: [Ljava.lang.String;@fa97f context: > [EMAIL PROTECTED] root:[EMAIL PROTECTED], > [EMAIL PROTECTED] value: > [Ljava.lang.String;@fa97f > Jun 15, 2008 8:06:10 PM > com.opensymphony.xwork2.util.logging.commons.CommonsLogger error > SEVERE: ParametersInterceptor - [setParameters]: Unexpected > Exception caught setting '[object Object]' on 'class > com.wamu.strutsform.FormAction: Error setting expression > '[object Object]' with value '[Ljava.lang.String;@fa97f' > Jun 15, 2008 8:06:10 PM com.wamu.strutsform.FormAction jsonSubmit > --- > > > > -Original Message- > > From: Musachy Barroso [mailto:[EMAIL PROTECTED] > > Sent: Sunday, June 15, 2008 5:09 PM > > To: Struts Users Mailing List > > Subject: Re: Some confusion trying to do ajax form submit > > > > Take a look at this (2.1 only): > > > > http://struts.apache.org/2.0.11.1/docs/ajax-validation.html > > > > musachy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Some confusion trying to do ajax form submit
Ok, this looks promising. I changed the package in my struts.xml to the following: - true /form.jsp - I then copied in updated jars from 2.1.2, being: commons-fileupload-1.2.1.jar, xstream-1.2.2.jar, json-lib-2.1.jar, struts2-core-2.1.2.jar, xwork-2.1.1.jar, freemarker-2.3.12.jar, struts2-config-browser-plugin-2.1.2.jar My results are a bit worse than before, however. Now, whether it passes validation or not I see a long set of exceptions in the log. If it passes validation, I still get a good JSON result. If it doesn't pass validation, my responseText is the input JSP. --- ognl.ExpressionSyntaxException: Malformed OGNL expression: [object Object] [ognl.ParseException: Encountered "Object" at line 1, column 9. Was expecting one of: "," ... "=" ... "?" ... ... /-- Encapsulated exception \ ognl.ParseException: Encountered "Object" at line 1, column 9. Was expecting one of: "," ... ... \--/ expr: [object Object] val: [Ljava.lang.String;@fa97f context: [EMAIL PROTECTED] root:[EMAIL PROTECTED], [EMAIL PROTECTED] value: [Ljava.lang.String;@fa97f Jun 15, 2008 8:06:10 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting '[object Object]' on 'class com.wamu.strutsform.FormAction: Error setting expression '[object Object]' with value '[Ljava.lang.String;@fa97f' Jun 15, 2008 8:06:10 PM com.wamu.strutsform.FormAction jsonSubmit --- > -Original Message- > From: Musachy Barroso [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 15, 2008 5:09 PM > To: Struts Users Mailing List > Subject: Re: Some confusion trying to do ajax form submit > > Take a look at this (2.1 only): > > http://struts.apache.org/2.0.11.1/docs/ajax-validation.html > > musachy > > On Sun, Jun 15, 2008 at 8:02 PM, Karr, David > <[EMAIL PROTECTED]> wrote: > > I have a simple page with validation that I got working with a > > conventional submit and action. > > > > I'm now trying to explore doing an Ajax form submit, and getting a > > JSON response. I'm using YUI on the client side. I'd like > to see if > > I can get similar data in the JSON response that I would in > a normal > > submit, for instance, with field errors. > > > > There are a couple points I could use some help with, not > necessarily > > related to Ajax or JSON. Please don't hesitate to tell me if I'm > > doing something else wrong, or something I should be aware of. > > > > My first attempt actually did execute the Ajax request, and got the > > response, but it wasn't JSON. The responseText was just > the HTML of > > my source JSP, which is also the value of my "input" > result. I tried > > setting up the JSON action without an "input" result, but > it seemed to > > complain if I didn't have that. I would have thought the "input" > > parameter wouldn't be relevant in a Ajax/JSON action. If I > filled in > > all the required fields so it didn't result in any field > errors, the > > response was JSON, and it was reasonable (although setting > > "wrapWithComments" didn't appear to have any effect). I > guess there's > > no automatic provision for reporting field errors in a JSON > response, > > so I guess I'll have to build something like that by hand? > > > > Note that I tried to enable the logging interceptor, but I > didn't see > > any output from it. > > > > I have a single action that I was intending to use to > handle both the > > ajax and non-ajax submit. I tried to make it use two > different action > > names in the form, but it seemed to have trouble with that. > > > > I noticed in the generated HTML, I had this in the HTML for the form > > tag: > > > >onsubmit="return YAHOO.strutsform.submitform();; > return true;" > > > > I'm not sure if that "return true;" will cause me trouble, as I'm > > trying to bypass the normal form submission. I think by returning > > false from "submitform", I achieved that, however. > > > > I'll include here the relevant files. Please comment where > appropriate. > > Thanks for your input. > > ---form.jsp > > <%@ page language="ja
Some confusion trying to do ajax form submit
I have a simple page with validation that I got working with a conventional submit and action. I'm now trying to explore doing an Ajax form submit, and getting a JSON response. I'm using YUI on the client side. I'd like to see if I can get similar data in the JSON response that I would in a normal submit, for instance, with field errors. There are a couple points I could use some help with, not necessarily related to Ajax or JSON. Please don't hesitate to tell me if I'm doing something else wrong, or something I should be aware of. My first attempt actually did execute the Ajax request, and got the response, but it wasn't JSON. The responseText was just the HTML of my source JSP, which is also the value of my "input" result. I tried setting up the JSON action without an "input" result, but it seemed to complain if I didn't have that. I would have thought the "input" parameter wouldn't be relevant in a Ajax/JSON action. If I filled in all the required fields so it didn't result in any field errors, the response was JSON, and it was reasonable (although setting "wrapWithComments" didn't appear to have any effect). I guess there's no automatic provision for reporting field errors in a JSON response, so I guess I'll have to build something like that by hand? Note that I tried to enable the logging interceptor, but I didn't see any output from it. I have a single action that I was intending to use to handle both the ajax and non-ajax submit. I tried to make it use two different action names in the form, but it seemed to have trouble with that. I noticed in the generated HTML, I had this in the HTML for the form tag: onsubmit="return YAHOO.strutsform.submitform();; return true;" I'm not sure if that "return true;" will cause me trouble, as I'm trying to bypass the normal form submission. I think by returning false from "submitform", I achieved that, however. I'll include here the relevant files. Please comment where appropriate. Thanks for your input. ---form.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> http://www.w3.org/TR/html4/loose.dtd";> Struts Form