freena
jsp solution
1 Answer(s)      2 years and 10 months ago
Posted in : JSP-Servlet

how to display javascript value in current jsp page without refreshing page.. dont want alert... got value in 1 variable in javascript and want to print in current jsp page
View Answers

July 21, 2010 at 3:53 PM


Hi Friend,

You can use Ajax. Try the following code:

1)ajaxExample.jsp:

<html>
<head>
<script>
var xmlhttp

function loadContent(str){
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null) {
alert ("Your browser does not support Ajax HTTP");
return;
}
var url="getvalue.jsp";
url=url+"?q=roseindia";
xmlhttp.onreadystatechange=getOutput;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function getOutput(){
if (xmlhttp.readyState==4) {
document.getElementById("var").innerHTML=xmlhttp.responseText;
}
}
function GetXmlHttpObject(){
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
</script>
</head>
<body>
<a href="javascript:loadContent('parameterValue')">Load</a>
<div id="var"></div>
</body>
</html>

2)getvalue.jsp:

<%
String q =request.getParameter("q");
out.print(q);
%>

Thanks









Related Pages:
jsp solution - JSP-Servlet
jsp solution  how to display javascript value in current jsp page without refreshing page.. dont want alert... got value in 1 variable in javascript and want to print in current jsp page  Hi Friend, You can use Ajax
Urgent Solution required
Urgent Solution required  This is possible to transfer that file from client to server and read that file and view it in JSP. If it is can you send the example. thanks alot in advance   Hi, You can create a JSP file
solution
solution   A developer wants you to develop a simple take away restaurant order service. The system reads from a file containing information about the restaurant (such as the name, place and menu). The system then allows the user
solution
solution   A developer wants you to develop a simple take away restaurant order service. The system reads from a file containing information about the restaurant (such as the name, place and menu). The system then allows the user
please give me solution how to display next page after 20 records ? - JSP-Servlet
please give me solution how to display next page after 20 records ?  Java Servlet Paging control example  here i have attached one example code. function validate() { for(j=0;j<30;j
Jsp
Jsp  Hi Sir, I want to get the values of selected row from dynamic table and insert into mysql table using servlet.Give me a solution as soon as possible. Regards, Santhosh
JSP
JSP   how to open and view a flat file in browser using java code in jsp?   Hi Friend, If you want to simply open a file then try...) in the path creates the problem. Any solution is appreciated. Thanks in advance.  
jsp
" "http://www.w3.org/TR/html4/loose.dtd"> **<jsp:useBean id="obj" class="com.ingenious.bean.UserBean"scope="session"/>** <jsp:setProperty...;title>JSP Page</title> </head> <body>
jsp
solution to my problem
solution of k map in c
solution of k map in c  write a program in c to solve k-map with digital circuit
JSP Tutorials
or JSP for short is Sun's solution for developing dynamic web sites. JSP... JSP Tutorials       JSP Tutorials and examples, you will find many examples
Solution to C prog
Solution to C prog   Hi, Pls any body help, why the following prog crashing while running. #include<stdio.h> #include<conio.h> int main(){ int n,*fact(int *n); printf("Enter the number:"); scanf
j2me solution - MobileApplications
send me the solution for this problem i am grateful to you. Thanks & Regards
A program solution needed
A program solution needed   I need a solve for this problem please ! a program that displays grade statistics. The program should read any number of grades (up to 100) and ends when the user enters -1, the program should reject
Please find me a solution that
Please find me a solution that   Write a java program that calculates the area of rectangular, square, triangular, and circle. Your program must have the following: Two classes named "Area" and "AreaTest". Class "Area
jsp functions - JSP-Servlet
jsp functions  hi,sir i need a simple jsp program using page directive with session attribute  Hi friend, To get the solution of your problem visit this link.... http://www.roseindia.net/jsp
JSP Training
JSP Training     Java Server Pages (JSP) is Sun's solution for developing dynamic web sites. JSP provides excellent.... JSP training course Objective: This JSP training course aims at teaching
Java: Delete Blanks - Solution
Java: Delete Blanks - Solution See Exercise - Delete Blanks. Solution 1 - Using charAt public static String deblank(String s) { String result...; } Solution 2 - Using substring public static String deblank(String s) { String
JSP Code - JSP-Servlet
JSP Code  Hi, Do we have a datagrid equivalent concept in JSP? If so, then please help me to find the solution of the problem. Its Urgent..., Please visit the following links: http://www.roseindia.net/jsp/data-grid.shtml
jsp code - JSP-Servlet
jsp code  hello frns i want to display image from the database along... so please tell me the solution how to write a text after image display... from database in Jsp to visit.... http://www.roseindia.net/jsp/retrieve
Can find a solution or code for this - XML
Can find a solution or code for this   Develop a java based tool which can be used to build a GUI structure based on the configurations given in the tool. Input XML Folders/Files E.g:Folder for Main Panel Files for required
jsp and ajax - JSP-Servlet
jsp and ajax  i had some problem i want to display the current... this link to find the solution about your problem. http://www.roseindia.net/jsp/fileupload.shtml Thanks
Introduction to JSP
JSP Tutorials - Writing First JSP       Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide excellent server side scripting
Hosted E-Commerce Solution
Hosted E-Commerce Solution In this article we will explain Hosted E-Commerce Solution and tell you how to choose the best Hosted E-Commerce Solution... to provide best Hosted E-Commerce Solution. But sometime you may end up in choosing
Java: Programming: Kingdom - Solution
Java NotesProgramming: Kingdom - Solution 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.4 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... that simulates my solution to this exercise, so that you can see how it works
JSP Problem - JSP-Servlet
JSP Problem  Hi, I have problem,this is my senario I have one jsp,this jsp having the 3 fields.let me take 3fields userName,emailAddress... the submit button. with out using the "Session" i want the solution
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.1 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... the subroutine to compute a solution of the equation. If no error occurs, it should
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.3 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... when the user inputs an empty line. Here is an applet that simulates my solution
E-commerce Hosting Solution
E-commerce Hosting Solution In this article we will explain you about E-commerce Hosting Solution. The E-commerce Hosting Solution is used by the shopping... Hosting Solution is essential in success of the online e-commerce portal
EL in jsp - JSP-Servlet
EL in jsp  hai, I tried to test EL operators in my jsp i...? in case please let me know  What version of JSP ru using?? see... in the JSP specifications before JSP 2.0, there may be applications where
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 2.1 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook.... The Solution public class PrintInitials
Programming: Hammurabi I - Solution
Java NotesProgramming: Hammurabi I - Solution Solution The following two source files are a solution to the Hammurabi I programming problem. This solution has expanded somewhat on the minimum requirements. Main program 1 2
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 2.3 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook....) The Solution public class Greeting { /* This program asks
Flex with JSP
Flex with JSP  i want to draw chart in jsp page using flex. how can i do that? any solution??   Flex charts You can visit the following links: http://www.roseindia.net/tutorial/flex/flex4/components/charteffect.html
Java Programming, Solution to Programming Exercise
Solution for Programming Exercise 11.1 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... is not quite what I ended up using in my solution.) static void listContents
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 2.2 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... happens. The Solution public class RollTheDice
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.1 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... The Solution public class SnakeEyes { /* This program simulates
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.3 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... out an error message if the user tries to divide by zero. The Solution
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 4.3 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook...() The Solution public class RollFor2 { /* This program
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 4.4 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... . . . . Discussion The solution uses the subroutine, rollFor, from
Java Programming, Solution to Programming Exercise
Solution for Programming Exercise 12.1 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... between nodes in the list. So, in my solution, I use an ArrayList to implement
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 7.6 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... for the timer. Here is an applet that tests my solution to this exercise
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 3.6 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... of x in g.fillRect(x,y,w,h). Here is a working solution to this exercise
Java Programming: Solution to Programming Exercise
Solution for Programming Exercise 9.2 THIS PAGE DISCUSSES ONE POSSIBLE SOLUTION to the following exercise from this on-line Java textbook... the user inputs an empty line. Discussion My solution uses a subroutine

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.