Home Jsf Netbeans Creating Login Page In JSF using NetBeans
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Creating Login Page In JSF using NetBeans

Advertisement
This example illustrates you how to create a login form in JSF using NetBeans.

Creating Login Page In JSF using NetBeans

        

This example illustrates you how to create a login form in JSF using NetBeans. To create the jsp page in NetBeans:

1. Right click on Web Pages under your project.
2. Go to New- JSP and click.
3. Enter JSP File Name (login, for this example) when New JSP File window appear.
4. Click Finish. Then the page will be created and listed as below:

 

Write your code for login. In this example, login.jsp is created. The code is given below:

Source Code of login.jsp

<%-- 
  Document : login
  Created on : Sep 10, 2008, 1:45:52 PM
  Author : sandeep kumar suman
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
 <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Login Page</title>
  </head>
  <body>
  <f:view>
  <h:form id="LoginForm">
  <h:panelGrid id="lpg" columns="2">
  
  <h:outputText value="User ID"/>
  <h:inputText size="25"/>  
  <h:outputText value=""/>
  <h:commandButton value="Login"/>
  
  </h:panelGrid>
  </h:form>
  </f:view>
 </body>
</html>

 

Description of all tags which is used in this program:

<f: view>
  tag is used to create top level view and is a container for all JSF component tags on a page.
<h:form> tag creates html form.
<h:panelGrid> tag creates html table with specified number of columns.
<h:outputText> tag is used for creating component for displaying formatted output as text.
<h:inputText> tag is used to creates  text input control (single line).

Run the program just by right click on login.jsp page and select run. The following output will be displayed on browser:


Download Source Code

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 10, 2009

Ask Questions?    Discuss: Creating Login Page In JSF using NetBeans   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
jsf newbie
June 8, 2011
got HTTP Status 500

I Simply Got This Error HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message descriptionThe server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: java.lang.NullPointerException root cause java.lang.NullPointerException note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1 logs. -------------------------------------------------------------------------------- GlassFish Server Open Source Edition 3.1
chalani
July 1, 2011
about jsp(all of)

this is very nice.can u mail me jsp example?
anusha
July 5, 2011
program to view customer profile

can you please tell me how to write program to view customer profile using jsp.
amit srivastava
February 27, 2012
sourec code

dear I m working on a project that is Online trading System by using netbeans.But i have some problem in database, when i click on submit in login page it not fecth value from db. Althought i put jar file of oracle 10g in lib of my project and also in java plateform. Can u give me any solution as soon as possible
DMCA.com