Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use javascript in JSF

 
Ram Chhabra
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18009
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
chloe wong
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just use the normal <script> tag. Of cos, in between f:verbatim


 
Dushyant Agarwal
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic