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
Solved

javascript in JSP

Posted on 2006-11-30
8
325 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 5

Accepted Solution

by:
dasmaer earned 125 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reverse digits of a number using for loop 5 52
sql import cannot be resolved jsp 3 47
Java Restore security prompts not working 10 57
Crystal Reports Licensing Questions 4 34
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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:

860 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