﻿WEBVTT

1
00:00:01.567 --> 00:00:02.814
<v Narrator>Hey, welcome back.</v>

2
00:00:02.814 --> 00:00:03.956
In this video, we're gonna get

3
00:00:03.956 --> 00:00:06.623
a behind-the-scenes tour of JSF.

4
00:00:08.792 --> 00:00:10.711
We'll cover the following topics.

5
00:00:10.711 --> 00:00:12.573
First off, we'll take a look at the components

6
00:00:12.573 --> 00:00:15.839
of a JSF application, then we'll take a sneak peak

7
00:00:15.839 --> 00:00:18.932
behind the scenes to see how JSF actually works.

8
00:00:18.932 --> 00:00:21.711
Next, we'll discuss the various JSF versions

9
00:00:21.711 --> 00:00:22.852
that are out there,

10
00:00:22.852 --> 00:00:26.729
and finally we'll discuss application support for JSF.

11
00:00:26.729 --> 00:00:28.821
Alright, so we have a lot of stuff in store.

12
00:00:28.821 --> 00:00:32.198
Let's go ahead and get started.

13
00:00:32.198 --> 00:00:34.773
Alright, so what makes up a JSF application

14
00:00:34.773 --> 00:00:38.767
as far as what's required to build a JSF application?

15
00:00:38.767 --> 00:00:41.870
Well, a JSF application is basically a set of web pages

16
00:00:41.870 --> 00:00:43.294
to lay out components.

17
00:00:43.294 --> 00:00:46.520
We'll make use of special JSF technology called Facelets.

18
00:00:46.520 --> 00:00:49.401
And then also a JSF application is composed

19
00:00:49.401 --> 00:00:51.416
of a set of managed beans.

20
00:00:51.416 --> 00:00:53.591
So this is Java code that you'll have in the background

21
00:00:53.591 --> 00:00:56.315
for holding your form data, and also performing

22
00:00:56.315 --> 00:00:59.573
your back-end operations like talking to a database.

23
00:00:59.573 --> 00:01:00.811
Then also, there's an idea

24
00:01:00.811 --> 00:01:03.802
of the web deployment descriptor on your web.xml.

25
00:01:03.802 --> 00:01:06.688
If you've done some web development before with Java,

26
00:01:06.688 --> 00:01:10.640
you may have seen this file before for Servlets and JSPs.

27
00:01:10.640 --> 00:01:13.395
We'll basically put a special configuration in that file

28
00:01:13.395 --> 00:01:16.000
to handle the JSF request.

29
00:01:16.000 --> 00:01:17.591
And then optionally, you can have

30
00:01:17.591 --> 00:01:19.688
some additional application config files,

31
00:01:19.688 --> 00:01:21.844
like the faces-config.xml.

32
00:01:21.844 --> 00:01:24.914
You can drop in some custom objects, components,

33
00:01:24.914 --> 00:01:27.178
custom tags, and validators.

34
00:01:27.178 --> 00:01:29.346
We'll talk about all that stuff later,

35
00:01:29.346 --> 00:01:30.881
but at a very high level,

36
00:01:30.881 --> 00:01:35.048
these are the actual components of a JSF application.

37
00:01:36.634 --> 00:01:39.638
Alright, so how does JSF work behind the scenes?

38
00:01:39.638 --> 00:01:41.855
So we have a user over here, they're on their browser,

39
00:01:41.855 --> 00:01:44.612
they'll submit a request to our application server.

40
00:01:44.612 --> 00:01:47.125
This'll come into our JSF Faces Servlet.

41
00:01:47.125 --> 00:01:50.365
So this Faces Servlet is part of the JSF library.

42
00:01:50.365 --> 00:01:52.467
You, the developer, you don't have to write this Servlet,

43
00:01:52.467 --> 00:01:53.913
it's given to you.

44
00:01:53.913 --> 00:01:57.226
This Faces Servlet handles routing the request

45
00:01:57.226 --> 00:01:59.107
to the appropriate pages.

46
00:01:59.107 --> 00:02:01.477
Now, this Faces Servlet, in the background,

47
00:02:01.477 --> 00:02:04.451
it can read information from the Faces config file.

48
00:02:04.451 --> 00:02:06.822
It can also make use of managed beans.

49
00:02:06.822 --> 00:02:09.110
And these managed beans are basically just beans

50
00:02:09.110 --> 00:02:12.245
that hold form data, or talk to your back-end processes

51
00:02:12.245 --> 00:02:14.335
like maybe a database or something.

52
00:02:14.335 --> 00:02:16.429
Alright, so this Faces Servlet, it'll determine

53
00:02:16.429 --> 00:02:18.284
which page that it needs to rout to,

54
00:02:18.284 --> 00:02:20.524
it'll route it to that appropriate web page.

55
00:02:20.524 --> 00:02:22.681
At the bottom, here, we have xhtml.

56
00:02:22.681 --> 00:02:26.066
This web page can make use of the managed beans, also,

57
00:02:26.066 --> 00:02:29.055
to maybe retrieve information, or display information

58
00:02:29.055 --> 00:02:31.902
from the back-end system, and this web page is rendered

59
00:02:31.902 --> 00:02:34.180
and sent back to the web browser.

60
00:02:34.180 --> 00:02:36.597
So this web page, it could have very basic information

61
00:02:36.597 --> 00:02:40.011
like hey, welcome, and give the user's name.

62
00:02:40.011 --> 00:02:41.935
Or, this webpage could be more sophisticated

63
00:02:41.935 --> 00:02:45.084
where it would display the results of a database query.

64
00:02:45.084 --> 00:02:48.501
But anyway, that's how JSF works at a very high level.

65
00:02:48.501 --> 00:02:51.345
So again, web browser makes the request to the Servlet,

66
00:02:51.345 --> 00:02:53.553
Servlet will route it to the appropriate page,

67
00:02:53.553 --> 00:02:56.386
and the page renders the response.

68
00:03:00.237 --> 00:03:03.052
Alright, so let's talk about the different versions of JSF.

69
00:03:03.052 --> 00:03:04.161
There's a lot of different versions

70
00:03:04.161 --> 00:03:05.100
that are floating out there,

71
00:03:05.100 --> 00:03:07.694
so if you Google for some JSF tutorials,

72
00:03:07.694 --> 00:03:09.974
you may find some outdated information.

73
00:03:09.974 --> 00:03:11.804
So I just wanted to lay out the versions,

74
00:03:11.804 --> 00:03:14.862
and then talk about JSF 2.2.

75
00:03:14.862 --> 00:03:17.402
So, JSF has been around for a long time.

76
00:03:17.402 --> 00:03:20.227
So JSF 1.0 was released in 2004,

77
00:03:20.227 --> 00:03:22.216
so that's ancient days, alright?

78
00:03:22.216 --> 00:03:25.586
Then there was JSF 1.2, that came out in 2006.

79
00:03:25.586 --> 00:03:28.501
JSF 2.0 came out in 2009,

80
00:03:28.501 --> 00:03:31.086
and that was aligned up with the Jave EE 6.

81
00:03:31.086 --> 00:03:34.266
And then most recently, it's JSF 2.2

82
00:03:34.266 --> 00:03:37.494
that was released in 2013, and that's Java EE 7.

83
00:03:37.494 --> 00:03:39.522
So when you look for different information

84
00:03:39.522 --> 00:03:41.314
like books and so on, you wanna make sure

85
00:03:41.314 --> 00:03:44.337
that you're using at least JSF 2.2,

86
00:03:44.337 --> 00:03:46.950
because there was some significant changes between 2.2

87
00:03:46.950 --> 00:03:49.380
and all the previous versions, alright?

88
00:03:49.380 --> 00:03:50.694
Now, you also wanna make sure that you have

89
00:03:50.694 --> 00:03:54.428
an application server that can support JSF 2.2.

90
00:03:54.428 --> 00:03:56.349
So you wanna make sure your app server has support

91
00:03:56.349 --> 00:03:58.349
for Java EE 7 or higher.

92
00:04:00.079 --> 00:04:02.745
Now there's a new version of JSF that's coming out,

93
00:04:02.745 --> 00:04:05.341
I've been checking the different blog posts and so on,

94
00:04:05.341 --> 00:04:09.508
and JSF 2.3 is slated to come out late 2016, early 2017.

95
00:04:13.078 --> 00:04:14.997
So you can kinda think it'll hit mainstream

96
00:04:14.997 --> 00:04:19.164
around the 2017 timeframe, so just a little indicator there.

97
00:04:19.164 --> 00:04:20.932
But you can always go online to Google,

98
00:04:20.932 --> 00:04:24.045
and you can simply say JSF release date,

99
00:04:24.045 --> 00:04:26.231
and you should get the latest hits as far as news reports

100
00:04:26.231 --> 00:04:28.603
on when JSF is coming out.

101
00:04:28.603 --> 00:04:32.436
But anyway, this course will focus on JSF 2.2.

102
00:04:34.565 --> 00:04:37.161
In terms of application server support,

103
00:04:37.161 --> 00:04:40.637
if you make use of a full Java EE 7 server,

104
00:04:40.637 --> 00:04:44.191
then the JSF 2.2 libraries are already included.

105
00:04:44.191 --> 00:04:48.327
So, when I say a Java EE 7 server, some examples include

106
00:04:48.327 --> 00:04:52.212
JBoss Wildfly 8, GlassFish 4, and so on.

107
00:04:52.212 --> 00:04:53.542
So for you to give an app server,

108
00:04:53.542 --> 00:04:58.014
you wanna make sure that it supports Java EE 7 or higher.

109
00:04:58.014 --> 00:04:59.549
Not all of the servers are up to date,

110
00:04:59.549 --> 00:05:01.404
so you wanna make sure you look at the actual specs

111
00:05:01.404 --> 00:05:03.278
for your server accordingly.

112
00:05:03.278 --> 00:05:06.555
But I know out of the box at Wildfly 8 and GlassFish 4

113
00:05:06.555 --> 00:05:09.347
already have full support for Java EE 7,

114
00:05:09.347 --> 00:05:12.874
and so that includes the JSF 2.2 libraries.

115
00:05:12.874 --> 00:05:14.700
So the key thing here is that when you deploy

116
00:05:14.700 --> 00:05:17.225
your JSF application, there's no need to include

117
00:05:17.225 --> 00:05:19.426
the JSF JAR files in your app.

118
00:05:19.426 --> 00:05:23.593
It's already part of those given server environments.

119
00:05:23.593 --> 00:05:27.140
Now, if you wanna deploy a Tomcat 8, you can still do that.

120
00:05:27.140 --> 00:05:28.944
The only thing is that you simply need to add

121
00:05:28.944 --> 00:05:32.891
the JSF libraries, preferably JSF 2.2 or higher.

122
00:05:32.891 --> 00:05:36.071
So that means that you need to bundle the JSF libraries

123
00:05:36.071 --> 00:05:38.322
in your WAR file application.

124
00:05:38.322 --> 00:05:40.130
So in your WEB-INF lib directory,

125
00:05:40.130 --> 00:05:41.896
you'll need to include those JAR files.

126
00:05:41.896 --> 00:05:44.889
I'll show you how to do this in the next video

127
00:05:44.889 --> 00:05:46.515
when we build our Hello World application.

128
00:05:46.515 --> 00:05:48.966
So don't worry if you don't totally understand all of this,

129
00:05:48.966 --> 00:05:51.045
I'll walk through the steps when we go through

130
00:05:51.045 --> 00:05:53.921
our Hello World app and show you which check box

131
00:05:53.921 --> 00:05:56.703
that you need to set up in the Eclipse and Environments

132
00:05:56.703 --> 00:05:58.263
for getting this work in, alright?

133
00:05:58.263 --> 00:06:01.513
But anyway, that's the big thing there.

134
00:06:03.061 --> 00:06:04.930
Alright, so this wraps up the video.

135
00:06:04.930 --> 00:06:07.223
We covered some good items in this video.

136
00:06:07.223 --> 00:06:10.215
We discussed the components of a JSF application.

137
00:06:10.215 --> 00:06:13.505
We also learned how JSF works behind the scenes.

138
00:06:13.505 --> 00:06:16.188
I also have you a discussion of the various JSF versions

139
00:06:16.188 --> 00:06:18.640
that are out there, and then finally we wrapped up

140
00:06:18.640 --> 00:06:22.723
by discussing application server support for JSF.

141
00:06:24.970 --> 00:06:25.909
Stay tuned.

142
00:06:25.909 --> 00:06:28.131
In the next video, we'll actually get our hands dirty.

143
00:06:28.131 --> 00:06:30.709
We'll build a Hello World application with JSF,

144
00:06:30.709 --> 00:06:33.518
and then we'll actually deploy it to our application server.

145
00:06:33.518 --> 00:06:34.685
See you then.

