Results 1 to 2 of 2
- 01-31-2011, 10:42 AM #1
web app not working HTTP 404 status
Hi Forum
my web app is not working every time i try and run it it come up with the HTTP 404 status
using Tomcat 6.029, eclispe hellios, JSF 2.0
hear is my code
//-------------------------------
web.xml
//-----------------------Java Code:<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <!-- The bare minimum needed for JSF 2.0 is a servlet 2.5 declaration and the mapping for the FacesServlet. Setting PROJECT_STAGE to Development is highly recommended during initial development so that you get more helpful error messages. From JSF 2.0 tutorial at http://www.coreservlets.com/JSF-Tutorial/jsf2/ --> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
faces.config has nothing in it
//--------------------------------------Java Code:<?xml version="1.0"?> <faces-config 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-facesconfig_2_0.xsd" version="2.0"> <!-- Empty for now. Your entries will go here. But even if you have no entries in faces-config.xml, you are required to have a valid faces-config.xml file with legal start and end tags. From JSF 2.0 tutorial at http://www.coreservlets.com/JSF-Tutorial/jsf2/ --> </faces-config>
welcome page
//-------------------------------Java Code:<!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"> <!-- This is the welcome page which displays a button that random select page1,2 or 3 and then display it.--> <h:head><title>Welcome Page</title></h:head> <h:body> <div align="center"> <h2>Press button to return a random page</h2> <h:commandButton value="select random page" action="#{aBasicBean.doNavigation}"/> </div> </h:body> </html>
page1.xhtml
//--------------------------------------Java Code:<!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"> <!-- This is the lst results page which displays words related to the number one in english ,samoan and japanese--> <h:head> </h:head> <h:body> <div align="center"> <table border="5"> <tr><th class="title">Results page 1</th></tr> </table> <p/> <h1>One Tasi ichi</h1> </div> </h:body> </html>
page2.xhtml
//-------------------------------------Java Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com//jsaf/html"> <!-- This is the second results page which displays words related to the number two in english ,samoan and japanese--> <h:head></h:head> <h:body> <div align="center"> <table border="5"> <tr><th class="title">Results page 2</th></tr> </table> <p/> <h1>Two Lua Ni</h1> </div> </h:body> </html>
page3.xhtml
//-----------------------------Java Code:<!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"> <!-- This is the three results page which displays words related to the number three in english ,samoan and japanese--> <h:head></h:head> <h:body> <div align="center"> <table border="5"> <tr><th class="title">Results page 3</th></tr> </table> <p/> <h1>Three Tolu San</h1> </div> </h:body> </html>
index.jsp
//------------------------------Java Code:<% response.sendRedirect("welcome.jsf"); %>
ABasicBean
//--------------------------------------------------Java Code:package aNewPackage; /*a simple backing bean with a method that does my navigation*/ import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean(name="aBasicBean") public class ABasicBean { //private attributes //constructor //class methods public String doNavigation() { String [] results = {"page1","page2","page3"}; return(RandomUtils.randomElement(results)); } //get set methods }//end of bean aBasicBean
class RandomUtils
//------------------------------Java Code:package aNewPackage; /*this class is a utility class it has one method. can add more if you desire*/ public class RandomUtils { /*This method returns randomly selects a single string from an array of String */ public static String randomElement(String [] arrayGiven) { //create local variables String results; int randomNum; //now calculating random number randomNum=(int)Math.random() * (arrayGiven.length - 1); /*now using random num to randomly select a string value so it can be assigned to the results variable then returing it*/ results=arrayGiven[randomNum]; return results; }//end of method randomElement //-------------------------------------------------- }//end of class RandomUtils
why is this error showing up :confused:
any help would be much appreciated and thank you in advance
- 01-31-2011, 03:02 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,608
- Rep Power
- 5
Similar Threads
-
HTTP Status 500 -
By gardiann in forum Java ServletReplies: 2Last Post: 12-26-2010, 12:49 PM -
http status 500
By swathi dharmaraj in forum Java ServletReplies: 4Last Post: 12-14-2010, 04:46 PM -
HTTP Status 500(problem)
By waqar100 in forum NetBeansReplies: 1Last Post: 06-30-2010, 11:54 AM -
HTTP Status 405 - HTTP method GET is not supported by this URL
By javanewbie in forum Java ServletReplies: 7Last Post: 11-11-2009, 08:29 PM -
Http Status 404 - LoginServlet.do
By mbalas2 in forum Java ServletReplies: 4Last Post: 03-05-2009, 05:52 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks