java 适配器不适用于条件检查

标签 java ibm-mobilefirst mobilefirst-adapters

我在 MFP 的 javaAdpter 中遇到问题。 代码不执行 if 语句..我没有找到任何原因。

/* Path for method: "<server address>/Trail-Proejct1/adapters/TestAD/users/{username}" */
@GET
@Path("/{username}")
public String helloUser(@PathParam("username") String name){
    if(name == "mfp"){

        return "good moring" + name;
     }
    return "good afternoon " + name;
} 

enter image description here

[2016-08-09 10:25:41]             Adapter build and deploy finished.
[2016-08-09 10:25:59]             Starting procedure invocation on MobileFirst Server 
[2016-08-09 10:25:59]             Not deploying adapter 'TestAD' since it was not changed since last deployment 
[2016-08-09 10:25:59]             Invoking procedure: '/Trail-Proejct1/adapters/TestAD/users/{username}' of adapter 'TestAD' 
[2016-08-09 10:25:59]             Server host: Banglafires-MacBook-Pro.local 
[2016-08-09 10:25:59]             Server port: 10080 
[2016-08-09 10:25:59]             Parameters: {"QUERY":{},"BODY":"","FORM":{},"HEADER":{},"PATH":{"username":"mfp"}} 
[2016-08-09 10:25:59]             Procedure invocation finished

输出: enter image description here

最佳答案

尝试

if ("mfp".equals(name)) {

在Java中,==用于检查两个引用是否指向同一个对象,而不是检查内容是否相同。

关于java 适配器不适用于条件检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38842112/

相关文章:

android - 删除卸载应用程序时由手机间隙创建的文件

javascript - $http angularjs 调用未从带有 Worklight 的移动设备执行

java - 在 IBM MobileFirst 7.1 中放置生成 keystore 的位置

javascript - javascript 中的 IBM MobileFirst Foundation 8.0 POST 资源请求不起作用

java - 如何更改 JSlider 的默认/起始值

java - 在设置属性之前,bean 被注入(inject)到构造函数 arg 中

java - JPA 查询错误

java - Android - 发送 HDMI CEC 命令到电视 - minix - libCEC

tomcat - IBM MobileFirst Platform 7.0 Operation Console - 此服务器中未部署运行时环境

javascript - IBM MobileFirst 7.0 - 适配器调用