I think its like that:
1. transition is performed in listener objects. If you want to activate
a page *and* pass parameters you get the page from the RequestCycle,
cast it to the needed class and set your parameters.
I preffer to use external links (and IExternalPage) for that, since the
user can easily bookmark the page.
2. now in your new page, you "delegate" the real job to some component
inside the page. For that you use component parameters - so you store
the value on a page property (or, if you need, a state object...) and
bind the component's parameter to this property (or, in case of state
property, you inject the object to your component directly, not
recommended though for what you do, since its more a flow than a state...).
Hope that helps,
Cheers,
Ron
Izak Wessels wrote:
Ok, let me describe my problem in a bit more detail via an analogy.
Let's say I have a html table, called ComputerPartTable, in a file -
ComputerPart. This table
has the following columns : partID, partName,partDesc. Now the user
can click on the partID column and that will forward them to another page,
ComputerPartDetails, that displays the details of the selected computer
part.
Now, each part has different attributes. CPU has clockspeed, fsb speed, etc.
RAM has size, speed, etc.
Ok, so I have created a custom component, called CPUComponentPart.jwc that
lists the relevant details of a CPU component. But what I want to do is, I
want to pass
the partID to the CPUComponentPart.java so that I can lookup the correct
details of
the selected part.
So in my ComputerPart I have
@Parameter
public abstract CPUComponentPart getCPUComponentPart();
public void onFormAction(Integer partID) {
getCPUComponentPart().setPartID(partID); // this is the line where i am
getting an exception
}
Hope that helps,
-- Izak
On 2/12/06, Alan Chandler <[EMAIL PROTECTED]> wrote:
On Sunday 12 February 2006 16:10, Izak Wessels wrote:
Hello all,
I was wondering, how do one inject a component into a page?
For example, when the user clicks on a link, I want to pass the
id of the link that they clicked to my custom component.
I am not sure I fully understand what you are doing.
If you use the @DirectLink component, you can specify some parameters
which
get passed to the listener when he clicks on the link. Pass the ID (or
the
object if its not too big) of the right object.
<a jwcid="@DirectLink" listener="listener:doSomthing" parameters="ognl:
{supplierProduct.id, any other parameters ...}"> ...
If on the other hand you are trying to use a component
<span jwcid="@MyComponent" product="ognl:supplierProduct" >
inside your java class for the component
@Parameter
public abstract CementSupplierProductSpecificationComponent getProduct();
or maybe its a combination of the two?
--
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]