Hi!
JSP code just runs on server so calling it from a JS script will not work as
you've seen. If you don´t want to have the page reloaded, could you have all
the changing content in JS variables or in HTML layers? This way you can
show different contents just showing the container layer or changing the
content of a HTML element such as a table, or a span... acoording a certain
value of a variable. To switch the contents you can use a global JS variable
in the downloaded page and control it with HTML events an JS code.

Hope this helps,
Fran


-----Mensaje original-----
De: Jörg Wiesmann [mailto:[EMAIL PROTECTED]
Enviado el: martes, 05 de abril de 2005 7:49
Para: JSP-INTEREST@JAVA.SUN.COM
Asunto: JSP and JAVAScript - dynamic content


Hi @ all,

i am trying to find a solution for the following problem:
We want to show a website with different content without realoding the page.
I tried to solve this problem with a combination of javascript and jsp, but
i can not get it working.

here the code i tried.
I want to call the jsp function more than once, but it do not work.
It is just called when the page has been loaded or is reloaded.
Any suggestions ?

is it possible ? or do the server interprets the code just once and then
never again? it should be possible, or not ?

the javascriptfunctions:
~~~~~~~~~~~~~~~~~~~~~~~~
function start() {
 timerID  = setTimeout("getEventJScript()", 2000);
}
function getEventJScript() {
 document.InputForm.TelephoneInputField.value = "test...";
 <jsp:scriptlet>
  String reqAtt1 = "Instance";
  String reqAtt2 = "uniqueName";
  Server MyServer = (Server) request.getAttribute( reqAtt1 );
  String userNameGiven = (String) request.getAttribute(
reqAtt2 );
  EventHandling event = MyServer.getEvent(userNameGiven);
  String myStatus = event.getStatus();
 </jsp:scriptlet>
 statusJS = "<jsp:expression>myStatus</jsp:expression>";
 document.InputForm.TelephoneInputField.value = statusJS;
 document.InputForm.TelephoneInputField2.value
= "<jsp:expression>userNameGiven</jsp:expression>";
 document.InputForm.TelephoneInputField5.value = count;
 count = count +1;
 timerID  = setTimeout("getEventJScript()", 2000);
}

Best regards
Jörg Wiesmann

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to