The point is any JavaScript code can get the value of Java object, but you
can not alter those java objects by javascript. if you like to do the work
like
<% String name = javaObject1.getName(); %>
function myFunction()
{ var name = <%= name%>;
name = name+" test";
if (document.yourForm.yourName.value != name) return false;
return true;
}
it's legal for you to do it, but if you try to change <%= name%> by
javascript, it's not possbile, because it's already processed by the server.
use "view source", you will see <%= name %> part has been replaced by real
value.
I guess it's how you interpreted "access". Using Applet is another story,
the fact is how many application still using applet
Dawei
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Hung Yee
Sent: Thursday, February 01, 2001 10:08 AM
To: [EMAIL PROTECTED]
Subject: Re: jsp object(Param) and javascript
Javascript code on the client cannot access Java objects that were created
in the JSP page on the server!
The link that I gave you shows you how to create javascript code using jsp,
BUT the jsp code itself is only executed at the server and the javascript
code that is dynamically built by the jsp code is only executed on the
client, so the two technologies cannot share objects (I think the web
article clearly explains this). I you want the client to access Java
objects, I think you'll have to use applets instead somehow.
So, if you want the browser to send back data to the jsp on the server,
here's how Hans says you need to do it in the article:
"To only way to pass data from the browser to a JSP page is to pass the
data as HTTP request parameters. If the data is generated by JavaScript
code in the browser, the JavaScript code can set hidden form fields or
the query string of an <a href> element, and this way get the data sent
to the page with the HTTP request. To the JSP page, it doesn't matter how
the parameter value was assigned; it uses the parameter value exactly
the same way as it uses a parameter value passed as a regular form
field value or a hardcoded query string."
-----Original Message-----
From: Yan Zhu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 01, 2001 7:43 AM
To: [EMAIL PROTECTED]
Subject: jsp object(Param) and javascript
ok, a little twist, anyone done calling a java object method inside of a
javascript
with a Parameter (which is a javascript variable) ?
thanks
yan
Hung Yee wrote:
> Here's some more details as to what is happening between jsp code and
> javascript code:
> http://thejspbook.com/faq/details.jsp?id=1003
>
> -----Original Message-----
> From: Yan Zhu [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 31, 2001 6:47 PM
> To: [EMAIL PROTECTED]
> Subject: Re: jsp object and javascript
>
> really? wow, let me try that.
>
> "Konuru, Raghu" wrote:
>
> > You can use get methods such as
> >
> > var index="<%=bean.getIndex()%>";
> > var str="<%=strIndex%>";
> >
> > Raghu
> > -----Original Message-----
> > From: Castiaux, Sebastien [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 31, 2001 8:01 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: jsp object and javascript
> >
> > I don't think so because your JSP objects are at the server side and
> > Javascript is at the client side.
> >
> > Seb
> >
> > > -----Original Message-----
> > > From: Yan Zhu [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, January 31, 2001 2:52 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: jsp object and javascript
> > >
> > >
> > > hey all,
> > > is there a way to reference jsp java object inside of a javascript
> > > function?
> > > thanks
> > >
> > > yan
> > >
> > > ==============================================================
> > > =============
> > > 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
> >
> >
>
===========================================================================
> > 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
>
>
===========================================================================
> 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
===========================================================================
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