This discussion is archived
2 Replies Latest reply: Feb 26, 2013 11:31 PM by gimbal2 RSS

not able to initialize property of java class inside managed bean

878460 Newbie
Currently Being Moderated
This is JSF 2.0 project ,eclipse Juno
..............................
BeanName.java file

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;


@ManagedBean
@SessionScoped
public class OrderHeaderBean {
     
     private String rmaNumber="String";
     private String orderReferenceNumber="Sc-15B-CC";
     private String status="Issued Fully Received";
     private String dateRequested="2011-01-07";
     private String dateApproved="2011-01-20";
     Address shipProductTo = new Address();
     private Address billingAddress=new Address();
     private Address shippingAddress=new Address();
     
     private int returnForCredit[]={11,22,33,44,55};

     private int returnForExchange[]={01,02,03,04,05};
     
     shipProductTo.name=""; //error here
}

here i am trying to initialize name property of Address class(normal java) ,which is as below
Address.java

public class Address {
     public String name;
     public String address1;
     public String address2;
     public String city;
     public String state;
     public int zipcode;
     public String country;
}

error is "Syntax error on token "name", VariableDeclaratorId expected after this token"

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points