小编Ant*_*pin的帖子

部署到 Springboot 应用程序后,角度路由不起作用

我已经构建了一个包括 Angluar5 的 Springboot 应用程序。我有一个 gradle 构建脚本,它将角度文件加载到我的 springboot 项目中。这些文件位于我的 springboot 项目的资源/静态下。当我启动我的应用程序时,angular 的路由不再起作用,我得到

错误:无法匹配任何路由。URL 段:'访问'

我的项目结构:

在此处输入图片说明

我使用以下语句部署了我的 angular 应用程序:

ng build --deploy-url=BeatAcknowledgeTest --op=../backend/src/main/resources/static

这将使我的静态文件可以通过以下链接访问:

www.mySite.com/BeatAcknowledgeTest/...

如果我输入

www.mySite.com/BeatAcknowledgeTest/access

页面呈现,一切都很好,但是当我在另一个组件中时,例如

www.mySite.com/BeatAcknowledgeTest/home

然后我点击一个按钮,将我路由到

www.mySite.com/BeatAcknowledgeTest/access

我收到一个错误,我的应用程序没有重定向。

有什么建议?

spring-boot angular angular4-router

6
推荐指数
1
解决办法
3385
查看次数

为什么spring-boot连接到本地mysql服务器?

无法将springboot连接到我的localhost mysql数据库.

这是我的项目结构:

在此输入图像描述

这是错误日志.

在此输入图像描述

奇怪的是他说:"访问被拒绝用户'''localhost'(使用密码:NO)",但是在我的application.properties中我写了连接:

server.port=8080
spring.main.banner-mode=off
spring.thymeleaf.cache=false
spring.freemarker.cache=false
spring.groovy.template.cache=false
spring.datasource.url=jdbc:mysql://localhost:3306/user?autoReconnect=true&useSSL=false
spring.datasource.data-username=root
spring.datasource.data-password=stepin
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
Run Code Online (Sandbox Code Playgroud)

我的build.gradle文件:

buildscript {
ext {
    springBootVersion = '1.4.1.RELEASE'
}
repositories {
    mavenCentral()
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-    plugin:${springBootVersion}")
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'

jar {
    baseName = 'databaseaccess'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('mysql:mysql-connector-java')
    runtime("com.h2database:h2")
    testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)

我是springboot的新手,但我可以连接到我的本地数据库,当我写正常的java连接时,为什么springboot不能?

java mysql spring-boot

5
推荐指数
1
解决办法
1556
查看次数

Spring MVC和Thymeleaf Button禁用更新

我的表单中有两个按钮(第一个和第二个)。现在,我想在单击第一个按钮时更新第二个按钮的禁用功能。

<form action="updateButton" method="post" id="something">
        <h1 th:text="${application.text}"></h1>
        <button type="submit" name="first">First</button>
        <button type="submit" name="second" th:disabled="${model.disabled}">Second</button>
    </form>
Run Code Online (Sandbox Code Playgroud)

我的控制器:

private Boolean disabled = false;

public Boolean getDisabled() {
    return disabled;
}

public void setDisabled(Boolean disabled) {
    this.disabled = disabled;
}
Run Code Online (Sandbox Code Playgroud)

有没有办法将布尔变量与我的第二个按钮绑定,以便该按钮在第一个按钮上启用/禁用onclick?我知道我必须用PostMapping(“ updateButton”)编写一个方法。但是我不知道如何绑定变量。

java spring thymeleaf

3
推荐指数
2
解决办法
1万
查看次数

Angular4 PrimeNG对话框作为组件

我对一个角度/质量问题感到困惑.我是angular4的新手,我试图打开并关闭一个对话框作为一个自己的组件.我有一个list-component,其中datatable加载所有数据.如果单击某行并按下打开按钮,则应打开对话框组件.但是当我关闭对话框并想要重新打开它时,它不起作用.

列表component.html:

<button class="btn btn-default openBtn" type="button" 
    pButton label="Open" [disabled]="jobClosed" (click)="showDialog()">
</button>

<app-details [display]="display"></app-details>
Run Code Online (Sandbox Code Playgroud)

列表component.ts

display: boolean = false;

showDialog() {
    this.display = true;
}
Run Code Online (Sandbox Code Playgroud)

对话框的component.html

<p-dialog [(visible)]="display" modal="modal" [responsive]="true" 
  (onAfterHide)="onClose()">
   <p>Runs!</p>
</p-dialog>
Run Code Online (Sandbox Code Playgroud)

对话框的component.ts

@Input() display: boolean;

onClose(){
    this.display = false;
}
Run Code Online (Sandbox Code Playgroud)

问题是,当我单击按钮时对话框打开,但当我关闭它并想再次打开它时,它不再打开.谁知道为什么?我已经读过,我需要创建一个@Output变量并使用EventEmitter,但我不知道这是否正确以及它是如何工作的.我希望有人知道为什么在我关闭它之后对话框不再重新打开.

primeng angular primeng-dialog

3
推荐指数
1
解决办法
1万
查看次数

PrimeNG Dialog 防止在第一个按钮上自动对焦

我想在打开 PrimeNG 对话框时阻止第一个输入元素的自动对焦。

<p-dialog header="User Details" [(visible)]="displayDialog" 
   [responsive]="true" showEffect="fade"
   [modal]="true" (onAfterHide)="onDialogHide()">
   <p-button icon="fa fa-fw fa-minus"
              label="Delete" class="delete-button">
    </p-button>
</p-dialog>
Run Code Online (Sandbox Code Playgroud)

是否有可能阻止自动对焦?

html primeng angular primeng-dialog

3
推荐指数
1
解决办法
1649
查看次数

从 p:chart 条形图中删除网格和边框

我正在尝试删除素面条形图中的网格和边框。请考虑一下新的 primefaces 图表。我用谷歌搜索了很多,只找到了primefaces旧标签的解决方案,但有新的。

<p:chart type="bar" model="#{reportServerController.horizontalBarModelG}" styleClass="chartSize" >
            <p:ajax event="itemSelect" listener="#{auftragBean.itemSelectGutachten}" update="dataTableG" />
        </p:chart>
Run Code Online (Sandbox Code Playgroud)

那么是否有可能从图表中删除边框和网格呢?

css charts jsf primefaces jsf-2

1
推荐指数
1
解决办法
3155
查看次数

PrimeNG 删除数据表的一行

我在从p-datatable.

TS

public files: UploadFile[] = [];
deleteAttachement(index) {

    if (this.files.length > 0) {
        for(let file2 of this.files) {
            if (file2.fileEntry.isFile) {
                const fileEntry = file2.fileEntry as FileSystemFileEntry;
                fileEntry.file((file: File) => {
                    console.log("-------------");
                    console.log("File: "+file.name);
                });
            }
        }

        this.files.splice(index, 1);

        for(let file2 of this.files) {
            if (file2.fileEntry.isFile) {
                const fileEntry = file2.fileEntry as FileSystemFileEntry;
                fileEntry.file((file: File) => {
                    console.log("_______________");
                    console.log("File: "+file.name);
                });
            }
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

HTML

<p-dataTable [value]="files" *ngIf="files.length > 0">
<p-column>
  <ng-template let-index="rowIndex" pTemplate type="body">
    <p-button …
Run Code Online (Sandbox Code Playgroud)

typescript primeng angular primeng-datatable

0
推荐指数
1
解决办法
4940
查看次数