aspose file tools*
The moose likes Other Application Frameworks and the fly likes spring 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "spring 404" Watch "spring 404" New topic
Author

spring 404

Abhi Kumar
Greenhorn

Joined: Sep 11, 2008
Posts: 24
Thanks for reading my post ...

I'm new to Springs and I'm trying a small example...

My web.xml

My Welcome File (Login.jsp)


My Controler is


And Finally
My springapp-servlet.xml is

I'm able to see my Welcome(Login.jsp) but when I click on submit button on the Login page I'm unable to go further I get 404 Server error.
I'm creating a poc.war file and accessing it using the url http://localhost:8080/poc

Any advice is of great help ..
Thanks in advance
Regards
Rosco Duncan
Ranch Hand

Joined: Apr 23, 2007
Posts: 41
You are missing the web context from you URL


It should look something like http://localhost:8080/<your app name here>/poc/

Good luck
Rosco Duncan
Ranch Hand

Joined: Apr 23, 2007
Posts: 41
You are missing the web context from you URL


It should look something like http://localhost:8080/{your app name here}/poc/

Good luck
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
Hello Abhi,

Your try is very good.
You should access your application using http://localhost:8080/YourApplicationName/
That's it. As you have configured welcome file in web.xml , it would be directed automatically to login.jsp.
Actuall problem is not with URL, but url-mapping. Look How do you configure your DispatcherServelet, for which kind of url-pattern it would be invoked? And look at action of login.jsp. Again, look at your handler mapping in spring application context file.
Try to figure this out first, come back and tell us how's it going?
Abhi Kumar
Greenhorn

Joined: Sep 11, 2008
Posts: 24

Thanks for your replies
but i have a small query "YourApplicationName/ " is it the name that is given to the DispatcherServlet
i.e in my case "springapp"

Thanks in advance

Rosco Duncan
Ranch Hand

Joined: Apr 23, 2007
Posts: 41
No, by default it is the name given to your war file. So if you are producing MyApplication.war, try navigating to http://localhost:8080/MyApplication/poc

See if that works for you.

Cheers.
Abhi Kumar
Greenhorn

Joined: Sep 11, 2008
Posts: 24
No,I'm creating war file from command prompt using the command
java -jar poc.war *.*
and I'm running this command front of WEB-INF directory(WEB-INF watching me )
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
No, it's not related to Dispatcher Servlet. It would be your war file name i.e. poc.
It seems that you are using Apache Tomcat. You can navigate to Tomcat Manager and you should find your application entry there. Click on that and see what URL comes up.

You can also explicitly Specify you application name using

entry into web.xml.

@Rosco,
http://localhost:8080/MyApplication/poc
I am unable to understand what would be the value of 'MyApplication'?
Rosco Duncan
Ranch Hand

Joined: Apr 23, 2007
Posts: 41
Vishal Pandya wrote:No, it's not related to Dispatcher Servlet. It would be your war file name i.e. poc.
It seems that you are using Apache Tomcat. You can navigate to Tomcat Manager and you should find your application entry there. Click on that and see what URL comes up.

You can also explicitly Specify you application name using

entry into web.xml.

@Rosco,
http://localhost:8080/MyApplication/poc
I am unable to understand what would be the value of 'MyApplication'?


Its just a place holder for whatever the war file has been called. So in this case it is 'poc'

I think it would be worth trying to navigate to the following URL if you want to be picked up by the Dispatcher Servlet, as I suspect the '/poc/*' that it is mapped to will fall within the '/poc' context that the application is running as.

http://localhost:8080/poc/poc

I could be wrong.

Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
Rosco Duncan wrote:I could be wrong.

http://faq.javaranch.com/java/AdmitWhenYouAreGuessing
 
Consider Paul's rocket mass heater.
 
subject: spring 404