The moose likes Struts and the fly likes can I do java script like the following Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Struts
Reply locked New topic
Author

can I do java script like the following

kay lin
Ranch Hand

Joined: May 20, 2004
Posts: 132
Hi All:
Could someone take a look at the the following?


will javascript take place in effect?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4695

out is an implicit object in scriptlets, so you can leave the first line out of your code.

Everything in the jsp will get turned to html before it ever reaches the client, so yes, it is valid and your resulting javascript should function normally.


A good workman is known by his tools.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 23635

You need to add quotes around the parens to make it a string.

Since you are in a JSP, you don't need to use a scriptlet to output static things (like <script> tags.)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Round these parts, posting the same question in multiple forums is bad practice. It can make it rather difficult to follow a conversation, plus folks spend time saying things that were just said.

Please continue in the duplicate post in the HTML and JavaScript forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
 
subject: can I do java script like the following
 
Threads others viewed
write javascript function in java ?
Famous "Object expected"error,Wishing Browser Independent
embedded js file in doGet
can I do java script like the following
URGENT: Alerts and JSP
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture