0
votes

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. enter image description here

Also I have checked logs for errors, but it doesn't give me any information apart from this enter image description here

So can anyone please help me find out why isn't the app working?

struts-config file enter image description here

4
Can you show us your struts-config file? - ltalhouarne
@BelgianMyWaffle: I have attached it, please take a look - Aarish Ramesh
Post your code as text, not as images. And why are you learning a framework that is officially dead? - JB Nizet
@JBNizet: It says the text is too long to post as a comment. We are using struts in my company so thats why i am beginning to learn it. Is struts officially dead and so no use in learning it? - Aarish Ramesh
@JBNizet: Also i am just beginning out with web development using java. I do not know what should i learn so that i master in web development so can you please guide me in the sense what framework should be learnt? - Aarish Ramesh

4 Answers

1
votes

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
0
votes

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
0
votes

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

0
votes

Try adding apache-commons.jar and servlet-api.jar to your Java build path (Libraries section in Eclipse). It solved my 404 problem.