如题 tomcat启动成功 在外部浏览器可以访问localhost:8080但不能访问项目,内置浏览器都不能访问
web.xml部署
  <servlet>
   <servlet-name>springMvc</servlet-name>
   <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
   <init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>classpath*:SpringMvc.xml</param-value>
   </init-param>
   <!-- 在tomcat启动的时候就加载这个servlet -->
   <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
   <servlet-name>springMvc</servlet-name>
   <url-pattern>*.action</url-pattern>
  </servlet-mapping>
使用的注解
@Controller
public class ItemsController {

@Autowired
private ItemsService itemsService;

@RequestMapping("/list")
public ModelAndView itemsList()throws Exception{
List<Items> list = itemsService.list();
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("itemList", list);
modelAndView.setViewName("itemList");
return modelAndView;
}
}

解决方案 »

  1.   

    你的web.xml里面配没配置欢迎页面
      

  2.   

    我的是idea上部署不能访问,跟你的eclipse问题一模一样,,后来发现是我写的request请求路径需要传值,把值传错了。导致不能访问,把long型传递为01,所以错了。。还有一次是tomcat跟你的java程序版本不兼容,和Tomcat在多个程序中使用导致的,你要不重新下载一个Tomcat,试试。
      

  3.   

    有tomcat的启动日志吗?
      

  4.   

    部署前现在Eclipse里运行一下,看看能不能运行,有没有报错
      

  5.   

    <servlet-mapping>
          <servlet-name>springMvc</servlet-name>
          <url-pattern>*.action</url-pattern>
      </servlet-mapping>
    意思是.action结尾的请求才会被springmvc拦截。
    改成:
    <servlet-mapping>
          <servlet-name>springMvc</servlet-name>
          <url-pattern>/</url-pattern>
      </servlet-mapping>
      

  6.   

    报的试404错误 tomcat版本和spring jdk都调过了
      

  7.   

    1.配置问题 2.url路径输入错误
      

  8.   

    1、配置是*.action,这是过滤,也就是说url中有xxx.action才能访问,才能通过访问
          例如   http://localhost:8080/Test/hello.action
    2、你的配置中没有配置<welcome-file-list>,如果你要直接访问应该要加这个
          例如 <welcome-file-list>
    <welcome-file>index.html</welcome-file>
            </welcome-file-list>
    3、正常访问是http://localhost:端口号/项目名称/   或者 http://localhost:端口号/项目名称/请求名
          http://localhost:端口号/项目名称/             有<welcome-file-list>的情况   例如:http://localhost:8080/Test/
          http://localhost:端口号/项目名称/请求名         例如http://localhost:8080/Test/hello
      

  9.   

    参考下:史上最简单的spring+springMVC+mybaits整合SSM框架~Simple-SSM
      

  10.   

    spring的配置有没有问题?