Remember, JSP runs on the server - Javascript runs on the browser.
You need quotes for javascript to identify the message as a String:
JSP:
------------------------
if (actform.txt1=="") {
alert("<%= msg.MSG01 %>");
}
Resulting HTML:
------------------------
if (actform.txt1=="") {
alert("You have to fill the textbox");
}
-----Original Message-----
From: Leena Albert [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 04, 2000 12:17 PM
To: [EMAIL PROTECTED]
Subject: Can i use java objects in Javascript
Hi,
In JSP, I would like to use instances in JavaScript using JSP tags.
Will it be possible?
I am having a interface Which declares constants, i.e, fields like
MSG01="You have to fill the textbox". In javascript, on field validation, if
i call the message with instance msg as <%= msg.MSG01 %> it, gives "object
undefined error".
How can i access it in javascript, as i need to declare the error
messages(MSG01) in interface?
form name=actform and textbox name = txt1,
Code is
------------------------------------
if (actform.txt1==""){
alert(<%= msg.MSG01 %>);
}
Thanks in advance,
A.Leena
_________________________________________________
Get Your Free Email At, http://www.rediffmail.com
Partcipate in crazy Re.1 auctions at http://www.rediff.com/auctions
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets