doushi1964 2011-06-04 14:32
浏览 57
已采纳

jsp php json通讯

I have Json response from my database . I am using Php for this which can be viewed over here . In this we can search the record from identifier value like identifier =123 . Is that possible to to show this response in the Jsp page . like when i put the identifier value in the text box of jsp page ,it can give the response from that database

  • 写回答

1条回答 默认 最新

  • dq13733519262 2011-06-04 14:54
    关注

    Since the PHP response does not have the access control headers which would allow crossdomain access by JS/Ajax, you would need to handle this fully at the server side.

    Use java.net.URL to get the PHP response as an InputStream. Use a JSON (de)serializer like Google Gson to convert the JSON string to an fullworthy Javabean. You can do this in a servlet. Finally store this Javabean in the request scope and let JSP display it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容