struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dusty <dustin_pea...@yahoo.com>
Subject Re: JavaScript / AJAX + Struts 2?
Date Fri, 18 Dec 2009 04:05:23 GMT

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@gmail.com>
> 
>> 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@gmail.com>:
>> > 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@gmail.com>
>> >
>> >> 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@gmail.com>:
>> >> > 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@gmail.com>
>> >> 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@gmail.com>:
>> >> >> > 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@gmail.com>:
>> >> >> >> 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@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
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> 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
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message