小编Cod*_*der的帖子

拒绝在框架中显示"url",因为它将"X-Frame-Options"设置为"SAMEORIGIN"

<script async="" defer="" src="//survey.g.doubleclick.net/async_survey?site=vj2nngtlb7sbtnveaepk5so4ke"></script>
Run Code Online (Sandbox Code Playgroud)

这是错误的屏幕截图

而且我正在

Refused to display 'https://survey.g.doubleclick.net/gen204/d?zx=5cbpafvsv9le' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
Run Code Online (Sandbox Code Playgroud)

谷歌调查设置错误.

javascript google-surveys

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

没有类型为“org.springframework.jdbc.core.JdbcTemplate”的合格 bean 可用错误

我正在https://developer.ibm.com/tutorials/spring-with-db2-via-jdbc/上运行tutorial.example, 但无法让它工作,我不断收到以下错误,并且不确定如何修复。

没有“org.springframework.jdbc.core.JdbcTemplate”类型的合格 bean 可用:预计至少有 1 个有资格作为自动装配候选者的 bean。依赖注释:{@org.springframework.beans.factory.annotation.Autowired(required=true)}'

教程中没有提到与设置 bean 相关的内容,所以我不确定我是否应该中断它来修复它,或者我只是犯了一个错误。

我的应用程序类 -

@SpringBootApplication
public class SBApplication {
    public static void main(String[] args) {
        SpringApplication.run(SBApplication.class, args);
    }
 }
Run Code Online (Sandbox Code Playgroud)

休息控制器示例 -

package application.rest.v1;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
import main.java.application.jdbc.*;

@RestController
public class Example {
    @Autowired
    JdbcTemplate jdbcTemplate;

    @RequestMapping("test")
    public @ResponseBody ResponseEntity<String> example() {
        List<String> list = new ArrayList<>();
        list.add("Table data...");
        jdbcTemplate.query(
                "SELECT * FROM things", new …
Run Code Online (Sandbox Code Playgroud)

java db2 jdbc spring-boot

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

我们可以在 Spring JPA @Query 中替换等于、大于或小于运算符吗?

我是 Spring、Springboot、JPA 的新手,并且遇到了其中一项要求。下面是查询:

@Query("Select re from RequiredAccountEntity re where re.debitAccNo= :debitAccNo "
          + "AND re.date<= :toDate AND re.date>= :fromDate AND re.tnxAmt tnxAmtFlag :tnxAmt ") List<RequiredAccountEntity>
          fetchAllData(@Param("debitAccNo") String debitAccNo, @Param("fromDate")
          Date fromDate, @Param("toDate") Date toDate, @Param("tnxAmt") Double tnxAmt,@Param("tnxAmtFlag") String tnxAmtFlag);
Run Code Online (Sandbox Code Playgroud)

在此,我尝试根据来自其他应用程序的请求数据动态替换“大于”、“小于”或“等于”运算符。

请帮助我或指导我在 Springboot JPA 中以正确的方式执行此操作。

提前致谢!

感谢和问候沙努

jpa spring-data-jpa spring-boot

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

地理位置邮政编码

我使用以下代码获取位置和城市,但如果此人给予我许可,则无法让它给我邮政编码.如果可以使用此代码,请告诉我.如果获得访问权限,它所做的只是填充文本字段.

<script type="text/javascript">
  if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
     $("#location").val(position.address.city+", "+position.address.region);
  });
 }
Run Code Online (Sandbox Code Playgroud)

javascript html5 geolocation

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

没有类型的Lambda表达式

我理解Java8 lambda表达式的语法,但为什么下面的代码在没有x的特定类型声明的情况下工作?为什么要打印"巴兹"?

public class LambdaExpressions {

    interface Foo {
        void bar(Object o);
    }

    static void doo(Foo f) {
        f.bar("baz");
    }

    public static void main(String[] args) {

        doo( x -> {System.out.println(x);});
    }

}
Run Code Online (Sandbox Code Playgroud)

java lambda java-8

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

使用邮递员发送json api对象

我正在使用JSONAPI规范http://jsonapi.org/format/#status

我有以下数据,

{
  "data": 
    {
    "type": "tag",
    "id": "1",
    "attributes": {
        "name": "Test"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

如何使用postman chrome扩展程序向终点发送帖子请求?

我正打算打电话,但我无法得到参数.

OBS.我已将Content-Type设置为application/vnd.api+json

谢谢 !

有效的HTML

json json-api jsonapi-resources jsonapiframework

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

消除重复的Json元素并检索以大写字母开头的元素名称spring boot / java

我正在使用Spring Boot和Spring Framework(spring-boot-starter-parent 2.1.6.RELEASE)开发Rest Client,我有一个表示响应对象的类,如下所示:

public class ValidateResponse {
    private String ResponseCode;
    private String ResponseDesc;

    //getters and setters
    //constructors using fields
    //empty constructor
}
Run Code Online (Sandbox Code Playgroud)

我正在为外部api创建网络挂钩,并且需要为特定端点返回JSON对象(JSON对象属性必须以大写字母开头)。我正在调用从PostMapping嵌套在RequestMapping根路径中的方法返回对象:

@PostMapping("hooks/validate")
public ValidateResponse responseObj(@RequestHeader Map<String, String> headersObj) {
    ValidateResponse response = new ValidateResponse("000000", "Success");

    logger.info("Endpoint = hooks/validate | Request Headers = {}", headersObj);

    return response;

} 
Run Code Online (Sandbox Code Playgroud)

但是,当我从邮递员到达终点时,我得到了重复的varialbes

{
    "ResponseCode": "000000",
    "ResponseDesc": "Success",
    "responseCode": "000000",
    "responseDesc": "Success"
}
Run Code Online (Sandbox Code Playgroud)

我知道pojo-json转换是由spring处理的,但是我不明白为什么转换会产生重复的变量。

注意:我知道使用最佳命名变量标准(camelCasing)不会声明ResponseDescResponseCode

我已经按照Java语言规范进行了一些挖掘

标识符是Java字母和Java数字的无限长度序列,其中第一个必须是Java字母。

“ Java字母”包括大写和小写的ASCII拉丁字母AZ(\ …

json type-conversion pojo jackson spring-boot

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

如何限制angular2下拉列表中的重复值

这里我提到了当前的图像形式。 图片

1) 它是一个多选下拉菜单。它应该限制重复的税名。对于此图像中CGST选择的两次示例。

选择相同的名称时,它不应显示在此处。所以请帮助我做到这一点。

html

<div class="form-group">
  <label for="tax">Tax Name</label>
  <select class="form-control" id="tax_name" (change)=" dropdown(tax.value)" [(ngModel)]="model.tax" name="tax_name" #tax="ngModel">
    <option value="addNew">
      <i class="fa fa-plus" aria-hidden="true"></i>Add New Tax </option>
    <hr>
    <br/>
    <option *ngFor="let i of taxlist" [value]="i.tax_name">{{i.tax_name}} &nbsp; ( {{i.tax_percentage}}% )</option>
  </select>
</div>
<div>

  <label for="percentage">Tax Percentage</label>
  <input type="text" class="form-control" id="tax_percentage" placeholder="Percentage" pattern="[0-9]+" minlength="0" maxlength="3"
    [(ngModel)]="per" name="tax_percentage" #percentage="ngModel">
</div>
<button (click)="addContact(tax.value,percentage.value);" type="button" class="btn btn-success btn-sm text-right">
  <i class="fa fa-plus fa-lg"></i>
</button>
Run Code Online (Sandbox Code Playgroud)

angular2-forms angular2-directives angular2-template angular

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

Angular 7 HTTP GET发送JSON对象作为参数

我试图通过角度将JSON结构发送到REST服务

  let test5var = {
                    "test5var1": {
                        "test5var2": "0317",
                        "test5var3": "9556"
                    },
                    "test5var4": "123",
                    "test5var": "0000046"
                }
let dataPrincipalBlnc = {"test": {"test1": {"test2": "0317","test3": {"IDIOMA_ISO": " en","DIALECTO_ISO": "US"},"channel": "INT"},"input": {"test5": test5var}}};

let headers = new HttpHeaders();
    headers.append('Content-Type', 'application/json');

    let params = new HttpParams().set("requestData", dataPrincipalBlnc.toString()).set("authenticationType", this.authType);


    return this.http.get(this.url, {params: params}); 
Run Code Online (Sandbox Code Playgroud)

请求的结果应如下所示:

https://example.com/test?authenticationType=cookie&requestData=%7B%test%22:%7B%22test1%22:%7B%22test2%22:%220317%22,%22test3%22:%7B%22IDIOMA_ISO% 22:%22 + en%22,%22DIALECTO_ISO%22:%22US%22%7D,%22channel%22:%22INT%22%7D,%22input%22:%7B%22test5%22:%7B%22test5var1% 22:%7B%22test5var2%22:%220317%22,%22test5var3%22:%229556%22%7D,%22test5var4%22:%22123%22,%22test5var5%22:%220000986%22%7D%7D% 7D%7D

但当前发送为:

https://example.com/test?requestData=%5Bobject%20Object%5D&authenticationType=cookie

有什么想法可以将json对象发送为第一个请求吗?我需要手动将json转换为有效的uri格式吗?

在angularJS中,仅使用以下代码即可正常工作:

var data = {
      "test1": {
        "test2": {
          "test3": "0317",
          "test4": {
            "IDIOMA_ISO": " en",
            "DIALECTO_ISO": "US"
          },
          "channel": "INT" …
Run Code Online (Sandbox Code Playgroud)

json get http angular

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

字符串在追加时返回null

我的任务是创建一个单词猜谜游戏.你只有5次尝试猜测这个词.用户一次输入一个字母以试图找出我的秘密词"果汁",但你应该使用一个提示词构造,如果它是正确的,每个猜测用正确的字母替换星号.

这就是输出应该是这样的:

欢迎来到猜词游戏!你有5次尝试猜测这个秘密词!目前的提示是


猜一个小写字母

ü

*U***

猜猜这个秘密词

tutre

继续尝试!

猜一个小写字母

Ť

*U***

猜猜这个秘密词

mutor

继续尝试!

...继续直到5次尝试然后你要么输赢

我的输出不会让你试图猜测,提示词显然搞砸了,因为它有5个星号的空前面...我不知道如何解决它.

目前的提示是

空值*****

猜一个小写字母

Ĵ

jull*

猜猜这个秘密词

jutre

继续尝试!

游戏结束!再试一次?

这是我的班级:

public class SecretWord {
private String secretWord;
private String hintWord;
private int numberOfTurns;

//Default Constructors
public SecretWord()
{
    this.secretWord = "juice";
    for (int i = 0; i < secretWord.length(); i++)
    {
        this.hintWord+="*";
    }
    this.numberOfTurns = 0;
}
//Accessors
public String getSecretWord()
{
    return this.secretWord;
}
public String getHintWord()
{
    return this.hintWord;
}
public …
Run Code Online (Sandbox Code Playgroud)

java

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