?
Solved

Struts application status 404

Posted on 2006-05-30
5
Medium Priority
?
947 Views
Last Modified: 2012-06-27
my q is if i am put folder is context path and specify an path name in config-.xml file index page is an jsp file it will coming below
i but it donnt call to ao an action servlet i want solution
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>


<html>
<head><title>Welcome to our website</title></head>
<body>
<html:form action="/login.do">
<table>
<tr>
<td>Enter your Area</td>
<td><html:text property="areaname"/>
<html:submit value="Go"/></td></tr>
</table>
</html:form>
</body>
</html>
@@@@@@@@@@@@@@@@@@@@
<html>
<body>
<table>
<td><tr>
welcome tothe Area of <%=request.getAttribute("AREA") %>
</td><tr>
</table>
</body>
</html>@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
<!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>

    <form-beans>

        <form-bean name="loginform" type="login.loginform"/>
    </form-beans>

    <global-forwards>

        <forward name="failure" path="/strlogin.jsp" redirect="true"/>

    </global-forwards>

    <action-mappings>
              <action path="/login"
                        parameter="/strlogin.jsp"
                        type="org.apache.struts.actions.ForwardAction" />

          
        <action path="/login"
                    type="login.loginaction"
                      name="loginform"
                  scope="request"
                  validate="true"
                  input="/strlogin.jsp">
                <forward name="chennai" path="/welcome.jsp"/>
          </action>

            

    </action-mappings>

    <controller processorClass="org.apache.struts.action.RequestProcessor" />

    <message-resources parameter="struts.example.MessageResources" null="false" />

    <message-resources parameter="struts.example.ImageResources" key="bundle.image" null="false" />

</struts-config>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2222
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app    PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <display-name>Hello World Struts Application</display-name>
<error-page>
     <error-code>404</error-code>
     <location>/index.html</location>
  </error-page>

    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>debug</param-name>
            <param-value>3</param-value>
        </init-param>
            <init-param>
        <param-name>validate</param-name>
        <param-value>true</param-value>
        </init-param>


       
        <load-on-startup>0</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>


    <welcome-file-list>
        <welcome-file>strlogin.jsp</welcome-file>
    </welcome-file-list>

    <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
      


   <!-- <taglib>
        <taglib-uri>/test</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib> -->

    <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    </taglib>

   

</web-app>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

package login;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.Action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class loginform extends ActionForm
{
      
      private String areaname=null;

      public void setareaname (String area)
      {
            areaname=area;
            System.out.println("connected");
      }
   
      public String getareaname()
      {
            return areaname;
      }
      
      public void Reset(ActionMapping mapping,HttpServletRequest request)
      {
            this.areaname=null;
      }
}
 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
package login;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class loginaction extends Action

 {
   
  public ActionForward execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws IOException,ServletException
       {
      String target=null;
      String areaname=null;
        if(form!=null)
             {
          loginform lform=(loginform)form;
            areaname=lform.getareaname();
             if(areaname.equals("chennai"))
                {
                target=new String ("chennai");
                request.setAttribute("AREA",areaname);
                }
                  else
                        {
                     target= new String ("failure");
                     }
             }
                         return (mapping.findForward("target"));
      }
}
giving 404
if i am give
                 http://localhost:/contextpath(ie my folder name)/file name.jsp
 but not call action servlet
0
Comment
Question by:saravananvg
3 Comments
 
LVL 6

Author Comment

by:saravananvg
ID: 16788556
plz now only i learn struts so plz help me
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 16788575
check your logs, there could be an error there that helps point you to whats going wrong
0
 
LVL 5

Expert Comment

by:jpolin1
ID: 16789016
What exactly is your problem/question?

Do you want to put your jsp's in a folder in your web project but you don't know how to reference the jsp's in your struts config?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question