This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am trying to run my first Struts -- using the tutorial "Login" example at http://www.javaranch.com/newsletter/Mar2002/newslettermar2002.jsp#struts There is a MessageResources.properties file that allows for all strings displayed in an application to be defined. Nonetheless, After I entered http://localhost:8080/struts/jsp/LoginView.jsp in the browser address bar, I got HTTP Status 500. I know that the LoginView.jsp file was found; otherwise, I would have gotten HTTP Status 404 -- LoginView file not found error. The problem is that the text provided in the MessageResources.properties file could not be picked up - I think that it is because the Tomcat cannot find the MessageResources.properties file. I have checked MessageResources.properties: 1. name of the file: spelling is correct 2. location of the file: it is in the directory together with all compiled servlet class files; i.e. c:\tomcat\webapps\struts\WEB-INF\classes\test\struts 3. type of the file: the Windows Explorer shows the type of the MessageResources.properties file is a PROPERTIES File The contents of the web.xml file that is in the c:\tomcat\webapps\struts\WEB-INF directory is shown below:
I need your experience in telling what else could go wrong. Please help.
Windows users often forget that Java is picky about capitalization in filenames in cases where Windows itself doesn't care. But it looks like you did all that correctly. I would double-check the log files to see if the 500 error was in fact due to inability to locate the resource and not something else. Also, don't accept Window's affirmation that just because Windows says it's a properties file that it really is. The actual determinant is that the filename ends with ".properties". Since I can't see anything obviously wrong, if none of the above helps, check to make sure that the property name within the properties file is spelled and capitalized exactly as you invoke it in the JSP. Sometimes I find it useful to have someone double-check for me, since I have been known to see what "should" be there and not what actually is there.
An IDE is no substitute for an Intelligent Developer.