Don't be too dispointed, I may have a solution for your problem. I think you
can have an input field in the form and have your parameter in that field
and the request will send it for you, on the javaside, use
request.getParameter to get it, look like that, at client site:

function assignValue()
{
        //do some other job
        var changeTo = "value";
        document.myform.name.value = changeTo; // do your script logic here
        return true;
}

<form method="post" action="..." name="myform" onsubmit="return
assignValue()">
<input type="text" name="name" value="<%=whateverhere%>">

On the java side, you simplely need as you always to with others:

String name = (String)request.getParameter("name");

you can get what ever value you have assigned in your javascript function.
So if your question is how to pass a dynamic value to the server, I guess
the trick is reset the value in your script function right before you submit
the form. Therefore, although you see the value of the form looks "3", but
the value may be well changed to whatever you want when it arrives the
server.

Hope it answer your question

Dawei

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Yan Zhu
Sent: Thursday, February 01, 2001 12:44 PM
To: [EMAIL PROTECTED]
Subject: Re: jsp object(Param) and javascript


    ok, hmm, I see what you are saying, but it's a bit disappoiting. I
really need
a way to
dynamically pass a javascript parameter to the server object. :(

    thanks a lot though.

yan


Hung Yee wrote:

> I think we're getting confused on what i mean by 'access'.  When I mean
> 'access' I'm talking about directly getting a pointer to the object's
> address in memory, not about evaluating a expression and assigning that
> value to some other variable or expression.
>
> Hans' article talks about passing a variable's VALUE from jsp code to
> javascript code, BUT not the object(i.e., variable) itself.  Do not get
> confused between a value returned by a method in a Java object with the
Java
> object itself - they're not the same thing.
>
> -----Original Message-----
> From: Yan Zhu [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 01, 2001 8:46 AM
> To: [EMAIL PROTECTED]
> Subject: Re: jsp object(Param) and javascript
>
> Hung Yee wrote:
>
> > Javascript code on the client cannot access Java objects that were
created
> > in the JSP page on the server!
> >
>
>     but I did. In fact, I have a ejb created on a totally different
server,
> and I
> got
> the remote interface, persisted that in http session, and called it from
> javascript, and
> got the right value!
>
> >
>
>
===========================================================================
> 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

Reply via email to