This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes h:commond button's action does'nt work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "h:commond button Watch "h:commond button New topic

h:commond button's action does'nt work

ron thomas

Joined: Apr 29, 2010
Posts: 3
Hi i am beginner in jsf i am trying to make a login application using JSF 1.2 with tiles,i stuck in commond button's action method,when i hit commond button nth happens can someone please help me out

here is my class file
package app;

import java.sql.SQLException;

import javax.naming.NamingException;

import Dao.Loginacess;

import javax.faces.*;

public class Login
String loginname="";
String password="";

public String getLoginname() {
return loginname;
public void setLoginname(String loginname) {
this.loginname = loginname;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;

public String tp()
return "ttttppp";

public String checkValidUser() throws NamingException,SQLException
System.out.println("in method checkvalid user");

String dbpassword=null;

dbpassword = Loginacess.passwordcheck(loginname);

return "Sucess";
return "fail";
faces config
<?xml version="1.0"?>
<faces-config xmlns=""


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi=""
<servlet-name>Faces Servlet</servlet-name>
<servlet-name>Faces Servlet</servlet-name>
<description>DB Connection</description>
<%@taglib uri="" prefix="f" %>
<%@taglib uri="" prefix="h" %>
<%@taglib uri="" prefix="c" %>
<%@ taglib uri="" prefix="tiles" %>


<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/smartwin/images/newcss.css">
<h:form id="loginform" >
<h:panelGrid columns="2" styleClass="topalign">
<hutputText styleClass="whitefont" value="User Name"/>
<h:inputText id="name" size="15" value="#{login.loginname}" />
<hutputText styleClass="whitefont" value="Password"/>
<h:inputText id="password" size="15" value="#{login.password}"/>
<h:commandButton value="submit" action="#{login.checkValidUser}" styleClass="topalignsub"/>

problem is action="#{login.checkValidUser}" when i hit submit button it does'nt go to checkValidUser method no message in console ,if i try to acess loginname i can but action does'nt work can someone please help

jar files
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
You have not specified any navigation rule in your faces-config.xml.
Hence it will not fire your action method. Please use code tags next time, it makes it easier to read code.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63349

"jsfron ron", please check your private messages for an important administrative matter.

Als, please read: UseCodeTags

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ron thomas

Joined: Apr 29, 2010
Posts: 3
Hi Kavita thanks for your reply,i tried that but it's not working

@bear need full is done
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
Check your logs for any errors and debugging your code should help catch what you are missing
ron thomas

Joined: Apr 29, 2010
Posts: 3
I already checked log is clean ...same code works with JSF 1.1,is there any limitation of jsf 1.2 for tiles ??
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
insert a

in your commandButton and try that, that should work.

I only understand it has to do with the processing lifecycle, by why is it so behind in the lifecycle.

I agree. Here's the link:
subject: h:commond button's action does'nt work
It's not a secret anymore!