Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServeletException, PropertyNnotFoundException

 
t kk
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
when I try to run my jsf application I get following error,
javax.servlet.ServletException error testing property 'msg' in bean of type null.

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<f:loadBundle basename="bundle.Messages" var="Message"/>

<html>
<head> <title>Welcome Page</title> </head>

<body>
<f:view>
<h:form>
<h utputText value="Input Your Message" />
<h:inputText value="#{hiberBean.msg}" id="myMsg1"/>
<h:commandButton value="Save" action="#{hiberBean.saveMsg}" />
</h:form>

</f:view>
</body>

</HTML>
package messagebean;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
public class HiberBean
{
private String msg;

public void setMsg(String msg)
{
this.msg = msg;
}

public String getMsg()
{
return this.msg;
}

public String saveMsg()
{
setMsg(msg);
System.out.println(getMsg());

return "finish";

}
}

here are my jsf and beans , bean entry is made in faces-config.xml
Please advise
 
Marius Cloete
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi hope this works

In your bean initialize var "msg" to private String msg = "";
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See my reply here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic