0

I am new to Jsf and just creating a helloworld example

But I am getting null values in my backing bean can you guys help me out

Here is my backing bean
package practice.backingbeans;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;

import javax.faces.bean.ViewScoped;

@ManagedBean
@ViewScoped

public class Helloworld implements Serializable {

    private String firstname;
    private String lastname;

public Helloworld()
{

}

    public String getFirstname() {
        System.out.println(firstname+"****************************");
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }


}

And Here is my xhtml

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html">

<h:head>

    <title>Hello world</title>
</h:head>
<h:body>
    <h:form>

  FirstName:<h:inputText id="fname" value="#{helloworld.firstname}" /><br></br><br></br>
  LastName:<h:inputText id="lname" value="#{helloworld.lastname}" /><br></br><br></br>

<h:commandButton value="Submit" action="success" />     
</h:form>
    </h:body>
</html>

previously when i am getting viewrestored exception I have added these few lines in my web.xml and my exception got resolved but i am facing error:mac did not verify in my console

<context-param>
   <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
   <param-value>true</param-value>
</context-param>

can you guys help me out????

ramu
  • 1
  • 1
  • javax.faces.application.ViewExpiredException: View could not be restored I have tried all the solutions but couldnt get the exact solution can you guys help me out – ramu Apr 01 '16 at 03:20
  • In fact, your question is very broad. *Nothing* in your question gives a clue as to the real cause. The duplicate explains exactly when and why a `ViewExpiredException` will be thrown. Based on lessons learnt from the duplicate, you must be able to naildown the cause. Finally just reframe the question to ask how to solve that cause. – BalusC Apr 01 '16 at 07:42

0 Answers0