小白请教下关于ssh的问题,卡一天了
目前正在学ssh,按照教程敲代码相关的包也引入了,web.xml struts.xml等等需要的文件也要教程弄了,但是启动tomcat不报错,输入地址却出现HTTP Status 404 – Not Found
Type Status Report
Message /Spring_Registration_5/register.jsp
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
按百度的教程找了一天了都没解决
这应该是日志的错误
[06/Jan/2018:22:41:11 +0800] "GET / HTTP/1.1" 200 11452
0:0:0:0:0:0:0:1 - - [06/Jan/2018:22:41:18 +0800] "GET /Spring_Registration_5/register.jsp HTTP/1.1" 404 1112
0:0:0:0:0:0:0:1 - - [06/Jan/2018:22:41:18 +0800] "GET /favicon.ico HTTP/1.1" 200 21630
0:0:0:0:0:0:0:1 - - [06/Jan/2018:22:41:20 +0800] "GET /Spring_Registration_5/register.jsp HTTP/1.1" 404 1112
0:0:0:0:0:0:0:1 - - [06/Jan/2018:22:41:20 +0800] "GET /favicon.ico HTTP/1.1" 200 21630
0:0:0:0:0:0:0:1 - - [06/Jan/2018:22:41:21 +0800] "GET /Spring_Registration_5/register.jsp HTTP/1.1" 404 1112
0:0:0:0:0:0:0:1 - - [06/Jan/2018:22:41:21 +0800] "GET /favicon.ico HTTP/1.1" 200 21630
视频教程是马士兵的比较早了不知道相关配置是否影响到了,代码我都是照着敲的
这是web.xml的代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
这是hibernate.cfg.xml配置
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/spring</property> //这里localhost有黄色下划线提示说localhost不正确,不懂什么意思
<property name="connection.username">root</property>
<property name="connection.password">admin</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!--
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:SXT</property>
<property name="connection.username">scott</property>
<property name="connection.password">tiger</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
-->
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- Drop and re-create the database schema on startup
<property name="hbm2ddl.auto">update</property>
-->
<mapping class="com.bjsxt.registration.model.User"/>
</session-factory>
</hibernate-configuration>
这是struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="registration" extends="struts-default">
<action name="user" class="com.bjsxt.registration.action.UserAction">
<result name="success">/registerSuccess.jsp</result>
<result name="fail">/registerFail.jsp</result>
</action>
</package>
</struts>
代码基本都是按照教程来的应该都不会错了,不知道是否是配置问题,麻烦大神帮小弟看一下