Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Working with JavaScript & CSS 
 

JSF provides so many attributes to provide javascript support like onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmouseover, onmouseup, onselect etc.

 

Working with JavaScript & CSS

                          

JSF provides so many attributes to provide javascript support like onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmouseover, onmouseup, onselect etc. For using CSS, JSF provides style and styleClass attributes for the components. You can use this as in the example below:

 

 

 

 

 

 

 

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<f:view>
<html>
<head>
<title>JSF JavaScript & CSS</title>
<script type="text/javascript">
function checkName(){
      var name = document.getElementById("myform:name").value; 
      if(name.length<1){
          alert("Name can not be blank.");
          return false;
      }
      if(name.length>4){
          alert("Name can not be more than 4 characters.");
          return false;
     }
}
</script>


<style type="text/css">
     .inputbox {
           background-color:#FFFFFF; 
           color: #333333;
           width:200px;
           border-width:1px;
           border-style:solid;
           border-color:#808080;
      }
      .submitbutton{
           background-color:#367BB7;
           border:1px solid #2E76B4;
           color: #ffffff;
           text-align: center;
           width: auto;
           padding: 2px 3px 2px 3px;
       } 
</style>


</head>

<body>
<h:form id="myform"> 
<h:outputText value="Enter your Name: " style="font-weight:bold;"/>
<h:inputText id="name" styleClass="inputbox"/>

<br><br> 
<h:commandButton onclick="return checkName()" styleClass="submitbutton" action="test" value="Submit" /> 
</h:form>
</body>
</html>
</f:view>

Download code for all examples

                          

» View all related tutorials
Related Tags: c file ide orm text date jsf form internationalization time air button io dates format label numbers vi locale key

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.