Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将引导css文件包括到spring项目jsp文件中_Java_Css_Spring_Twitter Bootstrap_Jsp - Fatal编程技术网

Java 将引导css文件包括到spring项目jsp文件中

Java 将引导css文件包括到spring项目jsp文件中,java,css,spring,twitter-bootstrap,jsp,Java,Css,Spring,Twitter Bootstrap,Jsp,我想将引导css文件添加到我的spring项目中 这是jsp文件,其中应该包括引导css文件 <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <html>

我想将引导css文件添加到我的spring项目中

这是jsp文件,其中应该包括引导css文件

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <html>
    <head>
        <title>Login</title>
    </head>
    <body>
        <h2>Login With Database Application</h2>
        <form:form method="post" action="login" modelAttribute="loginuser">
            <table>
                <tr>
                    <td>Login ID</td>
                    <td><input type="text" name="loginid" id="loginid" path="loginid" /></td>
                </tr>
                <tr>
                    <td>Password</td>
                    <td><input type="password" name="password" id="password" path="password" /></td>
                </tr>
            </table>

            <button class="btn btn-primary"type="submit">Login</button>
            <a href="newuser">New User</a>
        </form:form>
    </body>

登录
使用数据库应用程序登录
登录标识
密码
登录
这是xml配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">

    <context:component-scan base-package="com.epic.logindb.controller"></context:component-scan>
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>


    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/users" />
        <property name="username" value="root" />
        <property name="password" value="" />
    </bean>

    <bean id="userlogin" class="com.epic.logindb.dao.UserLogin"></bean>
    <bean id="loginuser" class="com.epic.logindb.model.LoginUser"></bean>
    <bean id="user" class="com.epic.logindb.model.User"></bean>
    <bean id="edituser" class="com.epic.logindb.model.User"></bean>

</beans>


请帮助将引导文件集成到此jsp文件。

在Spring MVC应用程序中,所有请求都由DispatcherServlet处理,您必须配置一个资源处理程序来处理任何静态资源,如Javascript文件或CSS文件

由于在spring配置xml文件中包含了MVC名称空间,因此可以使用以下标记:

<mvc:resources mapping="/resources/**" location="path/resources/" />
或者不使用JSTL,但请确保您的webapp上下文正确:

<link rel="stylesheet" href="/basecontext/resources/bootstrap/bootstrap.min.css" />

很好:)谢谢,这也应该添加到配置xml文件中。非常感谢
<link rel="stylesheet" href="/basecontext/resources/bootstrap/bootstrap.min.css" />