doudao0660 2018-11-29 12:12
浏览 420

将PHP开发的后端更改为Java spring boot

I am not sure if this question gonna be considered as duplicated or not, but I wasn't able to find my answer even by googling or through out the QA suggested topics on the SOF. So here I go asking my question:

I have developed a website with Javascript, PHP , AJAX that's using JSON to talk to eachother. And now the client is asking me to change all PHP backend to Spring Boot. That means I gonna talk to the HTML and Javascript and MySql using Java EE Spring Boot and I am not sure how I gonna do it. My main problems are:

1- Is it possible to parse data from Java to the jQuery using JSON ? I mean I retrive data from the MySql and then send it back to the .php file.

The PHP example would be:

$myJSON = json_encode($myObj);
echo $myJSON;

2- Is it possible to get the parsed the respons from the JAVA through the jQuery :

jQuery.ajax({

        type:"post",
        dataType:"json",
        url: myAjax.ajaxurl,
        data: {action: 'submit_data', info: info},
        success: function(getParsedVAL) {
           // the variable getParsedVAL is comming from the JAVA file
            successmessage = 'Data was succesfully captured';
            $("label#successmessage").text(successmessage);
        },
        error: function(getParsedVAL) {
           // the variable getParsedVAL is comming from the JAVA file
            successmessage = 'Error';
            $("label#successmessage").text(successmessage);
        },
    });
success: function(getParsedVAL) {
    // the variable getParsedVAL is comming from the JAVA file
    successmessage = 'Data was succesfully captured';
}      
  • 写回答

1条回答 默认 最新

  • dsjq62428 2018-12-02 04:56
    关注

    I’m actually transitioning to spring boot from php. Spring boot actually encodes the java object to json automatically. If you developed the back end with some lightweight framework with routing and model controller structure you can easily convert it to spring boost

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题