Hi,
my
JSP code is
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Person Information</title>
</head>
<body>
<h1>Person Information</h1>
<f:view>
<h:form binding="#{UserBean.form1}" id="form1" >
<p> Name : <h:inputText value="#{UserBean.name}" /></p>
<p> Birthday : <h:inputText value="#{UserBean.birthday}" /></p>
<h:commandButton value="commandButton1"
action="#{UserBean.commandButton1_action}" />
</h:form>
</f:view>
</body>
</html>
MY BEAN code is
/*
* UserBean.java
*
* Created on April 20, 2007, 2:43 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package astrologer.user;
import javax.faces.component.html.HtmlCommandButton;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlInputText;
/**
*
* @author suneelkumarr
*/
public class UserBean {
/** Creates a new instance of UserBean */
public UserBean() {
}
// private
String name;
// private String birthday;
// private String email;
private HtmlForm form1;
private HtmlInputText name;
private HtmlInputText birthday;
private HtmlCommandButton commandButton1;
public void setForm1(HtmlForm form1) {
this.form1 = form1;
}
public HtmlInputText getName() {
return name;
}
public void setName(HtmlInputText name) {
this.name = name;
}
public HtmlInputText getBirthday() {
return birthday;
}
public void setBirthday(HtmlInputText birthday) {
this.birthday = birthday;
}
public HtmlCommandButton getCommandButton1() {
return commandButton1;
}
public void setCommandButton1(HtmlCommandButton commandButton1) {
this.commandButton1 = commandButton1;
}
public String commandButton1_action(){
String user=(String)name.getValue();
String pass=(String)birthday.getValue();
String temp;
System.out.println("**** In side commandButton() ");
if(user.equalsIgnoreCase("test")&&pass.equalsIgnoreCase("test123"))
{
//return "success";
temp="success";
System.out.println("****1*****");
return temp;
}
else
{
// return "failure";
temp="failure";
System.out.println("****2****");
return temp;
}
}
}
When i am running this program i am getting the error like conversion value to null.