Solved

javascript in JSP

Posted on 2006-11-30
8
300 Views
Last Modified: 2010-03-31
Hi  ,
I m  working on Javascript with JSP .
I wud like to call Javascript function in JSP .
ex:
<script language="javascript">
java script function(abc) goes here
</script>

xyz.jsp

if (true) // then
{
//here i wana call Javascript function (abc) written above
}
thx and rgds
0
Comment
Question by:sreddy_k
8 Comments
 
LVL 5

Expert Comment

by:dasmaer
ID: 18046284
you can't call in per say, but you could print out:
<script>function(<%=abc%>)</script>
to the page and it would pass abc to your javascript function.
0
 
LVL 5

Expert Comment

by:dasmaer
ID: 18046308
so a more complete example is:
<script>
function my_fuction(var str){
  //do stuff
}
</script>

<%
  if(true){
    %>
      <script>my_function(<%=abc%>)</script>
    <%
  }
%>
0
 

Author Comment

by:sreddy_k
ID: 18046616
Hi dasmaer
Thx for u r immidiate responce ..
i have tried it doing in the same way earlier but it dint work .. i m just copying and pasting my stuff here ..
xyz.jsp
<%import ...............%>
<script>
fucntion disb()
{
here i m disabling text field
}
}
</script>
<% boolean trorfa = getting some value%>
<%
if(trorfa)
{%>

<script> disb</script>

<%}%>
its not working .
Thx n regds





0
 
LVL 5

Accepted Solution

by:
dasmaer earned 125 total points
ID: 18046784
how about this:
<script>
    return disb();
</script>

0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:sreddy_k
ID: 18046897
Thx for u r reply dasmaer ..
i have tried it but no result ..
rgds
0
 
LVL 5

Expert Comment

by:deeppra
ID: 18051299
what error u r getting
0
 
LVL 4

Expert Comment

by:PrasathAnnamalai
ID: 18178861
Javascript runs on the client, JSP runs on the server. They cannot
communicate with each other directly.
0
 

Author Comment

by:sreddy_k
ID: 18231983
Hi ,
I am new to webservices in java  and could some one pls let me know how can i use them in my project
?? I would also like to know the best use of Web Services in real world .it  would be great if some one give me an example . pls also refer some best site for reading and deeloping web services.
Thx and Regards
 
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now