Reputation: 7023
I am a beginner to web development using struts. I have followed an online tutorial into making a web-app using Struts in Eclipse. The link of the tutorial is
http://www.dzone.com/tutorials/java/struts/struts-tutorial/struts-tutorial-using-eclipse-1.html where the source code is available. When i start the server and run the application , i get 404 page not found error despite i feel like i have done things properly. I have attached the error page i get.
Also I have checked logs for errors, but it doesn't give me any information apart from this
So can anyone please help me find out why isn't the app working?
struts-config file
Upvotes: 0
Views: 2070
Reputation: 29
Try adding apache-commons.jar
and servlet-api.jar
to your Java build path (Libraries section in Eclipse
). It solved my 404 problem.
Upvotes: 0
Reputation: 909
I suggest you to start again calling your project "StrutsExample1" and leaving please WebContent as it is. Follow strictly that tutorial and you will get what you're expecting.
After doing that please use the correct path as suggested by Roman C:
http://localhost:8080/StrutsExample1/helloWorld.do
Also you could use this header in 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"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
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">
if you are using modern containers as Tomcat 7. Let me know, regards
Upvotes: 0
Reputation: 1
You are getting errors 404 if you use /HelloWorld
in the context path of your application. Either you have deployed to the wrong path or this path doesn't exist. Try to remove it from the URL. Also in the tutorial you have mentioned it's not used. The url
http://localhost:8080/StrutsExample1/helloWorld.do
Upvotes: 0
Reputation: 4636
Remove HelloWorlAction.class
and HelloWorldForm.class
.
In struts you just need an action class and form class with a java extension.
So you only need:
HelloWorlAction.java
HelloWorlActionForm.java
Upvotes: 1