Re: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
OR, You can send a whole HTML code of the as response. In this case, your server side view will be simple, just like any normal JSP. The client side will receive the HTML code, and you can insert this HTML piece into your page. But it will be difficult to manipulate, because what you get is not

RE: Calling Struts Action from JavaScript

2010-12-01 Thread Biesbrock, Kevin
how I'd do it. Hope that helps! Beez -Original Message- From: Anjib Mulepati [mailto:anji...@hotmail.com] Sent: Wednesday, December 01, 2010 1:56 PM To: Struts Users Mailing List Subject: Re: Calling Struts Action from JavaScript Ok JSON seems to be easy way to represent the complex result.

Re: Calling Struts Action from JavaScript

2010-12-01 Thread Anjib Mulepati
: Wednesday, December 01, 2010 10:24 AM To: Struts Users Mailing List Subject: Re: Calling Struts Action from JavaScript Can you please write me simple example of this JSON? I have never used this. Anjib On 12/1/2010 10:13 AM, Li Ying wrote: 2010/12/1 Anjib Mulepati: Li When you say sending response

Re: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
I recommend JSON when you need exchange complex data strut between client and server. Because it is very friendly to JavaScript, so you can easily handle complex data strut in your client side JavaScript code. Sample for JSON can be find in the web site Biesbrock has told you. The idea of JSON is

RE: Calling Struts Action from JavaScript

2010-12-01 Thread Biesbrock, Kevin
Subject: Re: Calling Struts Action from JavaScript Can you please write me simple example of this JSON? I have never used this. Anjib On 12/1/2010 10:13 AM, Li Ying wrote: > 2010/12/1 Anjib Mulepati: >> Li >> When you say sending response using JSON what does that mean? > > I m

Re: Calling Struts Action from JavaScript

2010-12-01 Thread Anjib Mulepati
Can you please write me simple example of this JSON? I have never used this. Anjib On 12/1/2010 10:13 AM, Li Ying wrote: 2010/12/1 Anjib Mulepati: Li When you say sending response using JSON what does that mean? I mean, send a string in JSON format as response. If your response is simple, fo

Re: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
2010/12/1 Anjib Mulepati : > Li > When you say sending response using JSON what does that mean? I mean, send a string in JSON format as response. If your response is simple, for example, just a "OK" or "ERROR" flag, you can use plain text. But when you need send a complex data strut back to cli

Re: Calling Struts Action from JavaScript

2010-12-01 Thread Anjib Mulepati
Li When you say sending response using JSON what does that mean? I have been sending result between view and action class by putting in request object as request.setAttribute("result",resultFrom); and request.getAttribute("result") What can be better approach than this? Thanks Anjib On 11/

Re: Calling Struts Action from JavaScript

2010-11-30 Thread Li Ying
Chris is right. On the client side, there is not such a concept of "Struts Action".There is Server Side Resource only. You have to access(post or get) it by URL, param, and you must handle the response from the server side. Code should looks like: (1)Client side JavaScript Send a request to Se

Re: Calling Struts Action from JavaScript

2010-11-30 Thread Chris Pratt
Either use ajax or submit the page request, there's no other good way to access a server side resource from the client side. (*chris*) On Nov 30, 2010 1:15 PM, "Anjib Mulepati" wrote: > Struts 1.3.8 > > I have text box and button in the JSP page with the function on > onCLick() event. >