java - HTTP Status 404 - /CarFind_SearchTool/index.jsp -


higuys,
i'm running first real project in java.
i'm building simple site cars online.
car seacrh find tool stressing me extreme. have learn't mvc - struts using eclipse in order write code. 'what i'm writing (code) index page (index.jsp), couple of select tags (populated drop down list), when selected returns 'make; model; modification....' in view.jsp (results/view page). have struts.xml , web x.ml shown below, in eclipse ide when right click on project (carfind searchtool) >> export >> war file browse tomcat 7.0/webapps/root , save .war file/project.
when try run via url or via eclipse ide receive message. please can , me know how sort out whole mess.

http status 404 - /carfind_searchtool/index.jsp  type status report message /carfind_searchtool/index.jsp description requested resource not available.  apache tomcat/7.0.50 

there no console message displayed, however.

project mvc: struts2

applications : eclipse ide, javaee, tomcat 7, mysql command line

project folder: carfind searchtool

struts.jar files added .jar files struts 2 folder web-inf/lib of project

welcome file: index.jsp

view / result file view.jsp

configuration files: struts.xml , web.xml

actionclass: carseacrh.java

database cars - table type

catalina c:\program files\apache software foundation\tomcat 7.0

classpath: c:\users\denis\workspace\carfind searchtool\webcontent\web-inf\lib;c:\program files\struts-2.3.16.1\lib;c:\program files\mysql\connector j 5.1.28\mysql-connector-java-5.1.28-bin;c:\program files\apache software foundation\tomcat 7.0\lib\jsp-api;c:\glassfish3\jdk\jre\lib

java_home: c:\glassfish3\jdk

path: c:\program files\common files\microsoft shared\windows live;c:\program files\mysql\mysql server 5.6\bin;c:\glassfish3\jdk\bin;c:\program files\apache software foundation\tomcat 7.0\bin;c:\program files\mysql\mysql utilities 1.3.6\;c:\program files\windows live\shared

index.jsp

<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en"             "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>find favorite car.</title> </head> <body> <h1>all cars finance</h1> <s:form action="hello" namespace="/"> <h4> <s:select label="make" headerkey="-1" headervalue="select car make" list="makelist"     name="yourcarmake" value="defaultcarmake"/> </h4> <h4> <s:select label="model" headerkey="-1" headervalue="select car model" list="modellist"     name="yourcarmodel" value="2"/> </h4> <h4> <s:select label="modification" headerkey="-1" headervalue="select car model"      list="modificationlist" name="yourcarmodification" value="2"/> </h4> <h4> <s:select label="engine" headerkey="-1" headervalue="select car engine"         list="enginelist" name="yourcarengine" value="2"/> </h4> <h4> <s:select label="color" headerkey="-1" headervalue="select car color" list="colorlist"     name="yourcarcolor" value="2"/> </h4> <h4> <s:select label="bodytype" headerkey="-1" headervalue="select car body type"     list="bodytypelist" name="yourcarbodytype" value="2"/> </h4> <h4> <s:select label="minprice" headerkey="-1" headervalue="select car minimum price"     list="minimumpricelist" name="yourcarminimumprice" value="2"/> </h4> <h4> <s:select label="model" headerkey="-1" headervalue="select car model" list="modellist"    name="yourcarmodel" value="2"/></h4> </s:form> </body> </html>  

view.jsp

<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib prefix="s"  uri="/struts-tags" %>  <!doctype html public "-//w3c//dtd html 4.01 transitional//en"     "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>car search results</title> </head> <body> <h4>   car make search result : <s:property value="make"/> </h4>   <h4>   car model search result : <s:property value="model"/> </h4>    <h4>    car modification  search result : <s:property value="modification"/>  </h4>   <h4>   car engine  search result : <s:property value="engine"/> </h4>  <h4>   car color  search result : <s:property value="color"/>  </h4>    <h4>     car body type  search result : <s:property value="bodytype"/ </h4>   <h4>   car minimum price  search result : <s:property value="minprice"/> </h4>   <h4>   car maximum price  search result : <s:property value="maxprice"/> </h4>   <h4>   car mileage  search result : <s:property value="mileage"/> </h4>   <h4>   car minimum year  search result : <s:property value="minyear"/> </h4>    <h4>   car maximum year  search result : <s:property value="maxyear"/> </h4>  </body> </html> 

struts.xml

<?xml version="1.0" encoding="utf-8"?> <!doctype struts publc "-//apache software foundation//dtd struts configuration 2.0//en" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devmode" value="true" /> <package name="helloworld" extends="struts-default"> <action name="hello"     class="drive.carsearch"     method="execute">     <result name="success">/view.jsp</result>     </action> </package> </struts> 

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"     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">   <display-name>carfind searchtool</display-name>   <welcome-file-list>     <welcome-file>index.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> 

carsearch.java

package drive;  import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset;  import com.opensymphony.xwork2.actionsupport;  public class carsearch extends actionsupport {      /**      *       */     private static final long serialversionuid = 1l;     private string make;     private string model;     private string modification;     private string engine;     private string color;     private string bodytype;     private string minprice;     private string maxprice;     private string mileage;     private int minyear;     private int maxyear;       public string execute () {         string ret = none;         connection conn = null;          try {             string url = "jdbc:mysql://localhost/cars";             class.forname("com.mysql.jdbc.driver");             conn = drivermanager.getconnection(url, "root", "$jademedia247");             string sql = "select make type where";             sql+=" model = ? , modification = ? ";             preparedstatement ps = conn.preparestatement (sql);             ps.setstring(1, model);             ps.setstring(2, modification);             resultset rs = ps.executequery();              while (rs.next()){                 make = rs.getstring(1);                 ret = success;             }         } catch (exception e) {             ret = error;         } {              if (conn != null) {                 try {                     conn.close();                 } catch (exception e) {                 }             }     }     return ret; }  public string getmake() {     return make; } public void setmake(string make){     this.make = make; }  public string getmodel() {     return model; }  public void setmodel(string model) {     this.model = model; }  public string getmodification() {     return modification; }  public void setmodification (string modification) {      this.modification = modification; }  public string getengine() {     return engine; }  public void setengine (string engine) {     this.engine = engine; }  public string getcolor() {     return color; }  public void setcolor (string color) {     this.color = color; }  public string getbodytype() {     return bodytype; }  public void setbodytype(string bodytype) {     this.bodytype = bodytype; }  public string getminprice() {     return minprice; }  public void setminprice(string minprice) {     this.minprice = minprice; }  public string getmaxprice () {     return maxprice; }  public void setmaxprice (string maxprice) {     this.maxprice = maxprice;  }   public string getmileage () {     return mileage; }  public void setmileage (string mileage) {     this.mileage = mileage ; }  public int getminyear() {     return minyear; } public void setminyear(int minyear) {     this.minyear = minyear; }  public int getmaxyear() {     return maxyear; } public void setmaxyear(int maxyear) {     this.maxyear = maxyear; }   }  c:\program files\struts-2.3.16.1\lib c:\program files\apache software foundation\tomcat 7.0\webapps\root\carfindsearchtool.war c:\users\denis\workspace\carfindsearchtool\webcontent\carfindsearchtool c:\program files\apache software foundation\tomcat 7.0\webapps\carfindsearchtool.war;c:\users\denis\workspace\carfindsearchtool\webcontent\web-inf\lib;c:\program files\struts-2.3.16.1\lib;c:\program files\mysql\connector j 5.1.28\mysql-connector-java-5.1.28-bin;c:\program files\apache software foundation\tomcat 7.0\lib\jsp-api;c:\glassfish3\jdk\jre\lib 


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -