Re: Struts2 with AJAX

2007-09-08 Thread Nuwan Chandrasoma

Hi,

In your action class you have to return null after you write the 
response for eg:-


 public String ajax() throws Exception {

 respone.getWriter().println("hello");

 respone.getWriter().close();

 return null;

 }

and also i dont think you need to specify the full URL when you are 
doing the ajax call.,


Thanks,

Nuwan


animesh saxena wrote:

Hi,
   I am using a very basic AJAX code snippet with struts. No it's not
dojo. 


req = new XMLHttpRequest();
var url='http://localhost:8084/StrutsAjax/example/SearchAJAX.action';
req.open("POST",url,true);
req.onreadystatechange=searchResults;
req.send(null);   


in searchResults() function I just wnt to see req.responseText;

If I want to return some response from server side if I use something
crude like this

response.getOutputStream().print("Animesh");

It messes up struts and I get lots of exceptions in responseText.

I want to return some string from the server side which is accessible by
javascript code. It can be JSON or anything.

What should be the code on server side / my action class (execute
method) to return something to client side? Any suggestions??



Thanks,

Animesh


-
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]



Struts2 with AJAX

2007-09-08 Thread animesh saxena
Hi,
   I am using a very basic AJAX code snippet with struts. No it's not
dojo. 

req = new XMLHttpRequest();
var url='http://localhost:8084/StrutsAjax/example/SearchAJAX.action';
req.open("POST",url,true);
req.onreadystatechange=searchResults;
req.send(null);   

in searchResults() function I just wnt to see req.responseText;

If I want to return some response from server side if I use something
crude like this

response.getOutputStream().print("Animesh");

It messes up struts and I get lots of exceptions in responseText.

I want to return some string from the server side which is accessible by
javascript code. It can be JSON or anything.

What should be the code on server side / my action class (execute
method) to return something to client side? Any suggestions??



Thanks,

Animesh


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 with AJAX file upload??

2006-12-16 Thread Don Brown

No, I don't see why you would need to.  If your page is creating the
proper multipart request, Struts should be able to handle it as long
as the target action uses an interceptor stack that contains the file
upload interceptor.

Don

On 12/15/06, Nagraj Rao <[EMAIL PROTECTED]> wrote:

well i had this tag in my struts-config.xml after all the acion mappings


Do i need to override the fileupload interceptor in this case??

- Original Message -
From: "Don Brown" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Saturday, December 16, 2006 12:22 AM
Subject: Re: Struts2 with AJAX file upload??


> What do you mean by trying to find controller tags in struts.xml?  How
> do you have it implemented in Struts 1?
>
> Don
>
> On 12/15/06, Nagraj Rao <[EMAIL PROTECTED]> wrote:
>> Hi guys
>>
>> I want to implement AJAX file upload in Struts2. tried searching over on
>> the net, but couldn't find much. I have an AJAX based file uploader
>> working in Struts1.x but i'm not able to migrate it to Struts2 due to
>> some uncommon controller mappings (such as i'm not finding any conroller
>> tags to be placed inside my struts.xml).
>>
>> Needed some pointers for the same. Please help. Any suggestions will be
>> appreciated.
>>
>> regards,
>> Nagraj
>>
>
> -
> 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: Struts2 with AJAX file upload??

2006-12-15 Thread Nagraj Rao

well i had this tag in my struts-config.xml after all the acion mappings
multipartClass="net.kencochrane.upload.ExtendedMultiPartRequestHandler" />


Do i need to override the fileupload interceptor in this case??

- Original Message - 
From: "Don Brown" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Saturday, December 16, 2006 12:22 AM
Subject: Re: Struts2 with AJAX file upload??



What do you mean by trying to find controller tags in struts.xml?  How
do you have it implemented in Struts 1?

Don

On 12/15/06, Nagraj Rao <[EMAIL PROTECTED]> wrote:

Hi guys

I want to implement AJAX file upload in Struts2. tried searching over on 
the net, but couldn't find much. I have an AJAX based file uploader 
working in Struts1.x but i'm not able to migrate it to Struts2 due to 
some uncommon controller mappings (such as i'm not finding any conroller 
tags to be placed inside my struts.xml).


Needed some pointers for the same. Please help. Any suggestions will be 
appreciated.


regards,
Nagraj



-
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: Struts2 with AJAX file upload??

2006-12-15 Thread Don Brown

What do you mean by trying to find controller tags in struts.xml?  How
do you have it implemented in Struts 1?

Don

On 12/15/06, Nagraj Rao <[EMAIL PROTECTED]> wrote:

Hi guys

I want to implement AJAX file upload in Struts2. tried searching over on the 
net, but couldn't find much. I have an AJAX based file uploader working in 
Struts1.x but i'm not able to migrate it to Struts2 due to some uncommon 
controller mappings (such as i'm not finding any conroller tags to be placed 
inside my struts.xml).

Needed some pointers for the same. Please help. Any suggestions will be 
appreciated.

regards,
Nagraj



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts2 with AJAX file upload??

2006-12-15 Thread Nagraj Rao
Hi guys

I want to implement AJAX file upload in Struts2. tried searching over on the 
net, but couldn't find much. I have an AJAX based file uploader working in 
Struts1.x but i'm not able to migrate it to Struts2 due to some uncommon 
controller mappings (such as i'm not finding any conroller tags to be placed 
inside my struts.xml). 

Needed some pointers for the same. Please help. Any suggestions will be 
appreciated.

regards,
Nagraj