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.
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.