Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Http 404, Info.jsp not available

 
Yuta Lolap
Ranch Hand
Posts: 86
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my web.xml file:

<?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_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>DemoStruts</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>


<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>


Struts.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts SYSTEM "struts-2.0.dtd" >


<struts>
<package name="mypack" extends="struts-default">
<action name="LoginAction" class="LoginAction">

<result name="success">/success.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>

</struts>

LoginAction.java //actionclass
package com.actionclass;

public class LoginAction {
String name, pass;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getPass() {
return pass;
}

public void setPass(String pass) {
this.pass = pass;
}

public String execute()
{
if(name.equals("SEED")&&pass.equals("SEED"))
return "success";
else
return "error";

}

}

Info.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="/struts-tags" prefix="s" %>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<s:form action="LoginAction">

<s:textfield name="username" label="username"></s:textfield>
<s:textfield name="password" label="password"></s:textfield>
<s:submit>
</s:submit>
</s:form>

</body>
</html>


Hey guys,
This is the error i am receiving , please can you help me in this i have to complete this practice project in a week!On top of that i am new to struts! Please help!
HTTP Status 404 - /DemoStruts/Info.jsp

--------------------------------------------------------------------------------

type Status report

message /DemoStruts/Info.jsp

description The requested resource (/DemoStruts/Info.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/7.0.28
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try putting info.jsp in welcome file list .
 
Yogesh Lonkar
Ranch Hand
Posts: 94
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one suggestion when posting code use Code tags and there are several mistakes in your struts.xml like class="LoginAction" should be class="yourpackage.LoginAction"

also in Info.jsp the <s:textfield name="username" label="username"> and <s:textfield name="password" label="password"> is wrong because in your action class your getting and setting String name, pass;
so your fields in jsp should be

and from your web.xml i see your application flow is you first start from index.jsp page then>>>> go to Info.jsp here your submit info if success>>> yo go to success.jsp
one more thing in
"/" is unnecessary you can remove themjust success.jsp will be enough if that file is under WebContent
 
Yuta Lolap
Ranch Hand
Posts: 86
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for the above reply. i have done that. I am facing another issues.

My server console says the following:

Aug 26, 2012 6:05:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: Y:\Program Files\Java\jre7\bin;Y:\Windows\Sun\Java\bin;Y:\Windows\system32;Y:\Windows;Y:/Program Files/Java/jre7/bin/client;Y:/Program Files/Java/jre7/bin;Y:/Program Files/Java/jre7/lib/i386;Y:\oraclexe\app\oracle\product\11.2.0\server\bin;;Y:\Windows\system32;Y:\Windows;Y:\Windows\System32\Wbem;Y:\Windows\System32\WindowsPowerShell\v1.0\;Y:\eclipse-jee-indigo-SR2-win32\eclipse;;.
Aug 26, 2012 6:05:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.serveremoStruts' did not find a matching property.
Aug 26, 2012 6:05:18 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-5000
Aug 26, 2012 6:05:18 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 444 ms
Aug 26, 2012 6:05:18 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 26, 2012 6:05:18 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Aug 26, 2012 6:05:19 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
INFO: Parsing configuration file [struts-default.xml]
Aug 26, 2012 6:05:19 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
INFO: Parsing configuration file [struts-plugin.xml]
Aug 26, 2012 6:05:19 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
INFO: Parsing configuration file [struts.xml]
Aug 26, 2012 6:05:19 PM org.apache.struts2.config.Settings getLocale
WARNING: Settings: Could not parse struts.locale setting, substituting default VM locale
Aug 26, 2012 6:05:19 PM com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>
INFO: Setting DefaultObjectTypeDeterminer as default ...
Aug 26, 2012 6:05:19 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-5000
Aug 26, 2012 6:05:19 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 26, 2012 6:05:19 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16 config=null
Aug 26, 2012 6:05:19 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 750 ms
Aug 26, 2012 6:05:22 PM org.apache.struts2.components.Form evaluateExtraParamsServletRequest
WARNING: No configuration found for the specified action: 'loginaction' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
Aug 26, 2012 6:05:22 PM org.apache.struts2.components.Form evaluateExtraParamsServletRequest
WARNING: No configuration found for the specified action: 'loginaction' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
 
Yuta Lolap
Ranch Hand
Posts: 86
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using struts 2.0.14 lib files now. was having issues with struts 2.3.4 lib files. asked me to include java assist lib file. but that did no good.
The action name is loginaction in struts.xml as well as in the login.jsp. still its giving me the above error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic