javascript in JSP

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
sreddy_kAsked:
Who is Participating?
 
dasmaerConnect With a Mentor Commented:
how about this:
<script>
    return disb();
</script>

0
 
dasmaerCommented:
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
 
dasmaerCommented:
so a more complete example is:
<script>
function my_fuction(var str){
  //do stuff
}
</script>

<%
  if(true){
    %>
      <script>my_function(<%=abc%>)</script>
    <%
  }
%>
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
sreddy_kAuthor Commented:
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
 
sreddy_kAuthor Commented:
Thx for u r reply dasmaer ..
i have tried it but no result ..
rgds
0
 
deeppraCommented:
what error u r getting
0
 
PrasathAnnamalaiCommented:
Javascript runs on the client, JSP runs on the server. They cannot
communicate with each other directly.
0
 
sreddy_kAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.