JSP无法识别样式表

时间:2018-03-18 21:28:53

标签: html css jsp

我有一个主页风格正确的主页jsp。在底部,我有一个按钮,可以将您带到另一个JSP。这个JSP似乎没有响应任何CSS样式。我在每个页面上都有相同的布局,我想要基本相同的样式,第二页的工作方式与第一页的工作方式不同;是什么赋予了 ?我也尝试在两个页面上粘贴相同的样式表,但问题是相同的,第一页的样式是第二页不是。是否与链接到的第二页有关?

谢谢!

编辑:您应该知道文件位于正确的文件夹中,所有css文件都在css文件夹中,如上所述,这两个页面位于Web应用程序的基础目录中。

第1页:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Flash Card Shark!</title>
        <link href="css/jquery-ui.css" rel="stylesheet" />
        <link href="css/HomeScreenCustomSheet.css" rel="stylesheet" />        
    </head>

    <body>
        <h1>Brave the Treacherous Waters</h1>
        <div class="centerLoginScreen">

            <form action="${pageContext.request.contextPath}/Home" method="POST">
                <p>username: <input type="text" name="username" class="username"/></p>
                <p>password: <input type="pass" name="password" class="username" /></p>
                <p><input type="submit" value="submit" id="loginbutton" class="buttons" /></p>
            </form>
            <div class="buttons">
                <p><a href="registrationPage.jsp"><button id="registerbutton">Register a new account</button></a>
            </div>  
        </div>

        <script src="js/homescreen.js"></script>

    </body>
</html>

第1页的样式表,这个工作原理:

.centerLoginScreen {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* Yep! */
    width: 48%;
    height: 59%;
    display: inline-block;
    text-align: center;
    background-color: #ADD8E6;
}

input {
    text-align: center;
    position: relative;
    width: 300px;
    margin: auto;
}

.buttons {
    text-align: center;
    position: relative;
    width: max-content;
    width: 300px;
    margin: auto;
}

第2页:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Welcome To Flash Card Shark</title>
        <link href="css/registrationPageCustomSheet.css" rel="stylsheet" />
    </head>

    <body>
        <div class="centerRegistrationScreen">
            <form action="registrationPage.jsp" method="POST">

                <p>username: <input type="text" name="username"/></p>
                <p>password: <input type="text" name="password"/></p>
                <p>First Name: <input type="text" name="firstname" /></p>
                <p>Last Name: <input type="text" name="lastname" /></p>
                <p>Email: <input type="text" name="email" /></p>
                <p><input type="submit" name="submit" /></p>

                <sql:setDataSource dataSource="jdbc/FlashCardShark" url="jdbc:derby://localhost:1527/FlashCards"
                                       driver="org.apache.derby.jdbc.ClientDriver" user="maxbisesi"
                                       password="Basketball12"
                                       var="registerDB" />

                <sql:update dataSource="${registerDB}">
                    Insert into FlashUser(username,password,firstname,lastname,email) values(?,?,?,?,?)
                    <sql:param value="${param.username}"/>
                    <sql:param value="${param.password}"/>
                    <sql:param value="${param.firstname}"/>
                    <sql:param value="${param.lastname}"/>
                    <sql:param value="${param.email}" />
                </sql:update>

            </form>
        </div>

    </body>

第2页的

样式表,对此表单的更改不执行任何操作:

.centerRegistrationScreen {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* Yep! */
    width: 48%;
    height: 59%;
    display: inline-block;
    text-align: center;
    background-color: #ADD8E6;
}

input {
    text-align: center;
    position: relative;
    width: 300px;
    margin: auto;
}

1 个答案:

答案 0 :(得分:2)

尝试这样的事情

    QCompleter *completer = new QCompleter(wordList);
    ...
    completer->setProperty("row", i);
    completer->setProperty("column", i);

void MainWindow::onActivated(const QString &text)
{
    QCompleter *completer = static_cast<QCompleter *>(sender());
    qDebug()<< completer->property("row").toInt()<<completer->property("column").toInt()<<text;    
}

       O_RDONLY        open for reading only
       O_WRONLY        open for writing only
       ...