Re: ResourceBundle in Javascript?

2007-03-14 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nitin,

Dave Newton wrote:
> Message bundles are server-side. You want to access it on the client.

[snip]

> If you just need to access a single message out of a bundle, maybe 
> this is okay, although I'd probably just put the message into scope 
> via an Action then build your JavaScript using JSTL, which might be 
> enough for whatever it is you're trying to do.

This is what I do (albeit without JSTL) when I need to use a localized
string in javascript. It's also what velocity-tools does in order to
render client-side validation error messages.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF9/yr9CaO5/Lv0PARAo43AKCSt6AGuumgaFCqdGeNtkaN0KsYZACfR3yA
XeNvNT3i3MPasVFgbqLwuaI=
=rWgL
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ResourceBundle in Javascript?

2007-03-14 Thread Dave Newton
--- Musachy Barroso wrote:
> 
>var myMessage = ' />';
> 
>function sayit() {
>   alert(myMessage);
>}
> 

Or that ;)

d.



 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ResourceBundle in Javascript?

2007-03-14 Thread Dave Newton
--- Nitin Ahuja <[EMAIL PROTECTED]> wrote:
> What is DWR ?

http://getahead.org/dwr

> I have to assign the the value of message resource 
> key to an html object in jsp.

Message bundles are server-side. You want to access it
on the client.

So you need to build a representation of the message
bundle in JavaScript, which is what you did, in a
roundabout way. 

If you just need to access a single message out of a
bundle, maybe this is okay, although I'd probably just
put the message into scope via an Action then build
your JavaScript using JSTL, which might be enough for
whatever it is you're trying to do.

But without knowing what you're trying to accomplish,
it's hard to say.

d.



 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ResourceBundle in Javascript?

2007-03-14 Thread Musachy Barroso


  var myMessage = '';

  function sayit() {
 alert(myMessage);
  }


On 3/14/07, Nitin Ahuja <[EMAIL PROTECTED]> wrote:


Hi Dave,

What is DWR ?

I found a simple wayout, but there is dependency i.e I have to assign
the the value of message resource key to an html object in jsp. Here
is what i did..

in jsp



and in java script

function display(button)
{
alert(button.value);
}


this will display the value of key "form.select"

thanks,
-Nitin

On 3/14/07, Dave Newton <[EMAIL PROTECTED]> wrote:
> --- Nitin Ahuja <[EMAIL PROTECTED]> wrote:
> > Does anyone know how can I acces Message
> > ResourceBundle key/values in Javascript?
>
> ?!
>
> You'd have to pass in something that [had] rendered a
> JavaScript representation of the bundle.
>
> I haven't given it any thought, but you *might* be
> able to use DWR to do this in a relatively transparent
> way.
>
> d.
>
>
>
>
>

> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives.
> http://tools.search.yahoo.com/toolbar/features/mail/
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
...
"Yesterday I dared to struggle, today I dare to win."
--- Bernadette Devlin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Re: ResourceBundle in Javascript?

2007-03-14 Thread Nitin Ahuja

Hi Dave,

What is DWR ?

I found a simple wayout, but there is dependency i.e I have to assign
the the value of message resource key to an html object in jsp. Here
is what i did..

in jsp





and in java script

function display(button)
{
   alert(button.value);
}


this will display the value of key "form.select"

thanks,
-Nitin

On 3/14/07, Dave Newton <[EMAIL PROTECTED]> wrote:

--- Nitin Ahuja <[EMAIL PROTECTED]> wrote:
> Does anyone know how can I acces Message
> ResourceBundle key/values in Javascript?

?!

You'd have to pass in something that [had] rendered a
JavaScript representation of the bundle.

I haven't given it any thought, but you *might* be
able to use DWR to do this in a relatively transparent
way.

d.





Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
...
"Yesterday I dared to struggle, today I dare to win."
--- Bernadette Devlin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ResourceBundle in Javascript?

2007-03-14 Thread Musachy Barroso

I think you are confusing client side and server side code.

musachy

On 3/14/07, Dave Newton <[EMAIL PROTECTED]> wrote:


--- Nitin Ahuja <[EMAIL PROTECTED]> wrote:
> Does anyone know how can I acces Message
> ResourceBundle key/values in Javascript?

?!

You'd have to pass in something that [had] rendered a
JavaScript representation of the bundle.

I haven't given it any thought, but you *might* be
able to use DWR to do this in a relatively transparent
way.

d.






Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Re: ResourceBundle in Javascript?

2007-03-14 Thread Dave Newton
--- Nitin Ahuja <[EMAIL PROTECTED]> wrote:
> Does anyone know how can I acces Message
> ResourceBundle key/values in Javascript?

?!

You'd have to pass in something that [had] rendered a
JavaScript representation of the bundle.

I haven't given it any thought, but you *might* be
able to use DWR to do this in a relatively transparent
way.

d.



 

Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ResourceBundle in Javascript?

2007-03-14 Thread Nitin Ahuja

Hi,

Does anyone know how can I acces Message ResourceBundle key/values in
Javascript?



Thanks,
-Nitin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]