While developing my webapp everything was working fine until when after creating new .xhtml page something went wrong. New page did not render tag`s. Now after trying a restart when I try to deploy my webapp I get the fallowing error "/odczytyEE2.xhtml Not Found in ExternalContext as a Resource".
my login.xhtml
<h:body>
<h:form id="loginForm">
<p:growl id="msg" showDetail="true" life="3000" />
<p:panel header="Login" style="width: 360px; margin-left:35%; margin-right:45%; margin-top:15%">
<h:panelGrid id="loginPanel" columns="2">
<h:outputText value="Username" />
<p:inputText id="username" value="#{login.login}" ></p:inputText>
<p:spacer></p:spacer>
<p:message for="username" ></p:message>
<h:outputText value="Password" />
<p:password id="password" value="#{login.password}" feedback="false"></p:password>
<p:spacer></p:spacer>
<p:message for="password"></p:message>
<p:spacer></p:spacer>
<p:commandButton action="#{login.loginProject}" value="Login" update="loginForm" ajax="true"></p:commandButton>
</h:panelGrid>
</p:panel>
</h:form>
</h:body>
my web.xml
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</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>
</servlet>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{login.theme}</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
and my project structure: ![project structure]: (https://i.stack.imgur.com/e4E8o.jpg)
What can be the reason for this error?
I didnt change anyhting at all, just played with servlet-mapping from *.xhtml to *.jsf etc. Just more errors occured, but when i returned it to be *.xhtml the webapp is deploying welcome-file witch sorce code in firefox is like this:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>login</title>
</h:head>
<h:body>
<h:form id="loginForm">
<p:growl id="msg" showDetail="true" life="3000" />
<p:panel header="Login" style="width: 360px; margin-left:35%; margin-right:45%; margin-top:15%">
<h:panelGrid id="loginPanel" columns="2">
<h:outputText value="Username" />
<p:inputText id="username" value="#{login.login}" ></p:inputText>
<p:spacer></p:spacer>
<p:message for="username" ></p:message>
<h:outputText value="Password" />
<p:password id="password" value="#{login.password}" feedback="false"></p:password>
<p:spacer></p:spacer>
<p:message for="password"></p:message>
<p:spacer></p:spacer>
<p:commandButton action="#{login.loginProject}" value="Login" update="loginForm" ajax="true"></p:commandButton>
</h:panelGrid>
</p:panel>
</h:form>
</h:body>
and in Chrom its html:
<td>Username</td><td><input id="loginForm:username" name="loginForm:username" type="text" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /><script id="loginForm:username_s" type="text/javascript">PrimeFaces.cw("InputText","widget_loginForm_username",{id:"loginForm:username",widgetVar:"widget_loginForm_username"});</script></td></tr>
Any way when I try to log in II get this message: ![unable to find matching navigation case]: (https://i.stack.imgur.com/mh0ob.jpg)
my Login.java:
public class Login implements Serializable {
private static final long serialVersionUID = 1L;
private String password;
private String message;
private String login;
private Object id;
private Object bg_color;
private Object theme = "cupertino";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
@ManagedProperty("#{userDAO}")
private UserDAO session;
public void setSession(UserDAO session)
{
this.session=session;
}
public String loginProject()
{
boolean result = session.login(login, password);
if (result) {
// get Http Session and store username
HttpSession session = Util.getSession();
session.setAttribute("username", login);
//UserView.init(id);
setId(session.getAttribute("id"));
setBg_color(session.getAttribute("bg_color"));
setTheme(session.getAttribute("theme"));
return "home";
} else {
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_WARN,
"Invalid Login!",
"Please Try Again!"));
// invalidate session, and redirect to other pages
//message = "Invalid Login. Please Try Again!";
return "login";
}
}
public String logout() {
HttpSession session = Util.getSession();
session.invalidate();
return "login.xhtml";
}
public Object getId() {
return id;
}
public void setId(Object id) {
this.id = id;
}
public Object getBg_color() {
return bg_color;
}
public void setBg_color(Object bg_color) {
this.bg_color = bg_color;
}
public Object getTheme() {
return theme;
}
public void setTheme(Object theme) {
this.theme = theme;
}
}