Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL and simple javascript  RSS feed

 
VJ Nairo
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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
 
Sumit Malik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
143
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hey Bear Bibeault yours you refers to whom
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It refers to "VJ Nairo"'s post.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!