小编Gre*_*reg的帖子

使用ui-sref-active ="active"如何使用li clearfix元素设置悬停状态等于活动状态

我在一行上创建了2个按钮,并且使用我正在使用的模板正确设置样式有一些问题.

该按钮有4种状态,但当客户端处于活动状态时会出错.

第一个状态是没有任何事情发生.

在此输入图像描述

第二个状态是+符号处于活动状态或处于悬停状态

在此输入图像描述

在第三个状态,当我将鼠标悬停在客户端上时,我得到了:这是正常的.

在此输入图像描述

但是当客户端处于活动状态时,我会得到与没有活动时相同的结果.那么我能做些什么来使活动状态等于图3中的悬停状态.

在此输入图像描述

html是这样的:

    <li  ui-sref-active="active" class="clearfix li-button"> <a class="btn btn-primary-li-left" ui-sref="app.clients"  ripple=""><em class="sidebar-item-icon icon-head"></em> Clients  </a> <a  class="btn btn-primary-li-right "  ui-sref="app.addclient" >+</a>  </li>
Run Code Online (Sandbox Code Playgroud)

我使用app.html作为模板,我有这个:

<aside ng-include="'html/main/templates/sidebar.html'" ng-class="app.theme.sidebar"></aside>
Run Code Online (Sandbox Code Playgroud)

app.theme.sidebar类==#bg-white

我添加的CSS是没有模板的情况下工作:

.li-button  a{
    float:left;
    display: block;
}

.li-button  a:first-child{
    width: 77%;
}

.li-button  a:last-child{
    width: 15%;
    margin-left: 2%;
    margin-right: 2%;
    color: #ffffff;

}

.btn-primary-li-left {
    text-align: left;
    vertical-align: middle;

    font-weight: 900;
    height: 40px;
}

.btn-primary-li-right {
    height: 40px;
    text-align: center;
    vertical-align: middle;

    font-weight: 900;
}


.li-button  a:last-child:hover { …
Run Code Online (Sandbox Code Playgroud)

html css url-routing angularjs

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

在spring-boot应用程序中进行慢速单元测试

我还是单元测试的新手.我开始读一本关于它的书.但最重要的一点是,测试必须是第一个(快速,隔离,可重复,自我验证,及时).

好的,现在我已准备好进行一些练习.但是当我在春季靴子中构建单元测试时.我喜欢让他们分开.

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = UnitTestApplication.class, loader = SpringApplicationContextLoader.class)
@WebIntegrationTest("server.port:9000")
public class FirstTestClassTest{

    ...

}


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = UnitTestApplication.class, loader = SpringApplicationContextLoader.class)
@WebIntegrationTest("server.port:9001")
public class SecondTestClassTest{

    ...

}
Run Code Online (Sandbox Code Playgroud)

这给我的问题是,对于每个测试类,都有一个新的实例启动了应用程序.

所以,假设我介绍了一个新功能,并希望测试bug.我在命令行中使用mvn test.然后运行所有测试,但我认为通过大量测试的实际应用程序需要很长时间.

我有一种方法,只有一个实例启动并保持测试快速但我可以在不同的类中保持测试?

java spring unit-testing maven

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

如何通过jpa spring找出电子邮件是否已经存在并向前端发送一些错误消息

所以我有一个简单的 UsersDao

public interface UserDao extends JpaRepository<User, Long> {

}
Run Code Online (Sandbox Code Playgroud)

在我的用户控制器中,我想做这样的事情:

@RequestMapping(value = "/register",method = RequestMethod.POST)
public void addUser(@RequestBody User user) {

    //How do i check if user already exist with email instead of id
    // i managed to do this but can i search on something else than the id
    User user1 = userDao.findOne(1);

    if (user.getEmail().equals(user1.getEmail()))
    {

        // And how should i give one error to the front end if the email 
       //already exist I'm using angular js

    } …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa spring-mvc

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

在哪里存储(Spring Boot)Java AWS 程序的 RSA 私钥

所以我有一个 Java (Spring Boot) 应用程序,我在其中使用了 Amazon 的 RSA 密钥。目前这是.pem格式并存储在我的项目中的本地文件夹中。

但是,当我将应用程序部署到 Web (AWS) 时,我应该在哪里存储它:

  • 可以以其他格式存储它并最好在 application.properties 中使用它吗?

  • 我可以使用 RSA 密钥作为字符串还是它总是来自文件?

*或者我是否需要将其存储在服务器中的安全位置,它会在哪里以及它的安全性如何?

  • 我还有其他选择吗?

java rsa amazon-web-services spring-boot

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

我如何同时使用org.joda.time.LocalDate和java.time.LocalDate;

我正在练习如何处理日期。但是当我想使用 javafx 日期选择器时我陷入了困境。因为它只适用于 java.time.LocalDate 我正在尝试这样的事情。

    // here i import java.time.LocalDate to get the date from the datepicker;

    LocalDate dueDate = datepickerInvoiceDueDate.getValue();  
    int year = dueDate.getYear();
    int month = dueDate.getMonthValue();
    int day = dueDate.getDayOfMonth();

    //but here i want to import org.joda.time.LocalDate;

    LocalDate dueDatejt = new LocalDate(year, month, day);
Run Code Online (Sandbox Code Playgroud)

有解决方法吗?是否可以将Localdate(joda时间)存储在mysql数据库中?

我找到了一个临时解决方案,但我认为这不是正确的方法?

    java.time.LocalDate dueDate = datepickerInvoiceDueDate.getValue();  
    int year = dueDate.getYear();

    int month = dueDate.getMonthValue();
    int day = dueDate.getDayOfMonth();
    //import org.joda.time.LocalDate;
    LocalDate dueDatejt = new LocalDate(year, month, day);
Run Code Online (Sandbox Code Playgroud)

java javafx jodatime

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

_blank被阻止弹出我怎么能阻止这个?

我使用时在服务器上创建了一个pdf:

        function GetPdf(document) {


            //Stores the data and creates the html,pdf file
            $http.post('createpdf/', document).success(function(data){

                console.log(data.filename);

                window.open('download2/'+data.filename+".pdf", "_self");


            });
Run Code Online (Sandbox Code Playgroud)

我在谷歌浏览器中弹出了阻止弹出的错误消息.当我使用该网站的选项启用弹出窗口时,一切正常.有没有办法解决 ?因为这可能会让一些用户感到困惑.

但是当我使用时:

window.open('download2/'+data.filename+".pdf", "_self");
Run Code Online (Sandbox Code Playgroud)

它打开页面没有警告,但然后主应用程序被pdf取代,这不是我想要的结果.

html javascript html5 popup

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

google api 刷新令牌使用 react-google-login 返回 null

刷新令牌始终为空,我翻阅了文档并进行了大量实验。但是我无法获得 refreshToken 来更新访问令牌以供离线使用。

我正在使用 react-google-login 来获取我的离线令牌。我认为这是正确设置的。

以防万一这里是设置:

    <GoogleLogin
        clientId="***"
        buttonText="Login"
        accessType="offline"
        responseType="code"
        scope={"https://www.googleapis.com/auth/calendar"}
        onSuccess={responseGoogle}
        onFailure={responseGoogle}
    />
Run Code Online (Sandbox Code Playgroud)

但是当我使用授权码时,只返回一个有效期为 3600 秒的访问令牌。我可以使用 accessToken 访问 api。但似乎没有提供刷新令牌。

    GoogleTokenResponse tokenResponse =
            new GoogleAuthorizationCodeTokenRequest(
                    new NetHttpTransport(),
                    JacksonFactory.getDefaultInstance(),
                    "https://www.googleapis.com/oauth2/v4/token",
                    clientSecrets.getDetails().getClientId(),
                    clientSecrets.getDetails().getClientSecret(),
                    AUTH_CODE,
                    REDIRECT_URL)
                    .execute();



    String refreshToken = tokenResponse.getRefreshToken();
    String accessToken = tokenResponse.getAccessToken();
Run Code Online (Sandbox Code Playgroud)

任何线索出了什么问题?

javascript java google-api

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

Intellij如何使用spring boot正确配置hql.现在我得到持久性QL查询被错误检查

所以我试图使用hibernate和jpa的自定义查询

@Transactional
public interface EstimateOptionsDao extends JpaRepository<EstimateOptions, Integer> {

    @Query("from estimateOptions options inner join options.company company inner join company.user user where user.name = :userName\n")
    EstimateOptions EstimateOptions(String userName);

}
Run Code Online (Sandbox Code Playgroud)

但是EstimateOptions给了我以下错误:

Can't resolve symbol 'EstimateOptions' less... (Ctrl+F1) 
This inspection controls whether the Persistence QL Queries are error-checked
Run Code Online (Sandbox Code Playgroud)

所以我发现这篇文章为什么Hibernate查询在IntelliJ中有编译错误?.

所以我添加了一个方面来测试这个:

现在我有这样的hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="connection.url"/>
    <property name="connection.driver_class"/>
    <property name="connection.username"/>
    <property name="connection.password"/>
    <!-- DB schema will be updated if needed …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa intellij-idea

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

我应该用setter创建一个构造函数

每次我创建一个新类我都想知道创建构造函数的最佳方法是什么.如果我使用IntelliJ中的默认构造函数,它将创建一个像示例A的构造函数.但在学校我们学会使用方法B.

A和B之间有一些很大的区别吗?

是否有一些首选方式或只是程序员的选择?

例A:

public Model(int modelNumber) {
    this.modelNumber = modelNumber;
}
Run Code Online (Sandbox Code Playgroud)

例B

public Model(int modelNumber) {
    setModelNumber(modelNumber);

}

public void setModelNumber(int modelNumber) {
    this.modelNumber = modelNumber;
}
Run Code Online (Sandbox Code Playgroud)

java oop

2
推荐指数
2
解决办法
136
查看次数

tomcat 服务器上的 Intellij Web 应用程序显示 http://localhost:8080/index.jsp 而不是 http://localhost:8080/myapp/index.jsp

我正在学习 udemy 上的教程。在教程中他使用的是 eclipse。但我正在关注 intellij 的课程。每件事都工作正常,但我一直注意到的一件事是,当他运行 servlet 或 jsp 页面时,它总是在 servlet 之前显示项目名称(http://localhost:8080/myapp/index.jsp)。但是当我在 intellij 上创建一个 Web 应用程序时,它只显示 http://localhost:8080/index.jsp

那么问题是如何获取/index.jsp之前的项目名称。

我尝试将其添加到 web.xml 文件中,但它似乎不起作用

<display-name>myApp</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
Run Code Online (Sandbox Code Playgroud)

java jsp tomcat servlets intellij-idea

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

无法使用ng-model ="vm.client.salutation"设置未定义的属性"称呼"

我在为custom指令分配一个默认值时遇到了一些麻烦:如果我这样做:vm.client= 'Dhr.';然后将ng模型更改为ng-model="vm.client"它可以工作.但我想如果我使用ng-model="vm.client.salutation"它不起作用.任何想法为什么会发生这种情况?

<div ng-controller="AddClientController as vm">
    <form name="form_addClient" ng-submit="vm.add()">

    <div class="row">
        <!-- salutation -->
        <div class="col-md-4">

  <bootstrap-dropdown  ng-model="vm.client.salutation" data-placeholder="Aanhef" data-dropdown-data="servicesData.listOfServiceNames"></bootstrap-dropdown>

            </div>
        </div>

....
Run Code Online (Sandbox Code Playgroud)

这是我的控制器:

(function () {
    'use strict';

    angular
        .module('app')
        .controller('AddClientController', AddClientController);

    AddClientController.$inject = ['ClientService', '$location', '$scope' ];
    function AddClientController(ClientService, $location, $scope) {

        var vm = this;

        vm.add = add;

        $scope.form = {};

        vm.client.salutation = 'Dhr.';

        $scope.servicesData = {
            listOfServiceNames : [
                "Mevrouw",
                "Mw.",
                "Dhr.",
                "Dr.",
                "Heer"
            ]
        }

        function add() {
            console.log("add …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

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