Let me prefix this by saying that I know next to nothing about Java
(so please try to keep explainations simple). I use PHP for my
server-side web programming. Here is my dilemma:
I need a JavaScript function to be called with a dynamic parameter, an
ID# known by the server. The way I would go about doing this in PHP
would be extremely simple:
<script>
foo(<?PHP echo ID; ?>);
</script>
PHP would then pre-process the PHP code and print out the content of
the variable 'ID'. When it would come time for the browser to
interpret the JavaScript it would read (for example):
<script>
foo(7);
</script>
The value '7' would then be passed into the foo() function, everything
works perfectly. The problem is that I need some way to do with with
Java. The company I work for is working with another company that uses
Java as their server-side language. I gave them this information, and
they replied saying that because they use Java, there is no way to do
this. Is that true? Is Java a preprocessor? If not, is there a work
around? Basically what it comes down to is: How can I have a
JavaScript function called with a parameter from Java?
Please help! Thanks! 3 5189
On Tue, 13 Jan 2004 09:34:47 -0800, StealthMonkey wrote: Let me prefix this by saying that I know next to nothing about Java (so please try to keep explainations simple). I use PHP for my server-side web programming. Here is my dilemma:
I need a JavaScript function to be called with a dynamic parameter, an ID# known by the server. The way I would go about doing this in PHP would be extremely simple:
<script> foo(<?PHP echo ID; ?>); </script>
PHP would then pre-process the PHP code and print out the content of the variable 'ID'. When it would come time for the browser to interpret the JavaScript it would read (for example):
<script> foo(7); </script>
The value '7' would then be passed into the foo() function, everything works perfectly. The problem is that I need some way to do with with Java. The company I work for is working with another company that uses Java as their server-side language. I gave them this information, and they replied saying that because they use Java, there is no way to do this. Is that true? Is Java a preprocessor? If not, is there a work around? Basically what it comes down to is: How can I have a JavaScript function called with a parameter from Java?
Please help! Thanks!
You could try Mozillas Rhino ( http://www.mozilla.org/rhino). You can
certainly execute JavaScript from Java using that.
It is very easy to do thish through Java. If you would use JSP the syntax
would be very similar to PHP (in fact, JSP is at all very similar to PHP).
For anything but simple thingies I would advise to use actual servlets
instead of JSP, but in this case that might be to much.
Silvio Bierman st************* *@hotmail.com (StealthMonkey) wrote in message news:<1b******* *************** ****@posting.go ogle.com>... Let me prefix this by saying that I know next to nothing about Java (so please try to keep explainations simple). I use PHP for my server-side web programming. Here is my dilemma:
I need a JavaScript function to be called with a dynamic parameter, an ID# known by the server. The way I would go about doing this in PHP would be extremely simple:
<script> foo(<?PHP echo ID; ?>); </script>
PHP would then pre-process the PHP code and print out the content of the variable 'ID'. When it would come time for the browser to interpret the JavaScript it would read (for example):
<script> foo(7); </script>
The value '7' would then be passed into the foo() function, everything works perfectly. The problem is that I need some way to do with with Java. The company I work for is working with another company that uses Java as their server-side language. I gave them this information, and they replied saying that because they use Java, there is no way to do this. Is that true? Is Java a preprocessor? If not, is there a work around? Basically what it comes down to is: How can I have a JavaScript function called with a parameter from Java?
Please help! Thanks!
So what is the question?
You definitely don't seem confused about serverside/clientside which
is a good thing. Are you using Java on the server side? If so, then
I'll assume you are using either servlets or JSP (Java Server Pages)
JSP is really just a different notatation for a java servlet. Both
are compiled into a .class files and executed by a 'container'
whenever an incoming request is received.
The Javascript doesn't care how the page was generated. Whether the
parameter was written into the page using PHP, JSP, servlets, or just
hardcoded HTML it makes no difference.
If you don't know what to use on the server side, try JSP. The syntax
is similar to PHP and you'll pick it up quickly.
Start by looking at or playing with Tomcat to get a feel for it. http://jakarta.apache.org/tomcat/
---
Jared Dykstra http://www.bork.org/~jared This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Oleg Konovalov |
last post by:
Hi,
I am writing a Java application which among many other things
has to call some MS Office internal methods,
which only seems to be possible from either VBA or C#.
Can anybody suggest a way of Java calling VBA or C# ?
I do know how to call an executable from Java
or Java interface with C/C++ through JNI.
|
by: Klaus Friese |
last post by:
Hi,
i'm currently working on a plugin for Adobe InDesign and i have some
problems with that. I'm not really a c++ guru, maybe somebody here has
an idea how to solve this.
The plugin is written in C++ and it's calling a java application. This
application displays a window and pushing a button is calling back the
c++-plugin again.
|
by: Oleg Konovalov |
last post by:
Hi
I am writing a Java application which among many other thing
has to call some MS Office internal methods,
which only seems to be possible from either VBA or C#
Can anybody suggest a way of Java calling VBA or C#
I do know how to call an executable from Java
or Java interface with C/C++ through JNI
|
by: Krishna |
last post by:
Hi all,
Can i call my javascript functions from the web controls.Any appropriate
site which will be tell more on this will be helpfull.
Regards..,
Krishna
|
by: Oleg Konovalov |
last post by:
Hi
I am writing a Java application which among many other thing
has to call some MS Office internal methods,
which only seems to be possible from either VBA or C#
Can anybody suggest a way of Java calling VBA or C#
I do know how to call an executable from Java
or Java interface with C/C++ through JNI
| |
by: J de Boyne Pollard |
last post by:
TWJava and JavaScript are two different animals. ;-)
DHLOK Tom.
DHL>
DHLDefine the two.
DHL>
DHLTo me Java is the software that interprets and executes
DHLJavaScripts and Java Applets.
It's a common conflation, but Java and JavaScript are two entirely
|
by: keith_rhodes |
last post by:
Hi, all.
I know that there is a way of using JavaScript to call a Java method,
and for the JavaScript to collect some sort of response from the Java,
as I had a page working a few years ago that used Java to read a file
from the filesystem then the JavaScript formatted the contents of the
file (a simple list) by wrapping HTML tags round certain fields.
Now, I am trying to make an HTML page that presents a query form, that
would then...
|
by: wpelgrum |
last post by:
When I open a webpage with javascript my browser (both IE6 and
FF2.0.0.3) freezes anywhere from seconds to more than a minute. During
that period, the browser is frozen and windows (XP-SP2) is very poorly
responsive. There is no significant CPU-load.
When I disable javascript in FireFox, everything works smoothly
again.
I have uninstalled MS javascript and SUN javascript, however,
javascript is still being executed (when enabled in...
|
by: basm101 |
last post by:
Hello,
Firstly, apologies if this should be in the javascript forum - I wasnt sure which was most appropriate to post this question in...
I am not sure if my problem is caused by the way I am mixing java and javascript in my jsp and if it can be fixed.
If currentObservation.getComment() (java) is not null then all is well. But if it is null, instead of just setting document.commentForm.commentBox.value to a blank string I get a...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |