jboot使用默认的undertow,无法使用renderJsp跳转到jsp页面,报Not Found错误
时间: 2018-11-19来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>>
刚开始尝试使用jboot,现在有个问题,就是用Jboot.start()方式启动后,Controller可以执行,但是renderJsp()时,就会提示Not Found错误。
1. Jboot在IDEA中,启动后,显示,

Controller文件代码如下, import io.jboot.Jboot; import io.jboot.web.controller.JbootController; import io.jboot.web.controller.annotation.RequestMapping; @RequestMapping("/") public class BingLiStart extends JbootController { public void index() { renderJsp("login.html"); } public static void main(String[] args) { Jboot.run(args); } }

目录结构如下图,

Web.xml内容如下: <welcome-file-list> <welcome-file>login.jsp</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>jbootFilter</filter-name> <filter-class>com.jfinal.core.JFinalFilter</filter-class> <init-param> <param-name>configClass</param-name> <param-value>io.jboot.web.JbootAppConfig</param-value> </init-param> </filter> <filter-mapping> <filter-name>jbootFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

login.jsp如下 <%@ page contentType="text/html;charset=UTF-8" language="java" %> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/bootstrap.min.css" /> <link rel="stylesheet" href="css/bootstrap-theme.min.css" /> <title>Main</title> </head> <body> <form action="index.jsp"> <div class="container"> <div style="width:330px;padding-top: 40px;padding-left: 50px;" class="center-block"> <div class="form-group"> <label for="loginTitle"></label> <label class="form-control-static text-center" id="loginTitle"><h3>病例征集运营管理系统</h3></label> </div> <div class="form-group"> <label for="username">用户名</label> <input class="form-control" type="text" id="username" name="username" placeholder="用户名"/> </div> <div class="form-group"> <label for="password">密码</label> <input class="form-control" type="password" id="password" name="password" placeholder="密码" /> </div> <div class="form-group"> <button class="form-control btn btn-primary" value="登录" type="submit" id="submitBtn">登录</button> </div> </div> </div> </form> <!-- JavaScript libs --> <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html>

在BingLiStart中,执行Run main命令后,在浏览器打开http://127.0.0.1:8080后,显示如下图,


请问需要如何设置,才能正确访问jsp文件呢?

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行