I'm looking to determine which jars I should be looking for and where I should include them to solve this issue - I currently have none in my WEB-INF/lib folder and have been told that WebSphere comes with the functionality for JSF already, however, I return no errors and get just a blank page on rendering (no other resolutions of this nature have been found in my multi-day search - if this is marked as duplicate again, I will delete and just add in jars all over in an attempt to fix :) )
ENVIRONMENT AND EXPERIENCE:
I've just recently come off my first real Development project, and we worked with Websphere 8.5, Oracle DB, and MyEclipse Blue (IBM) - in an attempt to mirror this environment at home, I've added the free dev/trial versions of all 3 tools.
SUCCESSES AND GOAL:
I'm working with a pluralsite tutorial for JEE - I was very overwhelmed throughout the project in regards to configuration, but have made some progress on understanding the basics of JAR/EAR/WAR/Library/.xml config files/etc so I think I can speak accurately about what I'm attempting and should hopefully have a clear disconnect between what I know and what I don't - and hopefully where my issue resides.
In this tutorial, we construct a Data-Access Objects (DAOs), Data-Access Implementations, and a front-end developed with Apache's MyFaces 2.0.
ISSUE:
I am struggling to get the JSFs to work for me, and I think it may be a JAR issue, as that has been my main issue in the past.
WEB.XML
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>ListManagerWeb</display-name>
<welcome-file-list>
<welcome-file>faces/login.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<enabled>true</enabled>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<context-param>
<param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name>
<param-value>true</param-value>
</context-param>
<resource-ref>
<res-ref-name>jdbc/OracleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
Login.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Login - List Manager</title>
<meta name="keywords" content="enter,your,keywords,here" />
<meta name="description" content="A short description of this page." />
<meta name="content-type" content="text/html; charset=UTF-8" />
<h:outputStylesheet library="css" name="login.css" />
</h:head>
<h:body>
<div>
<h:form styleClass="login-form">
<div>
<h:outputText value="Username" />
</div>
<div>
<h:inputText value="#{userBean.username}" />
</div>
<div>
<h:commandButton styleClass="button" value="Login"
action="#{loginController.login}" />
</div>
</h:form>
</div>
</h:body>
login.css (all commented out)
/* .login-container {
position: absolute;
top: 50%;
margin-top: -4.5rem;
left: 0;
width: 100%;
padding: 2rem 0 2rem 0;
background-color: #f5f5f5;
}
.login-container .login-form {
width: 20rem;
margin: 0 auto;
height: 5.5rem;
}
.login-container .login-form div {
height: 1.5rem;
width: 20rem;
} */
LoginController (@managed bean)
package com.pluralsight.listmanager.web.controller;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import org.pluralsite.listmanager.model.User;
import org.pluralsite.listmanager.service.UserService;
import org.pluralsite.listmanager.service.impl.UserServiceImpl;
import com.pluralsight.listmanager.web.model.UserBean;
@ManagedBean
@RequestScoped
public class LoginController {
private final UserService userService;
@ManagedProperty("#{userBean}")
private UserBean userBean;
public LoginController() {
userService = new UserServiceImpl();
}
public String login() {
String outcome = null; //next page
User user = userService.authenticateUser(userBean.getUsername());
if (user != null) {
outcome = "list?faces-redirect=true";
}
return outcome;
}
public void setUserbean(UserBean userBean) {
this.userBean = userBean;
}
}
Output when I hit the site, after successful deploy and server start, in chrome OR IE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" data-genuitec="wc2-2-18">
<h:head>
<title data-genuitec="wc2-2-20">Login - List Manager</title>
<meta name="keywords" content="enter,your,keywords,here" data-genuitec="wc2-2-21"/>
<meta name="description" content="A short description of this page." data-genuitec="wc2-2-22"/>
<meta name="content-type" content="text/html; charset=UTF-8" data-genuitec="wc2-2-23"/>
<h:outputStylesheet library="css" name="login.css" />
</h:head>
<h:body>
<div data-genuitec="wc2-2-25">
<h:form styleClass="login-form">
<div data-genuitec="wc2-2-27">
<h:outputText value="Username" />
</div>
<div data-genuitec="wc2-2-28">
<h:inputText value="#{userBean.username}" />
</div>
<div data-genuitec="wc2-2-29">
<h:commandButton styleClass="button" value="Login"
action="#{loginController.login}" />
</div>
</h:form>
</div>
</h:body>
</html>
(EDIT 1) I access my site via the following URL: "http://localhost:9080/ListManagerWeb/"
Results after using the servlet-mapping value of "*.xhtml":
1) if I use http://localhost:9080/ListManagerWeb/ i get "JSPG0036E: Failed to find resource /faces/login.jsp"
2) if I use http://localhost:9080/ListManagerWeb/faces/login.xhtml I get "JSPG0036E: Failed to find resource /faces/login.jsp"
3) if I use http://localhost:9080/ListManagerWeb/login.xhtml I get "JSPG0036E: Failed to find resource /faces/login.jsp"
Results after using the servlet-mapping value of "/faces/*":
1) if I use http://localhost:9080/ListManagerWeb/ I get blank rendering
2) if I use http://localhost:9080/ListManagerWeb/faces/login.xhtml I get blank rendering
3) if I use http://localhost:9080/ListManagerWeb/login.xhtml I get blank rendering