You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JavaNoobie87 <vi...@enzentech.com> on 2011/03/21 06:16:19 UTC

Calling an action class through Javascript -Struts 2.

Hi All ,
I'm trying to call an action class , On change of the values in a dropdown
box in my jsp .I also have to pass a value to the action class to execute
the method . Im trying to implement it only using Javascript as part of our
project requirements , and so using AJAX with JSON , dwr etc is ruled out .
If anyone could provide pointers of its implementation using Javascript it
would be great.

--
View this message in context: http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-Javascript-Struts-2-tp4183166p4183166.html
Sent from the Struts - User mailing list archive at Nabble.com.

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


Re: Calling an action class through Javascript -Struts 2.

Posted by Dave Newton <da...@gmail.com>.
On Mon, Mar 21, 2011 at 9:31 AM, adam pinder wrote:
> you can use AJAX functionality straight from plain old javascript without using DOJO
> or other javascript libraries - its just those libs make it easier.

Make it easier to the point of it being a Really Bad Idea to do it
*without* them.

Use one.

Dave

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


RE: Calling an action class through Javascript -Struts 2.

Posted by adam pinder <ap...@hotmail.co.uk>.
 
 
if you don't use AJAX then you can only do the standard get/post based on form submission which is a synchronous call.
 
you can use AJAX functionality straight from plain old javascript without using DOJO or other javascript libraries - its just those libs make it easier.
 
adam

 
> Date: Sun, 20 Mar 2011 22:16:19 -0700
> From: vivek.mv@enzentech.com
> To: user@struts.apache.org
> Subject: Calling an action class through Javascript -Struts 2.
> 
> Hi All ,
> I'm trying to call an action class , On change of the values in a dropdown
> box in my jsp .I also have to pass a value to the action class to execute
> the method . Im trying to implement it only using Javascript as part of our
> project requirements , and so using AJAX with JSON , dwr etc is ruled out .
> If anyone could provide pointers of its implementation using Javascript it
> would be great.
> 
> --
> View this message in context: http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-Javascript-Struts-2-tp4183166p4183166.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

RE: Calling an action class through Javascript -Struts 2.

Posted by "CRANFORD, CHRIS" <Ch...@setech.com>.
I would highly recommend AJAX/JSON/jQuery, they are Javascript.

Question - 

Does your requirement state that the data should be server-call back
delay delivered?
Does your requirement expect the data to be pre-rendered and the DOM
updated real-time?

Either way, I would use jQuery to perform either of the tasks.  In the
case of the first, I would have jQuery do an AJAX call back to the
server, and upon success, iterate the JSON result and update the DOM
accordingly.  In the case of the later, I'd embed the data in hidden
DIVs and then upon the change event, I'd use jQuery to iterate over my
hidden DIVs and retrieve the embedded data and then update the DOM
similarly to that of the AJAX call.

> -----Original Message-----
> From: JavaNoobie87 [mailto:vivek.mv@enzentech.com]
> Sent: Monday, March 21, 2011 12:16 AM
> To: user@struts.apache.org
> Subject: Calling an action class through Javascript -Struts 2.
> 
> Hi All ,
> I'm trying to call an action class , On change of the values in a
> dropdown
> box in my jsp .I also have to pass a value to the action class to
> execute
> the method . Im trying to implement it only using Javascript as part
of
> our
> project requirements , and so using AJAX with JSON , dwr etc is ruled
> out .
> If anyone could provide pointers of its implementation using
Javascript
> it
> would be great.
> 
> --
> View this message in context:
> http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-
> Javascript-Struts-2-tp4183166p4183166.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



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


Re: Calling an action class through Javascript -Struts 2.

Posted by APE SHOW <la...@gmail.com>.
we just use js ajax request the json data from struts2 action. you can
find a jsonlib from json.org, written by java,it's quite easy... good
luck


mead.ipod

On 2011-3-21, at 13:16, JavaNoobie87 <vi...@enzentech.com> wrote:

> Hi All ,
> I'm trying to call an action class , On change of the values in a dropdown
> box in my jsp .I also have to pass a value to the action class to execute
> the method . Im trying to implement it only using Javascript as part of our
> project requirements , and so using AJAX with JSON , dwr etc is ruled out .
> If anyone could provide pointers of its implementation using Javascript it
> would be great.
>
> --
> View this message in context: http://struts.1045723.n5.nabble.com/Calling-an-action-class-through-Javascript-Struts-2-tp4183166p4183166.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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


Re: Calling an action class through Javascript -Struts 2.

Posted by Dave Newton <da...@gmail.com>.
On Mon, Mar 21, 2011 at 1:16 AM, JavaNoobie87 wrote:
> Im trying to implement it only using Javascript as part of our project
> requirements , and so using AJAX with JSON , dwr etc is ruled out.

Both Ajax and JSON are JavaScript.

Dave

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