[jboss-user] [JBoss Seam] - @Factory annotation

harpritt do-not-reply at jboss.com
Sun Jul 8 05:47:59 EDT 2007


Hi

Appologies if i use the wrong terms to descibe my current problem, im new to SEAM and im just about keeping my head above water

I have 4 dropdown menus that i wish to populate with SelectItem Objects. 

I decided the best way (limited knowledge) was to use the @Factory annotation to define the 4 components in a Stateful Session.... and then retrieve them using the #{component1} etc in the drop downs. 
(my Stateful session bean contains 4 @Factory annotations) 

... Problem is that only one of the components contains any data in the scope so the JSF page complains about requiring not null components.

in the end i settled for standard accessors as below. Any advice as to where i was going wrong wiht the @Factory annotation would be very helpful. Many Thanks


@Stateful
  | @Name("GsmsCrManager")
  | 
  | @Local(GsmsCrsManager.class)
  | @Remote(GsmsCrsManager.class)
  | 
  | 
  | public class GsmsCrManagerImpl {
  | 
  | 
  |     public SelectItem[] getCrReasons() {
  |         SelectItem[] crReasons = new SelectItem[7];
  |         crReasons[0] = new SelectItem("Correction of Error or Omission");
  |         crReasons[1] = new SelectItem("Clarification of Existing Content");
  |         crReasons[2] = new SelectItem("New Content");
  |         crReasons[3] = new SelectItem("Change in Operating Procedures");
  |         crReasons[4] = new SelectItem("Change in Regulations");
  |         crReasons[5] = new SelectItem("Change in Equipment");
  |         crReasons[6] = new SelectItem("Change in Organisation");
  |         return crReasons;
  |     }
  | 
  |     public SelectItem[] getCrActions() {
  |         SelectItem[] crActions = new SelectItem[5];
  |         crActions[0] = new SelectItem("Create a New document");
  |         crActions[1] = new SelectItem("Edit Existing document");
  |         crActions[2] = new SelectItem("Delete Existing document");
  |         crActions[3] = new SelectItem("Move Existing document");
  |         crActions[4] = new SelectItem("Request an action not covered by the above");
  |         return crActions;
  |     }
  | 
  | 
  |     public SelectItem[] getCrAudience() {
  |         SelectItem[] crAudience = new SelectItem[5];
  |         crAudience[0] = new SelectItem("Crew");
  |         crAudience[1] = new SelectItem("sdfsd");
  |         crAudience[2] = new SelectItem("asda");
  |         crAudience[3] = new SelectItem("asd
  |         crAudience[4] = new SelectItem("sdfgdsfg");
  |         return crAudience;
  |     }
  | 
  | 
  |     public SelectItem[] getCrAudienceReviewalUrgency() {
  |             SelectItem[] crAudienceReviewalUrgency = new SelectItem[5];
  |             crAudienceReviewalUrgency[0] = new SelectItem("High");
  |         crAudienceReviewalUrgency[1] = new SelectItem("Medium/High");
  |         crAudienceReviewalUrgency[2] = new SelectItem("Medium");
  |         crAudienceReviewalUrgency[3] = new SelectItem("Low/Medium");
  |         crAudienceReviewalUrgency[4] = new SelectItem("Low");
  |         return crAudienceReviewalUrgency;
  |     }
  | 
  |     @Destroy @Remove
  |     public void destroy(){
  | 
  | }
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061669#4061669

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061669



More information about the jboss-user mailing list