Thymeleaf模板无法访问,这是我的配置文件吗?

时间:2018-09-20 19:09:33

标签: java thymeleaf

有人知道为什么会抛出以下错误吗?

org.thymeleaf.exceptions.TemplateInputException:解决模板“ directBind”时出错,模板可能不存在或任何已配置的模板解析器都无法访问。

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd“>     4.0.0

<groupId>com.Oli</groupId>
<artifactId>ResourceWebsite</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>OliAffiliatePortal</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-activemq</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>nz.net.ultraq.thymeleaf</groupId>
        <artifactId>thymeleaf-layout-dialect</artifactId>
        <version>1.3.3</version>
    </dependency>
    <dependency>
        <groupId>org.thymeleaf.extras</groupId>
        <artifactId>thymeleaf-extras-springsecurity4</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>6.1.0.jre8</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-mail</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>3.2.8.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.metawidget.modules</groupId>
        <artifactId>metawidget-all</artifactId>
        <version>2.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
    </dependency>

    <dependency>
        <groupId>org.thymeleaf.extras</groupId>
        <artifactId>thymeleaf-extras-java8time</artifactId>
        <version>2.1.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-ldap</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.security.kerberos</groupId>
        <artifactId>spring-security-kerberos-web</artifactId>
        <version>1.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.github.dblock.waffle</groupId>
        <artifactId>waffle-spring-security3</artifactId>
        <version>1.8.0</version>
    </dependency>

    <!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
        <!--<scope>provided</scope>-->
    <!--</dependency>-->
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <executable>true</executable>
            </configuration>
        </plugin>
    </plugins>
</build>

这是我的视图文件

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="fragments/layout" th:with="currentPage='directBind'">
<head>
    <title>DirectBind</title>
    <link th:replace="fragments/header :: head"/>
    <style>
        .list-inline {
          padding-left: 0;
          margin-left: -5px;
          list-style: none;
        }
        select {
            display: block;
        }
        .list-inline > li {
          display: inline-block;
          padding-right: 5px;
          padding-left: 5px;
        }
        .container h4, p{
            color:white;
            font-weight:100;
        }
        body{
            font-size: 1em;

        }
        .inputBtn{
            padding: 0 1rem;
        }
    </style>
</head>
<body>
<div  class="container" layout:fragment="content">
    <br/>
    <h4 >AMS360 &amp; PMA Data Checklist</h4>

    <form  th:action="@{/directBind}" method="post" style="padding:0 10px;">
        <h4>Customer Setup</h4>
        <div class="row">
            <label for="contactName">Contact Name (First/Last):</label>
            <input type="text" id="contactName" name="*{contactName}" />
        </div>
        <div class="row">
            <label for="formAddress">Address:</label>
            <input type="text" id="formAddress" name="*{formAddress}" />
        </div>
        <div class="row">
            <label for="phoneNumber">Phone Number:</label>
            <input type="text" id="phoneNumber" name="*{phoneNumber}" />
        </div>
        <div class="row">
            <label for="custEmail">Email:</label>
            <input type="custEmail" id="custEmail" name="*{custEmail}"/>
        </div>
        <div class="row">
            <label for="website"> Website:</label>
            <input type="text" id="website" name="*{website}" />
        </div>
        <div class="row">
            <label for="nameInsured">Name Insured:</label>
            <input type="text" id="nameInsured" name="*{insuredName}" />
        </div>
        <div class="row">
            <label for="businessAgencyList" class="col-sm-6 col-xs-4 text-right">Business with Agency (check all that apply):</label>
            <ul id="businessAgencyList">
                <li>
                    <input type="checkbox" id="personal" name="*{personal}" />
                    <label for="personal">Personal</label>
                </li>
                <li>
                    <input type="checkbox" id="commercial" name="*{commercial}"/>
                    <label for="commercial">Commercial</label>
                </li>
                <li>
                    <input type="checkbox" id="life" name="*{life}" />
                    <label for="life">Life</label>
                </li>
                <li>
                    <input type="checkbox" id="benefits" name="*{benefits}" />
                    <label for="benefits">Benefits</label>
                </li>
                <li>
                    <input type="checkbox" id="health" name="*{health}"/>
                    <label for="health">Health</label>
                </li>
                <li>
                    <input type="checkbox" id="nonPC" name="*{nonPC}" />
                    <label for="nonPC">Non P &amp; C</label>
                </li>
            </ul>
        </div>
        <div class="row">
            <label for="executive">Executive:</label>
            <input type="text" id="executive" name="*{executive}" />
        </div>
        <div class="row" style="display: inline-block;">
            <p>Service Level:</p>
            <ul>
                <li>
                    <input type="checkbox" id="serviceLevel" name="*{serviceLevel}" />
                    <label for="serviceLevel"> Affiliate Serviced</label>
                </li>
            </ul>
        </div>
        <div class="row">
            <label for="affiliateRep">Affiliate Designated Representative:</label>
            <input type="text" id="affiliateRep" name="*{affiliateRep}" />
        </div>

        <h4>AMS360 Policy Setup</h4>
        <div class="row">
            <label for="policyNumber">Policy Number:</label>
            <input type="text" id="policyNumber"  name="*{policyNumber}" />
        </div>
        <div class="row">
            <label for="policyTermDates">Policy Term Dates:</label>
            <input type="text" id="policyTermDates" name="*{policyTermDates}" />
        </div>
        <div class="row">
            <label for="lineOfCoverage">Line of Coverage:</label>
            <input type="text" id="lineOfCoverage" name="*{lineOfCoverage}" />
        </div>
        <div class="row">
            <label for="parentCompany">Parent Company:</label>
            <input type="text" id="parentCompany" name="*{parentCompany}" />
        </div>
        <div class="row">
            <label for="writingCompany">Writing Company:</label>
            <input type="text" id="writingCompany" name="*{writingCompany}" />
        </div>
        <div class="row">
            <p>Bill Type:</p>
            <ul class="billTypeOptions">
                <li>
                    <input type="checkbox" id="directBill" name="*{directBill}" onclick="return true;"/>
                    <label for="directBill">Direct Bill</label>
                </li>
                <li>
                    <input type="checkbox" id="agencyBill" name="*{agencyBill}" onclick="return true;"/>
                    <label for="agencyBill">Agency Bill</label>
                </li>
            </ul>
        </div>
        <div class="row">
            <label for="quotePremium">Quote Premium:</label>
            <input type="text" id="quotePremium" name="*{quotePremium}" />
        </div>
        <div class="row">
            <label for="commission">Commission:</label>
            <input type="text" id="commission" name="*{commission}" />
        </div>
        <!-- add option for user to add another input line -->
        <div id="parentElement" class="row text-right">
            <label>Add Another Line</label>
            <button onClick="addInput()" name="addInputLine" class="btn btn-default inputBtn" ><span class="fa fa-plus"></span></button>
        </div>

        <h4>PMA Setup</h4>
        <div class="row">
            <label for="subBrand">Sub Brand:</label>
            <input type="text" id="subBrand" name="*{subBrand}" />
        </div>
        <!-- Business Class Drop Down Field Below: -->
        <div class="row">
            <label for="businessClass" >Business Class: </label>
            <select class="select-2 form-control" field="*{businessClass}" id="businessClass" >
                    <option value="animalServices">Animal Services</option>
                    <option value="artsEntertainment">Arts &amp; Entertainment</option>
                    <option value="autoServices">Auto Services</option>
                    <option value="bonds">Bonds</option>
                    <option value="carpetFurnitureUpholsteryCleaning">Carpet, furniture or upholstery cleaning</option>
                    <option value="clockMakingRepair">Clock Making/Repair</option>
                    <option value="contractorApplianceInstallRepair">Contractor - Appliance Install/Repair</option>
                    <option value="contractorCarpentryExterior">Contractor - Carpentry (Exterior)</option>
                    <option value="contractorCarpentryInterior">Contractor - Carpentry (Interior)</option>
                    <option value="contractorConcreteNoFoundations">Contractor - Concrete (No Foundations)</option>
                    <option value="contractorDebrisRemoval">Contractor - Debris Removal</option>
                    <option value="contractorDoorsWindows">Contractor - Doors &amp; Windows</option>
                    <option value="contractorDrywallPlasteringStucco">Contractor - Drywall/Plastering /Stucco</option>
                    <option value="contractorElectrical">Contractor - Electrical</option>
                    <option value="contractorExcavating">Contractor - Excavating</option>
                    <option value="contractorFenceInstallation/Repair">Contractor - Fence Installation/Repair</option>
                    <option value="contractorFloorCovering ">Contractor - Floor Covering (Not tile or stone)</option>
                    <option value="contractorGeneralBuilderNew Construction">Contractor - General/Builder/New Construction</option>
                    <option value="contractorGlassInstallRepair">Contractor - Glass Install/Repair (Non-Auto)</option>
                    <option value="contractorGradingSnow Removal ">Contractor - Grading/Snow Removal </option>
                    <option value="contractorHandymanRemodeling">Contractor - Handyman/Remodeling</option>
                    <option value="contractorHeatingAir">Contractor - Heating &amp; Air</option>
                    <option value="contractorInteriorFinish Work">Contractor - Interior Finish Work</option>
                    <option value="contractorMasonry">Contractor - Masonry</option>
                    <option value="contractorOther">Contractor - Other</option>
                    <option value="contractorPaintingExterior">Contractor - Painting (Exterior)</option>
                    <option value="contractorPaintingInterior">Contractor - Painting (Interior)</option>
                    <option value="contractorPaintingIntExt">Contractor - Painting (Interior/Exterior)</option>
                    <option value="contractorPaving">Contractor - Paving</option>
                    <option value="contractorPlumbingCommercial">Contractor - Plumbing (Commercial)</option>
                    <option value="contractorPlumbingResidential">Contractor - Plumbing (residential)</option>
                    <option value="contractorPlumbingResidentialCommercial">Contractor - Plumbing (Residential/Commercial)</option>
                    <option value="contractorSidingGutterInstall">Contractor - Siding &amp; Gutter Install</option>
                    <option value="contractorTileStoneMarbleMosaicTerrazzo">Contractor - Tile/Stone/Marble/Mosaic/Terrazzo</option>
                    <option value="daycare">Daycares</option>
                    <option value="domesticWorkers">Domestic Workers</option>
                    <option value="educationalServices">Educational Services</option>
                    <option value="farm">Farm</option>
                    <option value="foodBeverage">Food &amp; Beverage</option>
                    <option value="genericBOPPackage">Generic BOP/Package (GL/Property)</option>
                    <option value="homecare">Homecare</option>
                    <option value="homeownersAssociation">Homeowners Association</option>
                    <option value="hotelMotel">Hotel/Motel</option>
                    <option value="janitorial">Janitorial</option>
                    <option value="landscaping">Landscaping</option>
                    <option value="lessorsRisk">Lessors Risk</option>
                    <option value="lifeScience">Life Science</option>
                    <option value="locksmith">Locksmith</option>
                    <option value="manufacturing">Manufacturing</option>
                    <option value="medicalServices">Medical Services</option>
                    <option value="miscellaneousServices">Miscellaneous Services (Not Construction Related)</option>
                    <option value="nonProfit">Non-Profit</option>
                    <option value="other">Other</option>
                    <option value="personalLinesNonCommercial">Personal Lines (Non-Commercial)</option>
                    <option value="personalServicesWellness">Personal Services (Beauty, Wellness, Etc.)</option>
                    <option value="personalTrainers">Personal Trainers/Fitness Instructors/Yoga Instructors</option>
                    <option value="photographyVideography">Photography/Videography</option>
                    <option value="professionalServices">Professional Services</option>
                    <option value="religiousOrganizations">Religious Organizations</option>
                    <option value="retailWholesale">Retail/Wholesale</option>
                    <option value="securityFirms">Security Firms (Including Private Investigators)</option>
                    <option value="signPaintingLetteringExt">Sign painting/lettering (Exterior)</option>
                    <option value="signPaintingLetteringInt">Sign painting/lettering (Interior)</option>
                    <option value="solarEnergy">Solar energy</option>
                    <option value="sportsRecreationLeisure">Sports/Recreation/Leisure (Other than Fitness &amp; Trainers)</option>
                    <option value="storageFacilities">Storage Facilities</option>
                    <option value="technology">Technology</option>
                    <option value="truckingTransportation">Trucking/Transportation</option>
                    <option value="upholsteryWork">Upholstery Work</option>
                    <option value="windowCleaning">Window Cleaning</option>
                    <option value="workersCompensation">Workers Compensation</option>
                    </select>


        </div>
        <div class="row">
            <label for="descriptionOfOps">Description of Operations:</label>
            <input type="text" id="descriptionOfOps" name="*{descriptionOfOps}" />
        </div>
        <div class="formFooter">
           <input id="submitFormButton"  type="submit" value="Send" name="save" class="btn btn-success finish" data-loading-text="Saved!"/>
        </div>
    </form>

  <div class="ui segment">
    <div class="ui container">
        <div th:if="${param.sentMessageFail}">
            <div class="ui warning message">
                <i class="close icon"></i>
                <div class="header">
                    Oops, your message failed to send, please try again.
                </div>
            </div>
        </div>
        </div>
        <div th:if="${param.sentMessage}">
            <div class="ui positive message">
                <i class="close icon"></i>
                <div class="header">
                    Thank you for your message!
                </div>
                <p>We'll get back to you as soon as we can.</p>
            </div>
        </div>
  </div>
<script>
    function addInput(){
        event.preventDefault();
        var node = document.createElement("input");
        $(node).addAttribute(name="${addtlLn}")
        $(node).appendTo('#parentElement');
    }
</script>

</div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

尝试重建您的项目。我回滚了POM文件并重建了项目,该错误消失了。