小编exc*_*ion的帖子

Java,怪异的switch语句行为

通过一些编程任务(第一年)拖网,我想出了这个.当我运行它时,程序直接转到switch语句的默认值.现在已经连续24小时了,所以我几乎察觉不到,但我发现什么都不对.

任何人都可以指出我的写作方向.我不希望你为我做这件事

// Practical 5B - Question 1
// Nathan Griffin
// 28/02/2013
// Program to simulate a continuos system of deposits and withdraw for a bank account until user exits.

import java.util.Scanner;
public class SingleAccountSim
{
    public static void main(String [] args)
    {
        Scanner keyboardIn = new Scanner(System.in);

        BankAccount account = new BankAccount();

        int menuSelect = 0;
        double depositIn, withdrawalOut;



        do
        {
            System.out.println("*_*_*Monopoly Bank*_*_*");
            System.out.println("1. Deposit money");
            System.out.println("2. Withdraw money");
            System.out.println("3. Get balance");
            System.out.println("4. Quit");

            menuSelect = keyboardIn.nextInt();

            switch(menuSelect) …
Run Code Online (Sandbox Code Playgroud)

java switch-statement

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

带锚标签的VueJS @click

我有一个带有侧导航栏的单页面应用程序,它在列表中有一组锚标记.

我想根据selectedPage变量的值显示页面中显示的内容.以及selectedPage根据侧栏中单击的链接更改值.

即使在click事件中包含.prevent,下面的代码也不会更改变量的值.我应该使用另一种情况吗?

myPage.html下

#Navbar for selecting content
<div id="sidebar-wrapper">
      <ul class="sidebar-nav">
        <li><a href="#" @click.prevent="selectedPage ='Foo'">Foo</a></li>
        <li><a href="#" @click.prevent="selectedPage ='Bar'">Bar</a></li>
      </ul>
</div>

#Page content
<div id="page-content-wrapper">
 <div class="main-content" id="app" v-cloak>

  <div class="container-fluid" v-if="selectedPage === 'Foo'">
   <h3 class="page-title">{{selectedPage}}</h3>
  </div>

  <div class="container-fluid" v-if="selectedPage === 'Bar'">
   <h3 class="page-title">{{selectedPage}}</h3>
  </div>
 </div>
</div>
Run Code Online (Sandbox Code Playgroud)

App.js

new Vue({
  el: '#app',
  data: {
    selectedPage: 'Foo',
  }
})
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuejs2

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

Spring Boot/Spring LDAP获取用户成员列表

我想通过从如下结构的LDAP存储库查询其ID来获取用户属性的列表

dn: uid=E000001 ,ou=People,o=Company,o=Internal
cn: BOB DOLE
statusid: active
memberof: cn=foo_group, cn=Foos, ou=Groups, o=Company,o=Internal
memberof: cn=bar_group, cn=Foos, ou=Groups, o=Company,o=Internal

dn: uid=E000002 ,ou=People,o=Company,o=Internal
cn: MARK TEST
statusid: active
memberof: cn=foo_group, cn=Foos, ou=Groups, o=Company,o=Internal
memberof: cn=bar_group, cn=Foos, ou=Groups, o=Company,o=Internal
Run Code Online (Sandbox Code Playgroud)

例如,我查询用户ID"E00001".我想要归还这个

["cn=foo_group, cn=Foos, ou=Groups, o=Company,o=Internal", "cn=bar_group, cn=Foos, ou=Groups, o=Company,o=Internal"
Run Code Online (Sandbox Code Playgroud)

java spring spring-ldap spring-boot

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

Vue JS 使用 v-for 从对象数组获取 JSON 键值时出错

我正在尝试使用 Vue.js 将 JSON 有效负载中的对象列表解析为表。

我想从数组中的第一个对象中获取键来创建表标题,下面的代码可以工作并提供正确的值,但问题是我不断收到此错误消息

错误信息

[Vue warn]: Error in render function: "TypeError: objectArray is null"

(found in <Root>)
Run Code Online (Sandbox Code Playgroud)

Html 元素

<thead>
    <tr>
        <th v-for="(value, key) in objectArray[0]">
            {{ key }}
        </th>
    </tr>
</thead>
Run Code Online (Sandbox Code Playgroud)

JSON 有效负载

[
{ "field1": "value", "field2": "value", "field3": "value", "field4": "value", "field5": "value", "field6": "value", "field7": "value" },
{ "field1": "value", "field2": "value", "field3": "value", "field4": "value", "field5": "value", "field6": "value", "field7": "value" },
{ "field1": "value", "field2": "value", "field3": "value", "field4": "value", "field5": …
Run Code Online (Sandbox Code Playgroud)

javascript json vuejs2

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