This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes The requested resource (/Login.do) is not available wiht Tomcat 5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "The requested resource (/Login.do) is not available wiht Tomcat 5.0" Watch "The requested resource (/Login.do) is not available wiht Tomcat 5.0" New topic
Author

The requested resource (/Login.do) is not available wiht Tomcat 5.0

amul shah
Greenhorn

Joined: Mar 28, 2008
Posts: 6
Hi all,

I am new to struts framework. I am creating a sample application. I am getting the following error message. i am using Tomcat 5.0 server

The requested resource (/Login.do) is not available

my files are as follow

Struts-config.xml
===================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>
<action-mappings>
<action path="/Login" type="action.DemoAction" input = "/jsp/common/Login.jsp">
<forward name="Success" path="/jsp/common/Message.jsp">
</forward>
</action>
</action-mappings>
</struts-config>
JPS
========
<html>
<body>
<form name = "LoginForm" action="/Login.do">
UserName<input name="name"><br>
Passwd<input name="passwd"><br>
<input type="submit" value="Go">
</form>
</body>
</html>
ACTION CLASS
================
package com.phr.action;

import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class DemoAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
{
System.out.println("\nExecution Sucess");

// Call the Business Logic
System.out.println("object : ");
System.out.println("Msg : " );
String name = "amul";
//ModelClass model = new ModelClass();
//String retMessage = model.returnMessage(request,response);
request.setAttribute("Message",name);

return(mapping.findForward("Success"));
}
}

After going to the url i am getting that the resource could not be found. i am now totally confuse as why this is not working.

It will be a great help if anyone can pin poing the problem wiht this. I am using the folder structure as follows

e:
Our project
|
-- PHR
|
---JavaSource
|
---
action
|
--- All java Files
|
--WebContent
|
----
jsp
|
---
Common
|
-- All JSP Files
|
WEB-INF
|
----
classes
lib
All XML Files
action
All Java Files
WebContent
Classes
JSP
Common
All JSP Files
WEB-INF
Classes
lib
All the XML Files as well

[ April 19, 2008: Message edited by: amul shah ]
[ April 19, 2008: Message edited by: amul shah ]
Niklas Rosencrantz
Ranch Hand

Joined: Apr 08, 2006
Posts: 49
I believe you need to define a form bean and use the struts html:form tag.
Here are good examples to base your code on: Struts examples
I hope these clarify.
Niklas
[ April 19, 2008: Message edited by: Niklas Rosencrantz ]
amul shah
Greenhorn

Joined: Mar 28, 2008
Posts: 6
Thanks niklas for you advice i will try it and let you know about same.
amul shah
Greenhorn

Joined: Mar 28, 2008
Posts: 6
Hi nikalas,

I tried what ever you said but still i was not able to get the page. Please keep posting some suggesstions.

Thanks
Vilmantas Baranauskas
Ranch Hand

Joined: Dec 20, 2006
Posts: 89
Have you got this part in your web.xml?



Author of <a href="http://www.newsinjector.com" target="_blank" rel="nofollow">NewsInjector</a>
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
One cause of trouble that I can bring to your notice is that, the "type" attribute in the /Login action mapping has a value action.DemoAction whereas, in the source code for the Action class DemoAction, the package is com.phr.action. So I guess, you should change "type" to com.phr.action.DemoAction
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The requested resource (/Login.do) is not available wiht Tomcat 5.0
 
Similar Threads
err: The requested resource (/Login.do) is not available.
problem in struts example
Kindly help me in fixing the bug . error 404
Servlet action is not available
Problem with resource bundle