?
Solved

javascript in JSP

Posted on 2006-11-30
8
Medium Priority
?
345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Accepted Solution

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

0
 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month13 days, 5 hours left to enroll

777 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