Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
23. Apr 2008, 00:57 CET | Link

Hi everyone

I love SEAM but im coming back to it from a long break and im hitting memory blocks and lapse of monkey-ism.

im trying to use the Factory anotation to populate my context variable but all i get is

@Out attribute requires non-null value: candidateHome.genderList

if i use the alternate approach ie annotating a method that has a return value everything works fine.

As allways all help is greatly appreciated

Many thanks Harps



@Name("candidateHome")
public class CandidateHome extends EntityHome<Candidate>
{
	
    @RequestParameter 
    Long candidateId;
    


@Out(scope = ScopeType.SESSION)
public ArrayList genderList;

@Factory(value="genderList", scope=ScopeType.SESSION)
public void retrieveGendersList() {
ArrayList genderList = new ArrayList<String>();
		genderList.add(new SelectItem("MALE"));
		genderList.add(new SelectItem("FEMALE"));
	}





    @Override
    public Object getId() 
    { 
        if (candidateId==null)
        {
            return super.getId();
        }
        else
        {
            return candidateId;
        }
    }
    
    @Override @Begin
    public void create() {
        super.create();
    }
    	

}




5 Replies:
23. Apr 2008, 01:18 CET | Link

Hi,

In the examples I've seen on the docs, @Factory on a void method is only used when annotating the member variable as a @DataModel, never with @Out.

For what you are doing, all of the examples use the pattern where the method returns the value. You've already said that approach works - so why not just use it?

Daniel.

 

i wanna be a contextual component

23. Apr 2008, 01:23 CET | Link

Datamodel is just an @Out wrapped for clickable rows.

dude .... does Outjection work on Pojo's?

lol... is this a homer moment

23. Apr 2008, 03:07 CET | Link

You're assigning to a local variable, not the instance variable:

ArrayList genderList = new ArrayList<String>();
23. Apr 2008, 09:29 CET | Link

Arrgggggg flipping hell!!!

Hey Shane! cheers man.... a real homer momment!

Sorry dude... hey Daniel cheer for your pointer as well.

I spent 2.5 hrs trying to work out what i was doing wrong...

Shane Bryzak wrote on Apr 23, 2008 03:07 AM:
You're assigning to a local variable, not the instance variable:
ArrayList genderList = new ArrayList<String>();

Click HELP for text formatting instructions. Then edit this text and check the preview.

23. Apr 2008, 12:04 CET | Link

Sorted!

i forgot to add required is false to my Outjected component

Out(required=false )

Does Datamodel do this by default?