jsf annotations
- by Andrew Bucknell
I've created an address bean and I want to use it twice - once for street address and once for mailing address. I can achieve this using faces config as per the below, but I'm wondering if I can do this via annotations.
e.g. put @ManagedBean(name="StreetAddress") and @ManagedBean(name="MailingAddress") on the same class? I feel like I am missing something obvious here but I'm not sure what.
<managed-bean>
<managed-bean-name>MailingAddress</managed-bean-name>
<managed-bean-class>com.leetb.jsf_ex1.model.AddressBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<map-entries/>
</managed-bean>
<managed-bean>
<managed-bean-name>StreetAddress</managed-bean-name>
<managed-bean-class>com.leetb.jsf_ex1.model.AddressBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<map-entries/>
</managed-bean>
public class AddressBean {
private String line_one;
private String line_two;
private String suburb;
private String state;
private String postcode;
/* getters and setters snipped */
}