休息服务和Zip可以搜索

时间:2014-09-30 08:18:56

标签: java rest

您好我正在尝试使用java在net bean上执行一个程序,我必须编写一个接受邮政编码并返回状态的REST服务。 REST服务应提供路径和查询参数。代码出了什么问题?

   public class Users {

   private String userId;
   private String firstName;
   private String lastName;
   private String State; 
  private int Zipcode;

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public void setState(String State) {
        this.State = State;
    }

    public void setZipcode(int Zipcode) {
        this.Zipcode = Zipcode;
    }

    public String getUserId() {
        return userId;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public String getState() {
        return State;
    }

    public int getZipcode() {
        return Zipcode;
    }

@Get
@Path("Zipcode")
public String getZipcode (@QueryParam("Zipcode") String Zipcode, @QueryParam("State") String State) {
loadUser();
for (Users u : users) { 
if(getZipcode => 77002 && <= 77099);
JOptionPane.showMessageDialog(null, State);

else if (getZipcode => 77449 && <= 77494);
JOptionPane.showMessageDialog(null, State);

else if (getZipcode => 77502 && <= 77506); 
JOptionPane.showMessageDialog(null, State);

else if (getZipcode => 77550 && <= 77555); 
JOptionPane.showMessageDialog(null, State);

JOptionPane.showMessageDialog(null,"Zipcode is invaild, please try again" );
}
}

0 个答案:

没有答案