Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Simple Login faces  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I want to create a very simple and basic login screen

Username : Textbox

Password : Textbox

Submit. on submit i want to show the welcome below the submit and make Username and Password textboxes as un editable.

Can you please help me ..i am very new to jsf. I am able to get the values displayed in next page but not below the sbumit button of the same page.

Thanks in advance

Kalam.
 
chandra chatterjee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Code

jsf

%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<tutputText value="Username" />
<t:inputText value="#{loginBean.name}" />
<tutputText value="Password"/>
<h:inputSecret value="#{loginBean.pass}"></h:inputSecret>
<h:commandButton value="Submit" >
</h:commandButton>
<hutputText value = "#{loginBean.name}" />
</h:form>
</f:view>
</body>
</html>


Bean



public class LoginBean {

public String name;
public String pass;


public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}


public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}

Error


description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Base is null: loginBean
javax.faces.webapp.FacesServlet.service(FacesServlet.java:218)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)


root cause

javax.faces.el.PropertyNotFoundException: Base is null: loginBean
org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:463)
org.apache.myfaces.el.ValueBindingImpl.getType(ValueBindingImpl.java:175)
org.apache.myfaces.shared_tomahawk.renderkit._SharedRendererUtils.findUIOutputConverter(_SharedRendererUtils.java:58)
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.findUIOutputConverter(RendererUtils.java:311)
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getConvertedUIOutputValue(RendererUtils.java:606)
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTextRendererBase.getConvertedValue(HtmlTextRendererBase.java:191)
javax.faces.component.UIInput.getConvertedValue(UIInput.java:733)
javax.faces.component.UIInput.validate(UIInput.java:658)
javax.faces.component.UIInput.executeValidate(UIInput.java:869)
javax.faces.component.UIInput.processValidators(UIInput.java:432)
javax.faces.component.UIForm.processValidators(UIForm.java:190)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:932)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:362)
org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:32)
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you added your LoginBean in Faces-config.xml
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!