FileUpload null file for large files?

2010-08-04 Thread Ozu Natsu
Hi,

I am using Struts 2.1.8.1 and have an action that allows for a large
file (20+MB) to be uploaded. I have set the Struts
struts.multipart.maxSize attribute to allow a file upload large
enough, and have also set the interceptor max file upload size as
follows in my action:

interceptor-ref name=fileUpload
   param name=maximumSize2500/param
/interceptor-ref

The action is invoked (previously I was running into the max file size
issue) but now all parameters (using paramsPrepareParamsStack in my
interceptor stack) are null, including the file attachment and all
other parameters sent by the form.

No exceptions are being thrown in the server log -- is there some
other known bug or restriction I might be running into here?

Any/All replies are much appreciated.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Modify JSON Format?

2010-06-23 Thread Ozu Natsu

Any example of how to do option #2?

--
Michael Griffith
Managing Partner, OpenPrinciple Consulting, LLC.
http://www.openprinciple.com

On Jun 23, 2010, at 12:21 AM, Rahul Mohan rahul.mo...@tcs.com wrote:


Hi,

I don't think the plugin has any option like that.  But, even if you
manage to do that how will you ensure that the order of data  
returned will

match the order
of grid columns on the client?

You have two options:
1. Use a List of List on your action class itself so that the order is
preserved.  The json plugin serialized an Iterable into a JSON array  
and a

bean to { name: value,. } structure. So you will end up having the
array of array in your JSON as well.

2. Post process the JSON data on your ajax callback function before
feeding it to the table. (You also have the order available on  
client from

the table declaration, so it should be easy. )

Regards,
Rahul Mohan




From:
Ozu Natsu ozu.na...@gmail.com
To:
Struts Users Mailing List user@struts.apache.org
Date:
22-06-2010 20:57
Subject:
Modify JSON Format?



Hi,

I am using JSON plugin to return data to JQuery DataTable, but format
is not compatible with Datatable plugin. I have a collection with a
getter function on my struts2 action that is annotated with @JSON
annotation.  The action returns an array of objects, such as:

{aaData:[,{age:2,breed:Unkown,gender:Female,id: 
2,name:Snowflake

2}, ...}

when what I really wany is an array of arrays:

aaData: [
[ 2, Unknown, Female, 2, Snowflake 2 ],
[ ...] ]

As I understand it, both forms of the notation are valid. Is there any
way to configure the plug in to modify the style/format of JSON to
render the array of arrays without hand rolling my own function to
return the data in a string?

Using struts 2.1.8.1

Thank you.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Modify JSON Format?

2010-06-22 Thread Ozu Natsu
Hi,

I am using JSON plugin to return data to JQuery DataTable, but format
is not compatible with Datatable plugin. I have a collection with a
getter function on my struts2 action that is annotated with @JSON
annotation.  The action returns an array of objects, such as:

{aaData:[,{age:2,breed:Unkown,gender:Female,id:2,name:Snowflake
2}, ...}

when what I really wany is an array of arrays:

aaData: [
[ 2, Unknown, Female, 2, Snowflake 2 ],
[ ...] ]

As I understand it, both forms of the notation are valid. Is there any
way to configure the plug in to modify the style/format of JSON to
render the array of arrays without hand rolling my own function to
return the data in a string?

Using struts 2.1.8.1

Thank you.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-05-03 Thread Ozu Natsu
The params interceptor is in the stack, I had included the basicStack
-- but also expressly included it as well to see if there was a
difference in behavior.  In FF I can see the query string of the form
elements for the request, so I am sure that they are being passed.
The paramter string looks like I would expect:
object.attribute=valueobject.attribute2=value

Where is the best way to verify that the action is getting and parsing
the parameters in the action?

On Sat, May 1, 2010 at 8:45 PM, Dale Newfield d...@newfield.org wrote:
 On 5/1/10 11:58 AM, Ozu Natsu wrote:

 I'm also puzzled why the JSONValidationInterceptor
 validationAware.hasErrors() is always returning the entire validation
 rule set.

 Is params in the interceptor stack?
 Are the arguments being passed?  (Look at the request from the client side
 with firefox.)  Are the arguments arriving at the server?  Are they being
 processed correctly?

 -Dale


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-05-03 Thread Ozu Natsu
More info...  This is getting more confusing to me by the minute.

If I use these interceptors as such in my action:

interceptor-ref name=params/
interceptor-ref name=actionMappingParams/
interceptor-ref name=staticParams/

It appears that the parameters are not being parsed correctly.  I
don't know that for sure, but I suspect that is the case because all
validation fails and all messages are returned.  The success method of
the ajax call is never fired, instead the completed method is fired
with the parseerrror as the textstatus.

If I use the basicStack and include the paramsPrepareParamsStack,
the success method of the ajax is called, and no errors are returned
-- even though there should be an error for a missing field.  If I
then supply the value to the missing field and try to revalidate, the
ajax call never fires success, instead it fires complete with a
parseerror.  In both cases with the paramsPrepareParamsStack, no
validation errors are being returned correctly.

I'm quite confused with this and would appreciate any advice or help
anyone has to offer.


On Mon, May 3, 2010 at 12:08 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 The params interceptor is in the stack, I had included the basicStack
 -- but also expressly included it as well to see if there was a
 difference in behavior.  In FF I can see the query string of the form
 elements for the request, so I am sure that they are being passed.
 The paramter string looks like I would expect:
 object.attribute=valueobject.attribute2=value

 Where is the best way to verify that the action is getting and parsing
 the parameters in the action?

 On Sat, May 1, 2010 at 8:45 PM, Dale Newfield d...@newfield.org wrote:
 On 5/1/10 11:58 AM, Ozu Natsu wrote:

 I'm also puzzled why the JSONValidationInterceptor
 validationAware.hasErrors() is always returning the entire validation
 rule set.

 Is params in the interceptor stack?
 Are the arguments being passed?  (Look at the request from the client side
 with firefox.)  Are the arguments arriving at the server?  Are they being
 processed correctly?

 -Dale



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-05-01 Thread Ozu Natsu
Anyone following this thread -- here's where I am at:

The struts JSONValidationInterceptor seems to be munching the name of
the field to be validated at line 149/150:
sb.append(validationAware instanceof ModelDriven ?
fieldError.getKey().substring(6)
: fieldError.getKey());


My Action class is ModelDriven:
public class Myclass extends AdminSupport implements
ModelDrivenMyBizObject, Preparable, UserAware {
...
}

I'm not sure why it is doing a substring(6) of the fieldError.getKey
--  but if I comment that out and use just the fieldError.getKey()
value, the JSON result gets sent back to the ajax complete callback.
 The textResult of the callback is still parseerror, but it has a
valid response that can be passed to the StrutsUtils object for
parsing.

I'm also puzzled why the JSONValidationInterceptor
validationAware.hasErrors() is always returning the entire validation
rule set.  In other words, it is not seeing fields with valid values
vs. fields with invalid values.  I'm wondering if the validation
interceptor is also not finding the fields to validate and matching
them with the validation rules because of this fieldError key
business?

Struts Experts, what happing here??  I am I describing the problem well enough?



On Fri, Apr 30, 2010 at 6:34 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Arg!

 Something else is going on. Maybe related to the parseError?  I am
 assuming the callback should be on the success function, not the
 error/complete.

 I replaced the jquery $('update')[0] reference with document.forms[0]
 and I get the exact same thing.  Moreover, it looks as if the
 errorsObect.fieldErrors has ALL my validations in it, regardless of
 whether the field had a value or not.


 On Fri, Apr 30, 2010 at 6:20 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 The problem looks as if it is in the DOM, I'm wondering if this isn't
 jquery's fault?

 All of the field names in the form.elements are somehow mangled.

 artNumber instead of partNumber


 On Fri, Apr 30, 2010 at 6:14 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Dale,

 So close! I am now to the point where I am getting the errors, but
 when I try to use the struts utilities to display them, I am getting
 an undefined object in the struts validation.js function
 addErrorXHTML(e, errorText) ;

 My code looks like this:

                complete : function(XMLHttpRequest, textStatus){
                        var form= $('#update')[0];
                        //clear previous validation errors, if any
                    StrutsUtils.clearValidationErrors(form);

                    //get errors from response
                    var text = XMLHttpRequest.responseText;
                    var errorsObject = StrutsUtils.getValidationErrors(text);

                     //show errors, if any
                    if(errorsObject.fieldErrors) {
                       StrutsUtils.showValidationErrors(form, errorsObject);
                    }
                }


 On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield d...@newfield.org wrote:
 On 4/30/10 6:50 PM, Ozu Natsu wrote:

 Anyone have any ideas?

 Debugging from the client side:  Firebug in Firefox.
 Debugging from the server side:  log messages (log4j or other).

 -Dale





-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Validate without submit?

2010-04-30 Thread Ozu Natsu
Is it possible to fire the struts 2 validation without performing a
submit?  I realize that this could be done via ajax, but I am already
committed to use another JS framework (not dojo, dwr or prototype) .
I'd like to fire the validation and get the form validation messages
back if any to be displayed on the page, as happens when the
validation is fired from a submit -- but without performing the
submit...

Possible?  Stupid question?  Can it be done with jquery?

Thank you in advance to any reply.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
I am having some problems with the call, the ajax get returns no
response, even though I know the form validation should be failing.
My ajax call looks like this:


var url= ./checkValid.do;
$.ajax({
type: GET,
cache   : false,
dataType: json,
url  url,
data: 
$(this).serialize()+'struts.enableJSONValidation=truestruts.validateOnly=true',
success: function(data, textStatus, XMLHttpRequest) {
// do something here
alert(textStatus);
}
});


My action looks like this:
  action name=checkValid class=actionclass
result type=json
param name=rootjsonData/param
/result
  /action

Am I missing something?

On Fri, Apr 30, 2010 at 1:59 PM, Cimballi cimballi.cimba...@gmail.com wrote:
 Of course it can be done with JQuery and I recommend using JSON too.
 You call the action via Ajax and you get the JSON result and display it.

 Cimballi


 On Fri, Apr 30, 2010 at 1:36 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Is it possible to fire the struts 2 validation without performing a
 submit?  I realize that this could be done via ajax, but I am already
 committed to use another JS framework (not dojo, dwr or prototype) .
 I'd like to fire the validation and get the form validation messages
 back if any to be displayed on the page, as happens when the
 validation is fired from a submit -- but without performing the
 submit...

 Possible?  Stupid question?  Can it be done with jquery?

 Thank you in advance to any reply.

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
Closer, still not working... I had 2 problems (I think).
#(this).serialize() was not serializing the form data.  I put my form
name in for the selector and now the form data is being passed to the
get. I think the other problem is that the action method doesn't match
my validator name.  My validator is set up as
Action-update-validation.xml.  So I added method =update to the
struts action definition. Now it appears to be trying to peform the
update instead of just performing the validation.

What exactly should be the chain of events happening here?  Shouldn't
it be something like the get invokes the validate() method, which
returns json data to the javascript callback where my alert is at?  I
would have suspected my callback method data to be populated with the
validation results.

On Fri, Apr 30, 2010 at 3:07 PM, Cimballi cimba...@cimballi.net wrote:
 I have something like that in the page :

 $.getJSON(...,
  function(json) {
    if (json.result == OK) {
      ...
    } else {
      ...
    }
  });

 And in the action I have this :
    public String getResult() {
        return this.result;
    }

 In my case it's a single String but I suppose you can return more
 complex objects.

 Cimballi


 On Fri, Apr 30, 2010 at 2:51 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 I am having some problems with the call, the ajax get returns no
 response, even though I know the form validation should be failing.
 My ajax call looks like this:


        var url= ./checkValid.do;
        $.ajax({
                type    : GET,
                cache   : false,
                dataType: json,
                url      url,
                data    : 
 $(this).serialize()+'struts.enableJSONValidation=truestruts.validateOnly=true',
                success: function(data, textStatus, XMLHttpRequest) {
                        // do something here
                        alert(textStatus);
                }
        });


 My action looks like this:
          action name=checkValid class=actionclass
            result type=json
                param name=rootjsonData/param
            /result
          /action

 Am I missing something?


 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
1 step closer. I had missed the reference to the interceptor
interceptor-ref name=jsonValidationWorkflowStack/ in my struts
action.

I am now getting a result back from the validator, but it doesn't seem
to be firing my callback method.  Can anyone help with this problem?

Thank you!



On Fri, Apr 30, 2010 at 3:45 PM, Cimballi cimba...@cimballi.net wrote:
 Ozu, nut sure to be able to help you more.
 I know how to call an action in Ajax, now it seems you want to
 reproduce Struts2 validation process using Ajax and this requires more
 analysis.
 What you can do at least is do the validation in you main action
 method. And even better, I think you could even specify the name of
 the method to call in your action.
 Another option is to create 2 actiosns in your configuration file
 calling the same java action, one for the real action, and the other
 for the validation.

 Cimballi


 On Fri, Apr 30, 2010 at 3:34 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Closer, still not working... I had 2 problems (I think).
 #(this).serialize() was not serializing the form data.  I put my form
 name in for the selector and now the form data is being passed to the
 get. I think the other problem is that the action method doesn't match
 my validator name.  My validator is set up as
 Action-update-validation.xml.  So I added method =update to the
 struts action definition. Now it appears to be trying to peform the
 update instead of just performing the validation.

 What exactly should be the chain of events happening here?  Shouldn't
 it be something like the get invokes the validate() method, which
 returns json data to the javascript callback where my alert is at?  I
 would have suspected my callback method data to be populated with the
 validation results.

 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
var url= ./checkValid.do;
var data= 
$('#update').serialize()+'struts.enableJSONValidation=truestruts.validateOnly=true';
$.getJSON( url, data, function(data, textStatus) {
// Do something
alert(textStatus);
});

The callback defined as function(data, textStatus){...} never gets
invoked.  Same with the call to the ajax get. I simply see the get
request in the FireFox console with the reply.

On Fri, Apr 30, 2010 at 5:05 PM, Cimballi cimba...@cimballi.net wrote:
 Did you try with the getJSON method of JQuery ?

 Cimballi


 On Fri, Apr 30, 2010 at 5:01 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 1 step closer. I had missed the reference to the interceptor
 interceptor-ref name=jsonValidationWorkflowStack/ in my struts
 action.

 I am now getting a result back from the validator, but it doesn't seem
 to be firing my callback method.  Can anyone help with this problem?

 Thank you!



 On Fri, Apr 30, 2010 at 3:45 PM, Cimballi cimba...@cimballi.net wrote:
 Ozu, nut sure to be able to help you more.
 I know how to call an action in Ajax, now it seems you want to
 reproduce Struts2 validation process using Ajax and this requires more
 analysis.
 What you can do at least is do the validation in you main action
 method. And even better, I think you could even specify the name of
 the method to call in your action.
 Another option is to create 2 actiosns in your configuration file
 calling the same java action, one for the real action, and the other
 for the validation.

 Cimballi


 On Fri, Apr 30, 2010 at 3:34 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Closer, still not working... I had 2 problems (I think).
 #(this).serialize() was not serializing the form data.  I put my form
 name in for the selector and now the form data is being passed to the
 get. I think the other problem is that the action method doesn't match
 my validator name.  My validator is set up as
 Action-update-validation.xml.  So I added method =update to the
 struts action definition. Now it appears to be trying to peform the
 update instead of just performing the validation.

 What exactly should be the chain of events happening here?  Shouldn't
 it be something like the get invokes the validate() method, which
 returns json data to the javascript callback where my alert is at?  I
 would have suspected my callback method data to be populated with the
 validation results.

 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/






 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
I've tried both json result type and what the docs use:
http://struts.apache.org/2.0.14/docs/ajax-validation.html.  No luck.

I just added an onComplete event handler and I see that i am getting
textStatus passed as parseError.???   So the success event handler is
not being called because of some error. I'm not sure how to figure out
what error it is.

Anyone have any ideas?


On Fri, Apr 30, 2010 at 5:36 PM, Cimballi cimba...@cimballi.net wrote:
 I noticed that I am not using the json interceptor, only the result :
 result-type name=json class=org.apache.struts2.json.JSONResult /

 What are you using ?

 Cimballi


 On Fri, Apr 30, 2010 at 5:16 PM, Ozu Natsu ozu.na...@gmail.com wrote:
        var url= ./checkValid.do;
        var data= 
 $('#update').serialize()+'struts.enableJSONValidation=truestruts.validateOnly=true';
        $.getJSON( url, data, function(data, textStatus) {
                // Do something
                alert(textStatus);
        });

 The callback defined as function(data, textStatus){...} never gets
 invoked.  Same with the call to the ajax get. I simply see the get
 request in the FireFox console with the reply.

 On Fri, Apr 30, 2010 at 5:05 PM, Cimballi cimba...@cimballi.net wrote:
 Did you try with the getJSON method of JQuery ?

 Cimballi


 On Fri, Apr 30, 2010 at 5:01 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 1 step closer. I had missed the reference to the interceptor
 interceptor-ref name=jsonValidationWorkflowStack/ in my struts
 action.

 I am now getting a result back from the validator, but it doesn't seem
 to be firing my callback method.  Can anyone help with this problem?

 Thank you!



 On Fri, Apr 30, 2010 at 3:45 PM, Cimballi cimba...@cimballi.net wrote:
 Ozu, nut sure to be able to help you more.
 I know how to call an action in Ajax, now it seems you want to
 reproduce Struts2 validation process using Ajax and this requires more
 analysis.
 What you can do at least is do the validation in you main action
 method. And even better, I think you could even specify the name of
 the method to call in your action.
 Another option is to create 2 actiosns in your configuration file
 calling the same java action, one for the real action, and the other
 for the validation.

 Cimballi


 On Fri, Apr 30, 2010 at 3:34 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Closer, still not working... I had 2 problems (I think).
 #(this).serialize() was not serializing the form data.  I put my form
 name in for the selector and now the form data is being passed to the
 get. I think the other problem is that the action method doesn't match
 my validator name.  My validator is set up as
 Action-update-validation.xml.  So I added method =update to the
 struts action definition. Now it appears to be trying to peform the
 update instead of just performing the validation.

 What exactly should be the chain of events happening here?  Shouldn't
 it be something like the get invokes the validate() method, which
 returns json data to the javascript callback where my alert is at?  I
 would have suspected my callback method data to be populated with the
 validation results.

 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/






 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/





 --
 Cimballi
 JAVA J2EE Freelance
 http://cimballi.elance.com/


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
Dale,

So close! I am now to the point where I am getting the errors, but
when I try to use the struts utilities to display them, I am getting
an undefined object in the struts validation.js function
addErrorXHTML(e, errorText) ;

My code looks like this:

complete : function(XMLHttpRequest, textStatus){
var form= $('#update')[0];
//clear previous validation errors, if any
StrutsUtils.clearValidationErrors(form);

//get errors from response
var text = XMLHttpRequest.responseText;
var errorsObject = StrutsUtils.getValidationErrors(text);

 //show errors, if any
if(errorsObject.fieldErrors) {
   StrutsUtils.showValidationErrors(form, errorsObject);
}
}


On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield d...@newfield.org wrote:
 On 4/30/10 6:50 PM, Ozu Natsu wrote:

 Anyone have any ideas?

 Debugging from the client side:  Firebug in Firefox.
 Debugging from the server side:  log messages (log4j or other).

 -Dale


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
The problem looks as if it is in the DOM, I'm wondering if this isn't
jquery's fault?

All of the field names in the form.elements are somehow mangled.

artNumber instead of partNumber


On Fri, Apr 30, 2010 at 6:14 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Dale,

 So close! I am now to the point where I am getting the errors, but
 when I try to use the struts utilities to display them, I am getting
 an undefined object in the struts validation.js function
 addErrorXHTML(e, errorText) ;

 My code looks like this:

                complete : function(XMLHttpRequest, textStatus){
                        var form= $('#update')[0];
                        //clear previous validation errors, if any
                    StrutsUtils.clearValidationErrors(form);

                    //get errors from response
                    var text = XMLHttpRequest.responseText;
                    var errorsObject = StrutsUtils.getValidationErrors(text);

                     //show errors, if any
                    if(errorsObject.fieldErrors) {
                       StrutsUtils.showValidationErrors(form, errorsObject);
                    }
                }


 On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield d...@newfield.org wrote:
 On 4/30/10 6:50 PM, Ozu Natsu wrote:

 Anyone have any ideas?

 Debugging from the client side:  Firebug in Firefox.
 Debugging from the server side:  log messages (log4j or other).

 -Dale



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
Arg!

Something else is going on. Maybe related to the parseError?  I am
assuming the callback should be on the success function, not the
error/complete.

I replaced the jquery $('update')[0] reference with document.forms[0]
and I get the exact same thing.  Moreover, it looks as if the
errorsObect.fieldErrors has ALL my validations in it, regardless of
whether the field had a value or not.


On Fri, Apr 30, 2010 at 6:20 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 The problem looks as if it is in the DOM, I'm wondering if this isn't
 jquery's fault?

 All of the field names in the form.elements are somehow mangled.

 artNumber instead of partNumber


 On Fri, Apr 30, 2010 at 6:14 PM, Ozu Natsu ozu.na...@gmail.com wrote:
 Dale,

 So close! I am now to the point where I am getting the errors, but
 when I try to use the struts utilities to display them, I am getting
 an undefined object in the struts validation.js function
 addErrorXHTML(e, errorText) ;

 My code looks like this:

                complete : function(XMLHttpRequest, textStatus){
                        var form= $('#update')[0];
                        //clear previous validation errors, if any
                    StrutsUtils.clearValidationErrors(form);

                    //get errors from response
                    var text = XMLHttpRequest.responseText;
                    var errorsObject = StrutsUtils.getValidationErrors(text);

                     //show errors, if any
                    if(errorsObject.fieldErrors) {
                       StrutsUtils.showValidationErrors(form, errorsObject);
                    }
                }


 On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield d...@newfield.org wrote:
 On 4/30/10 6:50 PM, Ozu Natsu wrote:

 Anyone have any ideas?

 Debugging from the client side:  Firebug in Firefox.
 Debugging from the server side:  log messages (log4j or other).

 -Dale




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: JSON Plugin Question

2010-04-27 Thread Ozu Natsu
Thanks for the reply.

I thought that the submit might be the problem. I have a regular
s:submit/ button doing the submit. I tried just using a input
type=button / with an onClick action that was something like
onclick=document.forms[0].submit();  That produced the same result.
I also tried calling the JS method that does the ajax post directly.
onclick=javascript:mySubmitFunction() where the function below is
mySubmitFunction().  In that case the JS function could not be found.
I'm not sure why this is.

It might be worth mentioning that the entire page/form is in an iframe
overlayed on a parent window?  The mySubmitFunction() is in an
included .js file that is in the file source, but not found when
invoked from the onclick of the button.  They only way I could get the
form to submit and call the JS method is by binding to the submit
action.

$(document).ready(function() {
$(#stutsFormAction).bind(submit, function() {
mySubmitFunction();
});
});

I'm pretty sure the problem is related to the submit, but not sure how
to go about debugging or fixing.

On Mon, Apr 26, 2010 at 11:50 PM, Rahul Mohan rahul.mo...@tcs.com wrote:
 Hi,

 Is your intention to show the message 'success' in the results div? In
 that case you don't need a JSON response.

 Also, is jsonData an instance variable of your action class. Otherwise,
 your json result will simply return an empty json. You can verify the
 response by opening the response in a text editor when the browser dialog
 pops-up.

 If json is what you want, I see two probable causes:
 1. The browser is also doing a normal submission - i.e after your ajax
 post, the form is also getting submitted normally. If you are using
 firefox with firebug, you can put a breakpoint on the response handler to
 see if this is the case. ( Also, put an ajax error handler and put a break
 point there too. Its easier for debugging. )

 2. The response content type is not understood by browser. This can happen
 if your response has formatting errors. For JSON response, the best
 possible way in jQuery would be http://api.jquery.com/jQuery.getJSON/

 - Rahul



 From:
 Ozu Natsu ozu.na...@gmail.com
 To:
 user@struts.apache.org
 Date:
 26-04-2010 20:02
 Subject:
 JSON Plugin Question



 Hello,

 I am trying to use the JSON plug-in for the first time. I have a form
 that uses jquery to submit to a struts2 action, the action is being
 invoked properly and I am trying to send result back to call back
 function, but when result returns the browser prompts me to save or
 open the result file.  I expeced the result to be sent to my call back
 function, which appears to not be invoked.

 I am using Stuts 2.1.8.1

 What am I doing wrong?

 My form is submitted as such:
  function submit(){

                 $.ajax({
                                 type            : POST,
                                 cache           : false,
                                 url                             :
 ./myaction.do,
                                 data            : $(this).serialize(),
                                 success: function(json) {
                                                 $(#result).html(json);
                                 }
                 });

                 return false;
            }

 My action is configured in the struts.xml:

                 package name=mypkg namespace=/def
 extends=json-default
                   action name=addNote class=..myClass
 method=addData
                     result type=json
                                 param name=rootjsonData/param
                     /result
                   /action
                 /package

 In the action/method I have a hashmap that I am putting result into:

 MapString, String jsonData= new HashMapString,String();
 jsonData.put(result, success);

 Any reply appreciated. Thanks in advance!

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain
 confidential or privileged information. If you are
 not the intended recipient, any dissemination, use,
 review, distribution, printing or copying of the
 information contained in this e-mail message
 and/or attachments to it are strictly prohibited. If
 you have received this communication in error,
 please notify us by reply e-mail or telephone and
 immediately and permanently delete the message
 and any attachments. Thank you




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



JSON Plugin Question

2010-04-26 Thread Ozu Natsu
Hello,

I am trying to use the JSON plug-in for the first time. I have a form
that uses jquery to submit to a struts2 action, the action is being
invoked properly and I am trying to send result back to call back
function, but when result returns the browser prompts me to save or
open the result file.  I expeced the result to be sent to my call back
function, which appears to not be invoked.

I am using Stuts 2.1.8.1

What am I doing wrong?

My form is submitted as such:
 function submit(){

$.ajax({
type: POST,
cache   : false,
url : ./myaction.do,
data: $(this).serialize(),
success: function(json) {
$(#result).html(json);
}
});

return false;
}

My action is configured in the struts.xml:

package name=mypkg namespace=/def extends=json-default
  action name=addNote class=..myClass method=addData
result type=json
param name=rootjsonData/param
/result
  /action
/package

In the action/method I have a hashmap that I am putting result into:

MapString, String jsonData= new HashMapString,String();
jsonData.put(result, success);

Any reply appreciated. Thanks in advance!

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org