aspose file tools*
The moose likes JSF and the fly likes How to use javascript in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to use javascript in JSF" Watch "How to use javascript in JSF" New topic
Author

How to use javascript in JSF

Ram Chhabra
Ranch Hand

Joined: Jan 07, 2008
Posts: 48
Hi

I am new to JSF development and i want ot use javascript in my JSF page.
can you please suggest me the good way to implement javascript in my JSF page.

Thanks
Ram
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

We'll tell you, but first you need to change your displayed name to conform with our Naming Requirements.

I'm afraid that "Ram Realism" doesn't sound very real to us.


Customer surveys are for companies who didn't pay proper attention to begin with.
chloe wong
Greenhorn

Joined: Aug 02, 2006
Posts: 17
just use the normal <script> tag. Of cos, in between f:verbatim


Dushyant Agarwal
Ranch Hand

Joined: Oct 14, 2007
Posts: 75
Hi,
I am not sure whether we necessrily require to use <f:verbatim> tag arund the script!!!

But then I have always used script inside the head of the form.

Would ChloeWong be kind enough to specify when we need to use the <f:verbatim> tag as well as the use of <fverbatim> in JSF
Ram Chhabra
Ranch Hand

Joined: Jan 07, 2008
Posts: 48
Thanks to all for replying, basically we use <f:verbatim> tag when we have to use any HTML tag in JSF, we write HTML code between them like below:
<f:verbatim>HTML CODE</f:verbatim>
chloe wong
Greenhorn

Joined: Aug 02, 2006
Posts: 17
He is right. We use that tag to wrap HTML codes.
You don't have to specify the tag if you're putting those in head because it's not in the view.



If you want to put the HTML in view, you have to define the verbatim tag.

Dushyant Agarwal
Ranch Hand

Joined: Oct 14, 2007
Posts: 75
Hi,
Thanks for replying.
However, could you explain why the HTML table tag

<table>

<tr><td></td></tr>
</table>

does not require the f:verbatim wrap to work???
chloe wong
Greenhorn

Joined: Aug 02, 2006
Posts: 17
You need to put the verbatim tag to wrap static HTML codes in JSF.

If you don't wrap it with verbatim tag, you'll end up having error printed on your console like below:



Perhaps the table you created is not in the view tag?
Possible for you to enclose the JSP page?
Dushyant Agarwal
Ranch Hand

Joined: Oct 14, 2007
Posts: 75
Originally posted by chloe wong:
You need to put the verbatim tag to wrap static HTML codes in JSF.

Dushyant01 asks : Kindly specify what is meant by "static HTML codes"??




Dushyant01 says: I have not encountered this error on using HTML table component as following
<f:view>
<html>
<body>
<h:form>
<table> </table>
</h:form>
</body>
</html>
</f:view>


Perhaps the table you created is not in the view tag?


Dushyant01 asks: Does the Above written code qualify as a table that is in the view tag??
[ January 14, 2008: Message edited by: Dushyant Agarwal ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use javascript in JSF