• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I call a javascript method from JSP  RSS feed

 
Ram Kas
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can I call a javascript method from JSP?

for example,
<%

Connect.getModules(Connect.getConnection(),"<%=moduleList(this.form)%>");


%>

is the above code valid considering moduleList is a javascript function.

Thanks in advance.

Dinakar.K
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Please read this article to understand why.
 
Yuval Goldstein
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you request a JSP, the server renders html according to your JSP code, this happens before the result is sent to your browser.

When the result html reach your browser, the browser may execute Javascript code according to events. This happens on your desktop client machine.

So, unless you are talking about explicitly running serverside javascript code (that really has nothing related to controlling display elements / dom), the answer is no: JSP runs on the server before, then Javascript may run on the client.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!