• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JSTL and simple javascript

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Folks,

A simple problem which I have been breaking my head on....There is a simple javascript function that I have:

function errorAlert(){
var temp = "dialog.close";
var x1 = "<fmt:message key="dialog.close"/>";
var x2 = "<fmt:message key='"+temp+"'/>";
alert(x1);
alert(x2);
}

While alert(x1) always returns the internationalized message from the ApplicationResources.properties alert(x2) gives the message ???dialog.close??? which seems to indicate that the message cannot be retrieved...Any help is glady appreciated....

Thanks...Vijay
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey VJ,

You are getting value in x1 because when on server side your fmt tag was parsed and in that you have specified dialog.close as key which is present in Application files.

In second case when your fmt tag was parsed there is key with value as temp and not as dilaog.close.

This is just the simple execution case of javascript because value in temp will be filled when you jsp will be rendered on browser and not on server side.

I hope i have clarified your doubt !!!

Cheers !!!
Sumit Malik
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have a basic misunderstanding about how JSPs work. Please read this article for some help.
 
Sumit Malik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Bear Bibeault yours you refers to whom
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It refers to "VJ Nairo"'s post.
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic