aspose file tools*
The moose likes Servlets and the fly likes check this out!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "check this out!!" Watch "check this out!!" New topic
Author

check this out!!

asheet anand
Ranch Hand

Joined: Nov 15, 2000
Posts: 83
hi everyone,
i simply want to use an javascript array ina jsp code.
my requirement is i want to use the values of an arrar of javascript in jsp.
i tried
<%t1.add(%><script language="javascript">document.write(a1)</script><%)%>
where a1 is the java script array
and t1 is the java object which uses a1 to call a method "add".
thanks
asheet
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Anand,
We can't break the scriplets like this. The java code inside scriplets should atleast be an eligible java statement. We can't break a function's argument alone.
Also try to minimize the java code in jsp. jsp is meant to be used for presentation. It will be a huge head-ache if we mix and scatter lots java code within html/javascript code!
Even if you are responsible for the whole appn development, when we re-visit the code after few months, we may not get the logic easily. It could be a huge maintainence nightmare.
Javascript is going to run in client's browser and jsp scriplet will run at server. If we break the scriplet like above, how the code can run at server? Because the javascript will not be able to run and give argument values to your t1.add(...) method. Isn't ?
regds
maha anna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: check this out!!