-
1. Re: Objects created from link with page params
pmuir Sep 25, 2007 10:36 AM (in response to damianharvey)Because s:link transparently adds any page params referenced by s:link it has to run through all possible parameters when constructing the links.
-
2. Re: Objects created from link with page params
damianharvey Sep 25, 2007 10:49 AM (in response to damianharvey)Thanks Pete, but if the object does not currently exist in the conversation, why initialize one? It can't provide a value for a link if it doesn't yet exist.
Or is this needed so that Seam can push a value into the object from the link? If that is the case then why is it just not initialized when required?
What would you advise for an application with a large-ish memory system comprised of s:link's? The destination for each link will be created right?
Cheers,
Damian. -
3. Re: Objects created from link with page params
valbosoft Oct 17, 2007 4:11 PM (in response to damianharvey)Ok, great tip about the event observer.
I think I'll just go for the @RequestParameter route, and set the Id when initInstance() is called; in a quick test it works.
Thanks for the replies.
Cheers, Bo -
4. Re: Objects created from link with page params
pmuir Oct 27, 2007 6:40 AM (in response to damianharvey)Damian, I see what you are saying, however there are situations where you might want the it initialized (e.g. the value is provided by a factory) - so, yes, it can provide a value if it doesn't exist yet. And the current behaviour is consistent with the rest of Seam (when you reference a value using EL it's create=true and not just a lookup).
I'm not sure of the best solution, but will think about it some more. -
5. Re: Objects created from link with page params
delphi'sghost Nov 8, 2007 5:48 PM (in response to damianharvey)(I know this is an old-ish post, but I came across it when I had another problem, so thought I'd chime in for the next person to come across it)
It seems like the current solution is to manually add a param to the link with the param name, and set it to null. This is what the contact example does for the New Contact link.<s:link view="/myPageWithAParam.xhtml" value="Link"> <f:param name="myParam" value=""/> </s:button>
This way, seam looks at the link, sees that it has a param already (albeit a blank one) and carries on its merry way without instantiating an instance of the object that would provide the param value.
I wonder whether it would be worth a JIRA issue to suggest a flag on the param tag in pages.xml so the param is only added if the object already exists.<param name="myId" value="#{myWidget.id}" required="false"/>
In this case, Seam would not create an instance of the widget if it didn't already exist and it would make the param blank.
If required was true, then it would create an instance and get the Id. -
6. Re: Objects created from link with page params
matt.drees Nov 8, 2007 6:15 PM (in response to damianharvey)Thanks for posting a workaround. I'll have to look into that.
I've seen other forum posts when people want to use the "injection" part of page parameters, but not the "factory/outjection" part. I think it'd be worthwhile thinking through how things could be improved to give users more fine-grained control over what page params do.
By the way, the "required" attribute is taken already. It's used to indicate the parameter is required for that page. -
7. Re: Objects created from link with page params
damianharvey Nov 9, 2007 4:15 AM (in response to damianharvey)Cheers for the tip. I'll give it a go as well.
Is there any reason why @RequestParameter doesn't have a 'required' parameter as well?
Cheers,
Damian.