Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSF
Search Coderanch
Advance search
Google search
Register / Login
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSF
Target Unreachable, identifier resolved to null (JSF 2.0)
Dinakar Kas
Ranch Hand
Posts: 34
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
when I run the following code, I get an error "Target Unreachable, identifier user resolved to null". Can you please tell me where I am going wrong?
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"> <style type="text/css"> .inputtext{ width: 120px; height: 15px; font-family: arial,sans-serif; font-weight: normal; } .inputsecret{ width: 120px; height: 15px; } .labeltext{ font-family: arial,sans-serif; font-weight: normal; font-size: medium; font-style: normal; padding-left: 10px; color: #5331dd; } .bodystyle{ background-color: skyblue; } </style> <h:head> <title>Login Page</title> </h:head> <h:body styleClass="bodystyle"> <h:form> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <div style="padding-left: 280px"> <fieldset style="width: 40%"> <legend class="labeltext">Login</legend> <table border="0"> <tr><td class="labeltext"> User Name:</td><td><h:inputText styleClass="inputtext" value="#{user.userName}"/></td></tr> <tr><td class="labeltext">Password :</td><td><h:inputSecret styleClass="inputsecret" value="#{user.password}"/></td></tr> <tr><td colspan="2" style="padding-left: 100px"><h:commandButton action="#{loginaction.validate}" value="Login"/></td></tr> </table> </fieldset> </div> </h:form> </h:body> </html>
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package namedbeans; import java.io.Serializable; import javax.enterprise.context.SessionScoped; import javax.inject.Named; /** * */ @Named("user") @SessionScoped public class Loginbean implements Serializable{ private String userName = ""; private String password = ""; public void setUserName(String userName) { this.userName = userName; } public String getUserName() { return userName; } public void setPassword(String password) { this.password = password; } public String getPassword() { return password; } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package actions; import javax.inject.Named; /** * * / @Named("loginaction") public class LoginAction { public String validate(){ return "success"; } }
<?xml version="1.0"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0"> <navigation-rule> <from-view-id>/login.xhtml</from-view-id> <navigation-case> <from-outcome>success</from-outcome> <to-view-id>/welcome.xhtml</to-view-id> <from-outcome>failure</from-outcome> <to-view-id>/failure.xhtml</to-view-id> </navigation-case> </navigation-rule> </faces-config>
Thanks,
Dinakar
Dinakar Kas
Ranch Hand
Posts: 34
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
I was able to solve it.
JSF
2.0 requires beans.xml in WEB-INF if you use CDI even though it may be empty.
Thanks,
Dinakar.K
We don't have time to be charming! Quick, read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Field display problem
JSF validator problem
problem by getting values from h:form
problem in running a servlet
no error message display for invalid user and password authentication
More...