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

Re: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
2010/12/1 Anjib Mulepati anji...@hotmail.com: 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

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 Mulepatianji...@hotmail.com: Li When you say sending response using JSON what does that mean? I mean, send a string in JSON format as response. If your

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 Mulepatianji...@hotmail.com: Li When you say sending response using JSON what does that mean? I mean, send

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 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 Mulepatianji...@hotmail.com: Li When you say

RE: Calling Struts Action from JavaScript

2010-12-01 Thread Biesbrock, Kevin
: 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 Mulepatianji...@hotmail.com: Li

Re: Calling Struts Action from JavaScript

2010-12-01 Thread Li Ying
OR, You can send a whole HTML code of the table 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

Calling Struts Action from JavaScript

2010-11-30 Thread Anjib Mulepati
Struts 1.3.8 I have text box and button in the JSP page with the function on onCLick() event. script lanaguage=javascript function fnClickAddRow() { alert(Validating -- Inserting in Db and then add to below table); //Add row to the table } /scirpt input type=text id=email

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 anji...@hotmail.com wrote: Struts 1.3.8 I have text box and button in the JSP page with the function on onCLick()

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