{"id":286712,"date":"2017-05-23T00:05:03","date_gmt":"2017-05-22T20:05:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=286712"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=286712","title":{"rendered":"JSF 2 + Maven + Jetty. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430"},"content":{"rendered":"<p>\u0421 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e JSF 2 \u0432\u044b\u0448\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 JSF 2.3.0.<br \/>  \u042d\u0442\u043e \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043c\u043e\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b\u043e \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 JavaServer Faces.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h1>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<br \/>  <code>mvn archetype:generate -DinteractiveMode=false -DgroupId=lan.net -DartifactId=habr<\/code><br \/>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 <i>habr<\/i>.<br \/>  \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0430\u043f\u043e\u043a <i>.\/src\/main\/java<\/i> \u0438 <i>.\/src\/test\/java<\/i>.<br \/>  \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c <i>.\/pom.xml<\/i> \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0438\u0434\u0443:  <\/p>\n<pre><code class=\"xml\">&lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/maven-v4_0_0.xsd&quot;&gt;      &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;      &lt;!-- \u041c\u0435\u043d\u044f\u0435\u043c jar \u043d\u0430 war --&gt;     &lt;packaging&gt;war&lt;\/packaging&gt;      &lt;groupId&gt;lan.net&lt;\/groupId&gt;     &lt;artifactId&gt;habr&lt;\/artifactId&gt;     &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;      &lt;name&gt;habr&lt;\/name&gt;     &lt;url&gt;http:\/\/maven.apache.org&lt;\/url&gt;      &lt;dependencies&gt;         &lt;!-- \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c API \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 Jetty. --&gt;         &lt;!-- http:\/\/www.eclipse.org\/jetty\/documentation\/current\/what-jetty-version.html --&gt;         &lt;dependency&gt;             &lt;groupId&gt;javax.servlet&lt;\/groupId&gt;             &lt;artifactId&gt;javax.servlet-api&lt;\/artifactId&gt;             &lt;version&gt;3.1.0&lt;\/version&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;javax.servlet.jsp&lt;\/groupId&gt;             &lt;artifactId&gt;javax.servlet.jsp-api&lt;\/artifactId&gt;             &lt;version&gt;2.3.1&lt;\/version&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;!-- \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f JavaServer Faces 2.3.0 --&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.glassfish&lt;\/groupId&gt;             &lt;artifactId&gt;javax.faces&lt;\/artifactId&gt;             &lt;version&gt;2.3.0&lt;\/version&gt;         &lt;\/dependency&gt;     &lt;\/dependencies&gt;      &lt;build&gt;         &lt;plugins&gt;             &lt;!-- \u041f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. --&gt;             &lt;!-- http:\/\/www.eclipse.org\/jetty\/documentation\/current\/jetty-maven-plugin.html --&gt;             &lt;plugin&gt;                 &lt;groupId&gt;org.eclipse.jetty&lt;\/groupId&gt;                 &lt;artifactId&gt;jetty-maven-plugin&lt;\/artifactId&gt;                 &lt;version&gt;9.4.5.v20170502&lt;\/version&gt;             &lt;\/plugin&gt;         &lt;\/plugins&gt;     &lt;\/build&gt;  &lt;\/project&gt; <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0438 <i>.\/src\/main\/webapp<\/i> \u0438 <i>.\/src\/main\/webapp\/WEB-INF<\/i>.<br \/>  \u0412 \u043f\u0430\u043f\u043a\u0435 <i>.\/src\/main\/webapp\/WEB-INF<\/i> \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b <i>web.xml<\/i>:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;web-app xmlns=&quot;http:\/\/xmlns.jcp.org\/xml\/ns\/javaee&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/xmlns.jcp.org\/xml\/ns\/javaee http:\/\/xmlns.jcp.org\/xml\/ns\/javaee\/web-app_3_1.xsd&quot;          version=&quot;3.1&quot;&gt;     &lt;!-- \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e. --&gt;     &lt;welcome-file-list&gt;         &lt;welcome-file&gt;index.xhtml&lt;\/welcome-file&gt;     &lt;\/welcome-file-list&gt; &lt;\/web-app&gt; <\/code><\/pre>\n<p>  \u0412 \u043f\u0430\u043f\u043a\u0435 <i>.\/src\/main\/webapp<\/i> \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b <i>index.xhtml<\/i>:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot;         &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt;  &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;       xmlns:h=&quot;http:\/\/xmlns.jcp.org\/jsf\/html&quot;&gt;  &lt;h:head&gt;     &lt;title&gt;Title&lt;\/title&gt; &lt;\/h:head&gt;  &lt;h:body&gt;     &lt;p&gt;Session ID: &lt;h:outputText value=&quot;#{session.id}&quot;\/&gt;&lt;\/p&gt; &lt;\/h:body&gt;  &lt;\/html&gt; <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c: <code>mvn jetty:run<\/code><br \/>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c: <code>http:\/\/127.0.0.1:8080\/<\/code><\/p>\n<h4>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f ID \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438.<\/li>\n<li>\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430 Java.<\/li>\n<li>jUnit \u0443\u0434\u0430\u043b\u0435\u043d \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e.<\/li>\n<\/ul>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442\u2026<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/329240\/\"> https:\/\/habrahabr.ru\/post\/329240\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e JSF 2 \u0432\u044b\u0448\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 JSF 2.3.0.<br \/>  \u042d\u0442\u043e \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043c\u043e\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b\u043e \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 JavaServer Faces.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-286712","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/286712","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=286712"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/286712\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=286712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=286712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=286712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}