A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
JSP
Author
Calling JavaScript using EL
Ed Carrington
Ranch Hand
Joined: Oct 11, 2007
Posts: 77
posted
Oct 31, 2009 19:00:34
0
I am trying to call a JavaScript function using EL.
My below attempt outputs the following exeption:
The function dateInfo must be used with a prefix when a default namespace is not specified
Please advise.
<%@ page contentType="text/html; charset=utf-8" language="java"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Date Info</title> </head> <body> <script> function dateInfo() { return new Date(); } </script> <fmt:message key='content.dateInfo()' /> <c:out value="${dateInfo()}"/> </body> </html>
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Oct 31, 2009 20:16:28
0
EL runs on the server; JS runs on the client. It's not going to work.
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56215
13
I like...
posted
Oct 31, 2009 20:22:05
0
Read
this article
to find out how
JSP
works.
[
Smart Questions
] [
JSP FAQ
] [
Books by Bear
] [
Bear's FrontMan
] [
About Bear
]
I agree. Here's the link:
http://aspose.com/file-tools
subject: Calling JavaScript using EL
Similar Threads
XML DOM is not working
JSF binding conversion
Cannot see the JavaScript code I wrote when I hit script tab on firebug :(
Getting javascript error while closing ActiveXRecordset object
Having Problems with Jquery.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter