David,

I've never tried to tie a user event on the browser side back to an object
on the server.  To my knowledge, JS runs only on the browser side, and Java
class Beans are resident on the server side.  I don't know how you would
capture an event generated on the browser side, pass it back to the Java
class Bean on the serverside, and send the response back to the browser.
Whenever I needed event capability, I considered using a visual JavaBean
that could run within the browswer.  I would be interested in seeing the
code if anyone has ever used JS on the browser side to send an event to a
Java class bean on the server side, and back again.

Celeste

-----Original Message-----
From: David Gee (MAYA Design) [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 21, 2001 10:47 AM
To: [EMAIL PROTECTED]
Subject: Re: how to access servlet from the jsp page


> Hi David,
>
> To use something similar to VBScript/COM objects in java you would use
> JSP/JavaBeans.

I know, I'm already (successfully) doing that. My problem is tying Javabean
method calls into user events (clicks, rollovers, etc). This is possible
with VBScript/COM, but I haven't been able to find any way to do this with
JSP/Javascript.

here's a reduction of what MS is doing:

<object id=x classid="clsid:xxx" border=0 width=0 height=0 VIEWASTEXT>
.
.
</object>

<script>
    function doStuff {
    x.method("param");
    }
</script>


if i try something similar with JSP:

<jsp:useBean id="x" scope="session" class="com.maya.x" />

<script>
    function doStuff {
    x.method("param");
    }
</script>

i get a javascript error: x is null or not an object. this is because the
"object" tag is part of the DOM, whereas the "jsp:usebean" is a server
processed tag which doesn't exist in the DOM and so isn't accessable via
Javascript. At least, that's my (admittedly limited) understanding of what's
going on.

> You can also include any java class you like in your JSP page with the
> 'import' tag. I can't see really why you'd want to access a servlet from a
> JSP, but you can send the http request to a servlet from a JSP. I think
you
> need to read up a bit more about how to use JSP, servlets and beans in a
web
> application since you can do everything with JSP that you can with ASP and
> more.

Except for what I'm trying to do above :) Don't get me wrong, I'm pretty
much agnostic when it comes to web technologies, but lean towards anything
that's not Microsoft, for all the obvious reasons. I just think that the
idea of what a "dynamically generated page" is, is changing rapidly from a
page that is processed on the server and rendered as static HTML (which is
what JSP seems to do) to a page that can go out, get information, and update
itself *without* refreshing the entire page or forwarding to another page.
I'm coming from a front-end web developer's point of view - I care about
making the user experience as satisfying, quick, and impressive as possible.

> Javascript and Java are seperate technologies - ASP and COM are designed
to
> be used together. Oh, and of course they're (to all intents and purposes)
> platform specific and proprietry, limitations java doesn't have.

Yeah, I know. That seems to be the limitation. If Beans could be implemented
in pages via the <object> tag, it'd solve all my problems.

david

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to