Hi,
this is the sample code I try to pass a variable to javascript function from
jsp. it works.

but if I try to pass Properties object prop to that function, it won't work.

I like to know to pass the object?


<%@page import="java.util.*" %>

<% // the page is forwarded from another jsp page which
   // set request.setAttribute("prop",value).

   Properties prop = new Properties();
   prop = (Properties)request.getAttribute("prop");
   String name = prop.getProperty("name1");
%>

<html>
<head>
<title>MAMSI- Group Eligibility</title>

<script Language="JavaScript">


  function go(name1)
  {

    alert("name=" + name1);
  }
</script>
</head>



<body>

<a href="javascript:go('<%=name%>')"> click here to pass property </a>
</body>
</html

>From: Andy Purshottam <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: how to call javascript function and pass class object to it i
>             n JSP?
>Date: Tue, 7 Nov 2000 12:38:14 -0800
>
>  Asnwering your question requires knowledge of
>where (client or server) you want to execute
>various pieces of code. the JSP page is run on the server,
>creating HTML with the link sent to the browser. Certainly the
>link can be a javscript: type URL, which calls a client side
>javascript function when the link is clicked. But where is the
>java Properties object coming from? The server side java code on the JSP
>page? If so, you'd need to get the object somehow to the client,
>maybe in hidden fields, or via javaScript code in the <HEAD> of the
>generated HTML.
>
>Andy
>
>
>-----Original Message-----
>From: hua ge
>To: [EMAIL PROTECTED]
>Sent: 11/7/00 12:02 PM
>Subject: how to call javascript function and pass class object to it in
>JSP?
>
>hello,
>
>I have a jsp page, there is a link there, I want the link to call a
>javascript function and pass a java Properties object to that function.
>
>is that possible to do that?
>
>there is no problem for me to pass string, int data type to JavaScript
>function, I wondered is it possible to  pass the Properties object to
>the
>javascript function,  and retrive the Properties object attribute value
>in
>that function?
>
>
>
>thanks
>
>helen
>________________________________________________________________________
>_
>Get Your Private, Free E-mail from MSN Hotmail at
>http://www.hotmail.com.
>
>Share information about yourself, create your own public profile at
>http://profiles.msn.com.
>
>========================================================================
>===
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>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".
>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

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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