From the course: Java EE: JavaServer Faces JSF

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Finish your first JSF page

Finish your first JSF page

From the course: Java EE: JavaServer Faces JSF

Start my 1-month free trial

Finish your first JSF page

- [Instructor] Now, we'll create the sayHello method that will prepare the greeting. Let's go over to line 49 and starting at line 50 we'll have a public void sayHello method that takes no arguments and it just concatenates the supplied user name and the word Hello. So we'll say completedGreeting, that's the field we created earlier, is equal to Hello comma concatenated with the supplied user name, that's the welcomeUserName. Now, let's go back to our XHTML file. In the index.xhtml, we'll make a small change here and add the value attribute to our inputText field. Let's go in there for value, and then, we're typing the pound sign, open braces and closed braces, and then the name we supplied in the at named annotation. That's the welcomePageBean and look, NetBeans has autocompleted that for us. welcomePageBean .welcomeUserName. That's what we'll have in the value attribute. Next, we'll add a button component. So, on the next line, line 13, we'll have an h command button. It's value…

Contents