简体   繁体   English

数据流的简单问题(springboot,reactJS,axios)

[英]simple issue with data flow (springboot, reactJS, axios)

Spring + React Spring + React

  1. Controller: 控制器:

     @Component @RestController public class UsersController { @Autowired UsersSource usersSource; @RequestMapping(value = "/", method = RequestMethod.POST) public boolean testUser(@RequestBody User user){ String email = user.getEmail(); String password = user.getPassword(); Optional<User> optUser = usersSource.checkIfExist(email); if(optUser.isPresent()){ if(optUser.get().getPassword().equals(password)) { System.out.println("return true"); //WORKING return true; } } System.out.println("return false"); //WORKING return false; } } 
  2. part of view: 视图的一部分:

... ...

    axios.post('http://localhost:8088/', data)
        .then(response => {
            console.log(response);    //NOT WORKING
        });

... ...

Problem: data ir correctly delivered to RestController and "System.out.println("return true");" 问题:数据ir正确传递到RestController和“ System.out.println(” return true“);” or "System.out.println("return false");" “ System.out.println(” return false“);” works fine, but i dont see: console.log(response) 工作正常,但我看不到: console.log(response)

It is so easy, but i cant handle this problem, please help. 这很容易,但是我无法解决这个问题,请帮忙。

It was not problem with CODE. CODE没问题。 Thx for interests. 谢谢。 I had sth wrong with my browser, when i reset settings to default it works (i'm not sure why), and it is visible in browser web tool now. 我的浏览器错了,当我将设置重置为默认设置时,它可以工作(我不确定为什么),并且现在可以在浏览器Web工具中看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM