eclipse新建WebProject访问主页404错误的解决
1、请求路径不正确,检查请求url是否正确,以ssm框架为例:@Controller@RequestMapping("/login")public class LoginController {@AutowiredUserService userService;@AutowiredSellInfoService sellService;@AutowiredCustomDao customDao;

3、spring -mvc的配置<!-- 配置SpringMVC --> <!-- 1.开启SpringMVC注解模式 --> <!-- 简化配置: (1)自动注册DefaultAnootationHandlerMapping,AnotationMethodHandlerAdapter (2)提供一些列:数据绑定,数字和日期的format @NumberFormat, @DateTimeFormat, xml,json默认读写支持 --> <mvc:annotation-driven />

5、 <!-- 3.配置jsp 显示ViewResolver -颍骈城茇-> <bean class="org.springframework.web.servlet.vi髫潋啜缅ew.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </bean> <!-- 4.扫描web相关的bean --> <context:component-scan base-package="com.soecode.lyf.web" />

7、<!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <!-- 注入数据库连接池 --> <property name="dataSource" ref="dataSource" /> </bean> <!-- 配置基于注解的声明式事务 --> <tx:annotation-driven transaction-manager="transactionManager" />