Author Login
Post Reply
user Digest 18 Dec 2009 06:38:55 -0000 Issue 8964
Topics (messages 204323 through 204339):
Re: JavaScript / AJAX + Struts 2?
204323 by: Brian Thompson
204324 by: john feng
204325 by: Johannes Geppert
204326 by: Pawe³ Wielgus
204327 by: Pawe³ Wielgus
204328 by: Brian Thompson
204330 by: Pawe³ Wielgus
204331 by: Brian Thompson
204338 by: dusty
204339 by: Brian Thompson
Re: [Struts 2.1.8] Dojo with Tiles: works or not ?
204329 by: Struts Two
Test fails when building XWork
204332 by: Gabriel Belingueres
204335 by: Lukasz Lenart
204336 by: Gabriel Belingueres
Re: Problem with Date fields in struts2.1.8.1
204333 by: Parm Lehal
204334 by: Greg Lindholm
S Mike Pradaxay/0A/Caterpillar is out of the office.
204337 by: S Mike Pradaxay
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_204323.ezm (zipped)Bwuh? Just because your fridge doesn't have a built-in toaster, it's
worthless?
Struts is helpful for stuff you'd want to do on the server side.
An easy way to make stuff from the value stack available in javascript is to
do this in the jsp:
<script type="text/javascript">
var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
var bar = '<s:property value="%{bar}"/>'; //string
var bat = '<s:property value="%{foo.bat}"/>'; //string retrieved by
foo.getBat()
//javascript logic goes here
</script>
Hope that helps,
-Brian
On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings <jlistnews@(protected):
> So it's impossible? JavaScript and Struts 2 don't interact at all?
> What good is Struts 2 then?
>
> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>:
> > Hi Jim,
> > action is on server side and javascript is on browser side,
> > they don't interact, You can generate js server side but that's it.
> > Js will be run in browser so it has no access to stack or action
> variables.
> >
> > Best greetings,
> > Paweł Wielgus.
> >
> >
> >
> > 2009/12/17 Jim Collings <jlistnews@(protected)>:
> >> So I have two actions and one jsp. The idea is that one is for the
> >> entire page and another is for putting into a <div> via a JavaScript
> >> method.
> >>
> >> Question: How do I get items off of the value stack for use in
> JavaScript?
> >>
> >>
> >> Jim C.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204324.ezm (zipped)You can use the action to get data from server to display in the <div> thru JS.
e.g., in your jsp, user selects a dropdown element of country name,
then it will get the state/province names data to be displayed in the
<div>. You can invoke an action for the dropdown value-change event to
get the data back (such as return null in the action) , then you can
use ajax object api to catch the data for JS to display into <div>.
This is hand coding it. If you use an ajax enabled tag framework, you
don't need to code to this details -of course you may have to set
properties instead.
John Feng
On Thu, Dec 17, 2009 at 5:11 AM, Jim Collings <jlistnews@(protected):
> So I have two actions and one jsp. The idea is that one is for the
> entire page and another is for putting into a <div> via a JavaScript
> method.
>
> Question: How do I get items off of the value stack for use in JavaScript?
>
>
> Jim C.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204325.ezm (zipped)
Hello Jim,
if you like to use AJAX with struts2 take a look at the
build in dojo plugin or to one of the other (jquery, yui) plugins
you can found in the Plugin Registry.
http://cwiki.apache.org/S2PLUGINS/home.html
Best Regards
Johannes Geppert
jcllings wrote:
>
> So I have two actions and one jsp. The idea is that one is for the
> entire page and another is for putting into a <div> via a JavaScript
> method.
>
> Question: How do I get items off of the value stack for use in
> JavaScript?
>
>
> Jim C.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
-----
---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_204326.ezm (zipped)Hi James,
the code You have shown is generating java script on server side,
and then on browser side you run it in browser.
For example You can't do this:
var myList = '<s:property value="zipCodes"/>';
myList.toUpperCase();
and expect that on server side inside action, zipCodes variable is
updated with new uppereCased value.
Also there is nothing bad in generating js on server side,
i do it all the time. It's just worth knowing that server != browser
in terms of execution space.
Best greetings,
Paweł Wielgus.
2009/12/17 james billa <jambilla@(protected)>:
> Pawel,
>
> I am doing something like shown below and it works good for me. Isn't it
> calling the values from model/stack value from java script? zipCodes is in
> my model. Please tell me ur option. that would help me underst it better. I
> am using struts 2.1.6. Thanks.
>
> function showmylist() {
> var myList = '<s:property value="zipCodes"/>';
> var seletedzipcodelist = new Array();
> seletedzipcodelist = myList.split(",");
> if (seletedzipcodelist != null && seletedzipcodelist != "") {
> for (i in seletedzipcodelist) {
> document.getElementById(seletedzipcodelist[i]).className = "showzip";
> }
> }
> document.getElementById("something").value = '<s:property
> value="NewDate"/>';
> }
>
>
>
> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>
>
>> Hi Jim,
>> action is on server side and javascript is on browser side,
>> they don't interact, You can generate js server side but that's it.
>> Js will be run in browser so it has no access to stack or action variables.
>>
>> Best greetings,
>> Paweł Wielgus.
>>
>>
>>
>> 2009/12/17 Jim Collings <jlistnews@(protected)>:
>> > So I have two actions and one jsp. The idea is that one is for the
>> > entire page and another is for putting into a <div> via a JavaScript
>> > method.
>> >
>> > Question: How do I get items off of the value stack for use in
>> JavaScript?
>> >
>> >
>> > Jim C.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@(protected)
>> > For additional commands, e-mail: user-help@(protected)
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>

Attachment:
user_204327.ezm (zipped)Hi Brian,
have You tried running this code?
i have a doubt about:
foo.getBat() line.
As far as i know it will not work.
Also line:
var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
will not work too.
Best greetings,
Paweł Wielgus.
2009/12/17 Brian Thompson <elephantium@(protected)>:
> Bwuh? Just because your fridge doesn't have a built-in toaster, it's
> worthless?
>
> Struts is helpful for stuff you'd want to do on the server side.
>
> An easy way to make stuff from the value stack available in javascript is to
> do this in the jsp:
>
> <script type="text/javascript">
>
> var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
> var bar = '<s:property value="%{bar}"/>'; //string
> var bat = '<s:property value="%{foo.bat}"/>'; //string retrieved by
> foo.getBat()
>
> //javascript logic goes here
>
> </script>
>
> Hope that helps,
>
> -Brian
>
> On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings <jlistnews@(protected):
>
>> So it's impossible? JavaScript and Struts 2 don't interact at all?
>> What good is Struts 2 then?
>>
>> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>:
>> > Hi Jim,
>> > action is on server side and javascript is on browser side,
>> > they don't interact, You can generate js server side but that's it.
>> > Js will be run in browser so it has no access to stack or action
>> variables.
>> >
>> > Best greetings,
>> > Paweł Wielgus.
>> >
>> >
>> >
>> > 2009/12/17 Jim Collings <jlistnews@(protected)>:
>> >> So I have two actions and one jsp. The idea is that one is for the
>> >> entire page and another is for putting into a <div> via a JavaScript
>> >> method.
>> >>
>> >> Question: How do I get items off of the value stack for use in
>> JavaScript?
>> >>
>> >>
>> >> Jim C.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> For additional commands, e-mail: user-help@(protected)
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@(protected)
>> > For additional commands, e-mail: user-help@(protected)
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>

Attachment:
user_204328.ezm (zipped)TBH, I just wrote it as a quick "off the top of my head" example. The basic
structure is sound, though -- I did that sort of thing all the time in my
struts project earlier this year. What do you think is wrong with it?
n.b. "foo.getBat()" does not belong on its own line - it's part of the
"//string retrieved..." comment.
-Brian
2009/12/17 Paweł Wielgus <poulwiel@(protected)>
> Hi Brian,
> have You tried running this code?
> i have a doubt about:
> foo.getBat() line.
> As far as i know it will not work.
>
> Also line:
> var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
> will not work too.
>
> Best greetings,
> Paweł Wielgus.
>
>
> 2009/12/17 Brian Thompson <elephantium@(protected)>:
> > Bwuh? Just because your fridge doesn't have a built-in toaster, it's
> > worthless?
> >
> > Struts is helpful for stuff you'd want to do on the server side.
> >
> > An easy way to make stuff from the value stack available in javascript is
> to
> > do this in the jsp:
> >
> > <script type="text/javascript">
> >
> > var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
> > var bar = '<s:property value="%{bar}"/>'; //string
> > var bat = '<s:property value="%{foo.bat}"/>'; //string retrieved by
> > foo.getBat()
> >
> > //javascript logic goes here
> >
> > </script>
> >
> > Hope that helps,
> >
> > -Brian
> >
> > On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings <jlistnews@(protected)>
> wrote:
> >
> >> So it's impossible? JavaScript and Struts 2 don't interact at all?
> >> What good is Struts 2 then?
> >>
> >> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>:
> >> > Hi Jim,
> >> > action is on server side and javascript is on browser side,
> >> > they don't interact, You can generate js server side but that's it.
> >> > Js will be run in browser so it has no access to stack or action
> >> variables.
> >> >
> >> > Best greetings,
> >> > Paweł Wielgus.
> >> >
> >> >
> >> >
> >> > 2009/12/17 Jim Collings <jlistnews@(protected)>:
> >> >> So I have two actions and one jsp. The idea is that one is for the
> >> >> entire page and another is for putting into a <div> via a JavaScript
> >> >> method.
> >> >>
> >> >> Question: How do I get items off of the value stack for use in
> >> JavaScript?
> >> >>
> >> >>
> >> >> Jim C.
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> For additional commands, e-mail: user-help@(protected)
> >> >>
> >> >>
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> > For additional commands, e-mail: user-help@(protected)
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204330.ezm (zipped)Hi Brian,
i din't notice that it is a continuation of comment, so You are wright.
As for first assignement, there are no ' or " chars around scriptlet
so it will not work because most probably there is no variable named
as the foo's toString value.
Second and third assignement has them an will work.
Best greetings,
Pawel Wielgus.
2009/12/17, Brian Thompson <elephantium@(protected)>:
> TBH, I just wrote it as a quick "off the top of my head" example. The basic
> structure is sound, though -- I did that sort of thing all the time in my
> struts project earlier this year. What do you think is wrong with it?
>
> n.b. "foo.getBat()" does not belong on its own line - it's part of the
> "//string retrieved..." comment.
>
> -Brian
>
>
>
> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>
>
>> Hi Brian,
>> have You tried running this code?
>> i have a doubt about:
>> foo.getBat() line.
>> As far as i know it will not work.
>>
>> Also line:
>> var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
>> will not work too.
>>
>> Best greetings,
>> Paweł Wielgus.
>>
>>
>> 2009/12/17 Brian Thompson <elephantium@(protected)>:
>> > Bwuh? Just because your fridge doesn't have a built-in toaster, it's
>> > worthless?
>> >
>> > Struts is helpful for stuff you'd want to do on the server side.
>> >
>> > An easy way to make stuff from the value stack available in javascript
>> > is
>> to
>> > do this in the jsp:
>> >
>> > <script type="text/javascript">
>> >
>> > var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
>> > var bar = '<s:property value="%{bar}"/>'; //string
>> > var bat = '<s:property value="%{foo.bat}"/>'; //string retrieved by
>> > foo.getBat()
>> >
>> > //javascript logic goes here
>> >
>> > </script>
>> >
>> > Hope that helps,
>> >
>> > -Brian
>> >
>> > On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings <jlistnews@(protected)>
>> wrote:
>> >
>> >> So it's impossible? JavaScript and Struts 2 don't interact at all?
>> >> What good is Struts 2 then?
>> >>
>> >> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>:
>> >> > Hi Jim,
>> >> > action is on server side and javascript is on browser side,
>> >> > they don't interact, You can generate js server side but that's it.
>> >> > Js will be run in browser so it has no access to stack or action
>> >> variables.
>> >> >
>> >> > Best greetings,
>> >> > Paweł Wielgus.
>> >> >
>> >> >
>> >> >
>> >> > 2009/12/17 Jim Collings <jlistnews@(protected)>:
>> >> >> So I have two actions and one jsp. The idea is that one is for the
>> >> >> entire page and another is for putting into a <div> via a JavaScript
>> >> >> method.
>> >> >>
>> >> >> Question: How do I get items off of the value stack for use in
>> >> JavaScript?
>> >> >>
>> >> >>
>> >> >> Jim C.
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> >> For additional commands, e-mail: user-help@(protected)
>> >> >>
>> >> >>
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> > For additional commands, e-mail: user-help@(protected)
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> For additional commands, e-mail: user-help@(protected)
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>

Attachment:
user_204331.ezm (zipped)In context of the other two examples, you're right; I should have used
something like
var foo = <s:property value="%{foo.foobar}"/>; //int, boolean, etc.
instead to be more clear. The lack of quotes was deliberate, though ... you
wouldn't want to quote a numeric value when you're setting it up that way.
-Brian
2009/12/17 Paweł Wielgus <poulwiel@(protected)>
> Hi Brian,
> i din't notice that it is a continuation of comment, so You are wright.
> As for first assignement, there are no ' or " chars around scriptlet
> so it will not work because most probably there is no variable named
> as the foo's toString value.
> Second and third assignement has them an will work.
>
> Best greetings,
> Pawel Wielgus.
>
> 2009/12/17, Brian Thompson <elephantium@(protected)>:
> > TBH, I just wrote it as a quick "off the top of my head" example. The
> basic
> > structure is sound, though -- I did that sort of thing all the time in my
> > struts project earlier this year. What do you think is wrong with it?
> >
> > n.b. "foo.getBat()" does not belong on its own line - it's part of the
> > "//string retrieved..." comment.
> >
> > -Brian
> >
> >
> >
> > 2009/12/17 Paweł Wielgus <poulwiel@(protected)>
> >
> >> Hi Brian,
> >> have You tried running this code?
> >> i have a doubt about:
> >> foo.getBat() line.
> >> As far as i know it will not work.
> >>
> >> Also line:
> >> var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
> >> will not work too.
> >>
> >> Best greetings,
> >> Paweł Wielgus.
> >>
> >>
> >> 2009/12/17 Brian Thompson <elephantium@(protected)>:
> >> > Bwuh? Just because your fridge doesn't have a built-in toaster, it's
> >> > worthless?
> >> >
> >> > Struts is helpful for stuff you'd want to do on the server side.
> >> >
> >> > An easy way to make stuff from the value stack available in javascript
> >> > is
> >> to
> >> > do this in the jsp:
> >> >
> >> > <script type="text/javascript">
> >> >
> >> > var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
> >> > var bar = '<s:property value="%{bar}"/>'; //string
> >> > var bat = '<s:property value="%{foo.bat}"/>'; //string retrieved by
> >> > foo.getBat()
> >> >
> >> > //javascript logic goes here
> >> >
> >> > </script>
> >> >
> >> > Hope that helps,
> >> >
> >> > -Brian
> >> >
> >> > On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings <jlistnews@(protected)>
> >> wrote:
> >> >
> >> >> So it's impossible? JavaScript and Struts 2 don't interact at all?
> >> >> What good is Struts 2 then?
> >> >>
> >> >> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>:
> >> >> > Hi Jim,
> >> >> > action is on server side and javascript is on browser side,
> >> >> > they don't interact, You can generate js server side but that's it.
> >> >> > Js will be run in browser so it has no access to stack or action
> >> >> variables.
> >> >> >
> >> >> > Best greetings,
> >> >> > Paweł Wielgus.
> >> >> >
> >> >> >
> >> >> >
> >> >> > 2009/12/17 Jim Collings <jlistnews@(protected)>:
> >> >> >> So I have two actions and one jsp. The idea is that one is for
> the
> >> >> >> entire page and another is for putting into a <div> via a
> JavaScript
> >> >> >> method.
> >> >> >>
> >> >> >> Question: How do I get items off of the value stack for use in
> >> >> JavaScript?
> >> >> >>
> >> >> >>
> >> >> >> Jim C.
> >> >> >>
> >> >> >>
> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> >> For additional commands, e-mail: user-help@(protected)
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> > For additional commands, e-mail: user-help@(protected)
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> For additional commands, e-mail: user-help@(protected)
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204338.ezm (zipped)
I like how code is declared #fail because there probably is not a toString
method. lawl. Please do not be distracted....Brian's code was a perfectly
good example.
Brian Thompson-5 wrote:
>
> In context of the other two examples, you're right; I should have used
> something like
>
> var foo = <s:property value="%{foo.foobar}"/>; //int, boolean, etc.
>
> instead to be more clear. The lack of quotes was deliberate, though ...
> you
> wouldn't want to quote a numeric value when you're setting it up that way.
>
> -Brian
>
>
>
> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>
>
>> Hi Brian,
>> i din't notice that it is a continuation of comment, so You are wright.
>> As for first assignement, there are no ' or " chars around scriptlet
>> so it will not work because most probably there is no variable named
>> as the foo's toString value.
>> Second and third assignement has them an will work.
>>
>> Best greetings,
>> Pawel Wielgus.
>>
>> 2009/12/17, Brian Thompson <elephantium@(protected)>:
>> > TBH, I just wrote it as a quick "off the top of my head" example. The
>> basic
>> > structure is sound, though -- I did that sort of thing all the time in
>> my
>> > struts project earlier this year. What do you think is wrong with it?
>> >
>> > n.b. "foo.getBat()" does not belong on its own line - it's part of the
>> > "//string retrieved..." comment.
>> >
>> > -Brian
>> >
>> >
>> >
>> > 2009/12/17 Paweł Wielgus <poulwiel@(protected)>
>> >
>> >> Hi Brian,
>> >> have You tried running this code?
>> >> i have a doubt about:
>> >> foo.getBat() line.
>> >> As far as i know it will not work.
>> >>
>> >> Also line:
>> >> var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
>> >> will not work too.
>> >>
>> >> Best greetings,
>> >> Paweł Wielgus.
>> >>
>> >>
>> >> 2009/12/17 Brian Thompson <elephantium@(protected)>:
>> >> > Bwuh? Just because your fridge doesn't have a built-in toaster,
>> it's
>> >> > worthless?
>> >> >
>> >> > Struts is helpful for stuff you'd want to do on the server side.
>> >> >
>> >> > An easy way to make stuff from the value stack available in
>> javascript
>> >> > is
>> >> to
>> >> > do this in the jsp:
>> >> >
>> >> > <script type="text/javascript">
>> >> >
>> >> > var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
>> >> > var bar = '<s:property value="%{bar}"/>'; //string
>> >> > var bat = '<s:property value="%{foo.bat}"/>'; //string retrieved by
>> >> > foo.getBat()
>> >> >
>> >> > //javascript logic goes here
>> >> >
>> >> > </script>
>> >> >
>> >> > Hope that helps,
>> >> >
>> >> > -Brian
>> >> >
>> >> > On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings <jlistnews@(protected)>
>> >> wrote:
>> >> >
>> >> >> So it's impossible? JavaScript and Struts 2 don't interact at all?
>> >> >> What good is Struts 2 then?
>> >> >>
>> >> >> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>:
>> >> >> > Hi Jim,
>> >> >> > action is on server side and javascript is on browser side,
>> >> >> > they don't interact, You can generate js server side but that's
>> it.
>> >> >> > Js will be run in browser so it has no access to stack or action
>> >> >> variables.
>> >> >> >
>> >> >> > Best greetings,
>> >> >> > Paweł Wielgus.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > 2009/12/17 Jim Collings <jlistnews@(protected)>:
>> >> >> >> So I have two actions and one jsp. The idea is that one is for
>> the
>> >> >> >> entire page and another is for putting into a <div> via a
>> JavaScript
>> >> >> >> method.
>> >> >> >>
>> >> >> >> Question: How do I get items off of the value stack for use in
>> >> >> JavaScript?
>> >> >> >>
>> >> >> >>
>> >> >> >> Jim C.
>> >> >> >>
>> >> >> >>
>> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> >> >> For additional commands, e-mail: user-help@(protected)
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> >> > For additional commands, e-mail: user-help@(protected)
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> >> For additional commands, e-mail: user-help@(protected)
>> >> >>
>> >> >>
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> >> For additional commands, e-mail: user-help@(protected)
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_204339.ezm (zipped)Thanks :)
Oh, and to the OP ... my (somewhat sloppy) pseudocode is only one way to do
it. You could also set up Ajax calls to get data in JSON format from the
server. It's simpler to start out by writing javascript values for whatever
you need from the value stack, though.
-Brian
On Thu, Dec 17, 2009 at 10:05 PM, dusty <dustin_pearce@(protected):
>
> I like how code is declared #fail because there probably is not a toString
> method. lawl. Please do not be distracted....Brian's code was a
> perfectly
> good example.
>
>
>
> Brian Thompson-5 wrote:
> >
> > In context of the other two examples, you're right; I should have used
> > something like
> >
> > var foo = <s:property value="%{foo.foobar}"/>; //int, boolean, etc.
> >
> > instead to be more clear. The lack of quotes was deliberate, though ...
> > you
> > wouldn't want to quote a numeric value when you're setting it up that
> way.
> >
> > -Brian
> >
> >
> >
> > 2009/12/17 Paweł Wielgus <poulwiel@(protected)>
> >
> >> Hi Brian,
> >> i din't notice that it is a continuation of comment, so You are wright.
> >> As for first assignement, there are no ' or " chars around scriptlet
> >> so it will not work because most probably there is no variable named
> >> as the foo's toString value.
> >> Second and third assignement has them an will work.
> >>
> >> Best greetings,
> >> Pawel Wielgus.
> >>
> >> 2009/12/17, Brian Thompson <elephantium@(protected)>:
> >> > TBH, I just wrote it as a quick "off the top of my head" example. The
> >> basic
> >> > structure is sound, though -- I did that sort of thing all the time in
> >> my
> >> > struts project earlier this year. What do you think is wrong with it?
> >> >
> >> > n.b. "foo.getBat()" does not belong on its own line - it's part of the
> >> > "//string retrieved..." comment.
> >> >
> >> > -Brian
> >> >
> >> >
> >> >
> >> > 2009/12/17 Paweł Wielgus <poulwiel@(protected)>
> >> >
> >> >> Hi Brian,
> >> >> have You tried running this code?
> >> >> i have a doubt about:
> >> >> foo.getBat() line.
> >> >> As far as i know it will not work.
> >> >>
> >> >> Also line:
> >> >> var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
> >> >> will not work too.
> >> >>
> >> >> Best greetings,
> >> >> Paweł Wielgus.
> >> >>
> >> >>
> >> >> 2009/12/17 Brian Thompson <elephantium@(protected)>:
> >> >> > Bwuh? Just because your fridge doesn't have a built-in toaster,
> >> it's
> >> >> > worthless?
> >> >> >
> >> >> > Struts is helpful for stuff you'd want to do on the server side.
> >> >> >
> >> >> > An easy way to make stuff from the value stack available in
> >> javascript
> >> >> > is
> >> >> to
> >> >> > do this in the jsp:
> >> >> >
> >> >> > <script type="text/javascript">
> >> >> >
> >> >> > var foo = <s:property value="%{foo}"/>; //int, boolean, etc.
> >> >> > var bar = '<s:property value="%{bar}"/>'; //string
> >> >> > var bat = '<s:property value="%{foo.bat}"/>'; //string retrieved
> by
> >> >> > foo.getBat()
> >> >> >
> >> >> > //javascript logic goes here
> >> >> >
> >> >> > </script>
> >> >> >
> >> >> > Hope that helps,
> >> >> >
> >> >> > -Brian
> >> >> >
> >> >> > On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings <jlistnews@(protected)
> >
> >> >> wrote:
> >> >> >
> >> >> >> So it's impossible? JavaScript and Struts 2 don't interact at
> all?
> >> >> >> What good is Struts 2 then?
> >> >> >>
> >> >> >> 2009/12/17 Paweł Wielgus <poulwiel@(protected)>:
> >> >> >> > Hi Jim,
> >> >> >> > action is on server side and javascript is on browser side,
> >> >> >> > they don't interact, You can generate js server side but that's
> >> it.
> >> >> >> > Js will be run in browser so it has no access to stack or action
> >> >> >> variables.
> >> >> >> >
> >> >> >> > Best greetings,
> >> >> >> > Paweł Wielgus.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > 2009/12/17 Jim Collings <jlistnews@(protected)>:
> >> >> >> >> So I have two actions and one jsp. The idea is that one is for
> >> the
> >> >> >> >> entire page and another is for putting into a <div> via a
> >> JavaScript
> >> >> >> >> method.
> >> >> >> >>
> >> >> >> >> Question: How do I get items off of the value stack for use in
> >> >> >> JavaScript?
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Jim C.
> >> >> >> >>
> >> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> >> >> For additional commands, e-mail: user-help@(protected)
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> ---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> >> > For additional commands, e-mail: user-help@(protected)
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> >> For additional commands, e-mail: user-help@(protected)
> >> >> >>
> >> >> >>
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> >> For additional commands, e-mail: user-help@(protected)
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/JavaScript---AJAX-%2B-Struts-2--tp26825831p26838826.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204329.ezm (zipped)I am using struts 2.1.8 with Tiles 2.0.5 and Dojo toolkit 1.3.2 [not struts dojo plugin] and I have no problem.
--- On Thu, 12/17/09, Celinio Fernandes <cel975@(protected):
> From: Celinio Fernandes <cel975@(protected)>
> Subject: [Struts 2.1.8] Dojo with Tiles: works or not ?
> To: "Struts Users Mailing List" <user@(protected)>
> Received: Thursday, December 17, 2009, 2:36 PM
> Hi,
> I already posted a message about my problem, yesterday.
> I followed this example here : http://struts.apache.org/2.1.8.1/docs/struts-2-spring-2-jpa-ajax.html
> It works well.
> However if i put the JSP pages inside Tiles, then it does
> not work.
> What happens is that the page seems to refresh all the time
> and grows exponentially (one page inside another inside
> another etc).
>
> Is there a know problem with Dojo in combination with Tiles
> ?
> http://www.dojotoolkit.org/tags/tiles
>
> Not too sure if it's a big issue or just a minor
> modification i need to do in my Tiles template or the JSPs
> to make it work.
>
> Perhaps some issue with the <s:div> Dojo tag ?
>
> I do not think I need to copy-paste any code for more
> details. The header, footer, menu are very classic.
> Does anyone have any idea ?
> thanks for helping.
>
>
>
>
__________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.

Attachment:
user_204332.ezm (zipped)Hi,
I'm getting the following test failure where building XWork (from trunk).
Maven version 2.2.1
command: mvn clean install
-------------------------------------------------------------------------------
Test set: TestSuite
-------------------------------------------------------------------------------
Tests run: 648, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
83.093 sec <<< FAILURE!
testParserWithBadXML2(com.opensymphony.xwork2.validator.DefaultValidatorFileParserTest)
Time elapsed: 42.047 sec <<< FAILURE!
junit.framework.AssertionFailedError: Wrong line number: Class:
java.net.SocketInputStreamFile: SocketInputStream.java
Method: read
Line: 168 - java/net/SocketInputStream.java:168:-1
at
junit.framework.Assert.fail (
Assert.java:47)
at
junit.framework.Assert.assertTrue (
Assert.java:20)
at com.opensymphony.xwork2.validator.DefaultValidatorFileParserTest.testParserWithBadXML2(DefaultValidatorFileParserTest.java:143)
What am I missing?
Regards,
Gabriel

Attachment:
user_204335.ezm (zipped)2009/12/17 Gabriel Belingueres <belingueres@(protected)>:
> What am I missing?
Connection to the Internet - you're probably behind a firewall :P
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_204336.ezm (zipped)Thanks Lukasz!
Yes it was a connection problem. I had configured the proxy settings
in the maven xml file, but for some reason it downloaded the artifacts
but the test failed.
I just executed the mvn passing along the proxy information as system
properties and it worked ok (mvn -DhttpProxy=.... clean install)....
2009/12/17 Lukasz Lenart <lukasz.lenart@(protected)>:
> 2009/12/17 Gabriel Belingueres <belingueres@(protected)>:
>> What am I missing?
>
> Connection to the Internet - you're probably behind a firewall :P
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204333.ezm (zipped)I migrated from struts2.1.6 to 2.1.8.1 and all of a sudden my date
fields don't get saved any more. Has anyone else faced this issue?
Please, help. I am using plain text field for date and using getter and
setter methods in the model class to format the date.
the form has
<s:textfield key="t1gen.vdat1s" required="true"
value="%{t1gen.vdat1}" size="10" maxlength="10" label="Date of Birth
(yyyy/mm/dd)"/>
Setter in the model class
public void setvdat1s(String vdat1s) {
this.vdat1s = vdat1s;
if (vdat1s != null) {
try {
this.vdat1 = Format.parseDate(vdat1s);
} catch (Exception e) {
e.printStackTrace();
}
}
}
vdat1s is a String ad vdat1 is Date.
Regards,
Parminder Lehal
-

Attachment:
user_204334.ezm (zipped)Your setter should be setVdat1s() with a capital V to match java bean standards.
There has been other reports on this list of this issue.
On Thu, Dec 17, 2009 at 2:26 PM, Parm Lehal <plehal@(protected):
> I migrated from struts2.1.6 to 2.1.8.1 and all of a sudden my date
> fields don't get saved any more. Has anyone else faced this issue?
> Please, help. I am using plain text field for date and using getter and
> setter methods in the model class to format the date.
>
>
> the form has
> <s:textfield key="t1gen.vdat1s" required="true"
> value="%{t1gen.vdat1}" size="10" maxlength="10" label="Date of Birth
> (yyyy/mm/dd)"/>
>
>
>
> Setter in the model class
>
>
> public void setvdat1s(String vdat1s) {
> this.vdat1s = vdat1s;
> if (vdat1s != null) {
> try {
>
> this.vdat1 = Format.parseDate(vdat1s);
>
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
>
> vdat1s is a String ad vdat1 is Date.
>
>
>
>
> Regards,
>
> Parminder Lehal
>
>
> -
>

Attachment:
user_204337.ezm (zipped)
I will be out of the office starting 12/17/2009 and will not return until
01/04/2010.
I'll respond to your message upon my return. Thanks!