• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

How to use dynamic file as welcome-file-list in web.xml

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have configured my web.xml file as this,

<web-app>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</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>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.jsf</welcome-file>
</welcome-file-list>
</web-app>

and my login.xhtml file as this,
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:f="http://java.sun.com/jsf/core">
<body>
<f:view>
<h:form>
UserName:<h:inputText id="userName"
value="#{bean.userName}" rendered="true"
required="true"/>
Password:<h:inputText id="password"
value="#{bean.password}" rendered="true"
required="true"/>
<h:commandButton id="submit" value="Submit" action="#{bean.authenticate}" />

</h:form>
</f:view>
</body>
</html>


but when i deploy this using tomcat and try to put url as this,
http://localhost:8080/project

Its not identifying welcome file from web.xml
I am getting error like this,
The requested resource (/project/) is not available.
 
vinutha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to resolve this,

Thanks,
Vinutha.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by vinutha ml:
I have configured my web.xml file as this,

<web-app>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</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>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.jsf</welcome-file>
</welcome-file-list>
</web-app>

and my login.xhtml file as this,
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:f="http://java.sun.com/jsf/core">
<body>
<f:view>
<h:form>
UserName:<h:inputText id="userName"
value="#{bean.userName}" rendered="true"
required="true"/>
Password:<h:inputText id="password"
value="#{bean.password}" rendered="true"
required="true"/>
<h:commandButton id="submit" value="Submit" action="#{bean.authenticate}" />

</h:form>
</f:view>
</body>
</html>


but when i deploy this using tomcat and try to put url as this,
http://localhost:8080/project

Its not identifying welcome file from web.xml
I am getting error like this,
The requested resource (/project/) is not available.



Vinutha the problem is that the file login.jsf doesn�t exist. The solution to your problem is to create a login.jsp an the only thing you have to do is to put <jsp:forward page="login.jsf"/> and change your web.xml with this <welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
I hope this help.
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!