(It's deja vu all over again . . .)
At the risk of getting chastised by Julia again, I have to say that it
doesn't look like you've been paying attention to recent postings; I've
posted at least twice recently covering this "how do I get JSP and
JavaScript to talk to each other" topic. You can't "use JSP in JavaScript",
although you can use JSP to generate JavaScript, if you're careful. The
distinction may seem like nitpicking semantics, but clearly the lack of a
clear distinction is leading many to be confused. So I'll say this again:
Java and JavaScript are COMPLETELY separate. The Java in a JSP gets executed
on the server at page request time. JavaScript lives inside the page, and
gets executed on the browser long after the Java has completed.
What you've got in your example is a Java loop that generates some text that
ends up inside a JavaScript tag in the HTML. The snippet you included below
will result in JavaScript that looks like this:
<script>
par = name1
par = name2
par = name3
. . .
which is probably not what you wanted or expected. Look up my postings on
this subject from last week for more details.
--Jim Preston
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Deepak Arora
Sent: Monday, August 07, 2000 6:32 AM
To: [EMAIL PROTECTED]
Subject: using jsp in java script
can i use jsp in java script i.e between <DEFANGED_script> tags
i am facing a problem
i have generated some text fields in a jsp page
depending upon the
some i/p field of the previous page
and have generated the names of those input text
fields using jsp
and as my program initially does not know how many i/p
fields will be there
i have to start a loop in java script
now my script is not recognising the name of those
fields (generated using jsp)
i am writing few lines to explain what i am doing
<DEFANGED_Script>
<% for(counter=1;counter <
totalnumberoftextboxes;counter++){ %>
<% String total = "name" + counter; %>
par = <%=total %>
but it is giving me error at document.form.par.value
kindly help
__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.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