You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by abangkis <ab...@gmail.com> on 2018/10/26 11:07:09 UTC

Get link to the page that contains custom component

Hi guys. I'm moving parts of of my page to a custom component. In the page
there's a method that will go to another page and go back to the original
page when finished. Here's the code:

@OnEvent("AddDoc")
Object addDoc() {
Link thisPage = pageRenderLinkSource.createPageRenderLink(this.getClass());
addLoanDocPage.setLoanApplicationId(loanApplication.getId());
addLoanDocPage.setLinkBack(thisPage);
return addLoanDocPage;
}

I'm moving that method to the custom component. How can  the component
generate the Link to the page that contains it?

Thanks

-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Get link to the page that contains custom component

Posted by abangkis <ab...@gmail.com>.
Apparently environmental only available during rendering.

https://www.mail-archive.com/users@tapestry.apache.org/msg56293.html

Yeah. I guess I still doesn't understand how to use Environmental
Correctly. Would try passing it as a parameter instead.

Thanks.



On Sat, Oct 27, 2018 at 6:48 PM Mats Andersson <ma...@ronsoft.se>
wrote:

> What do you think about passing the model as a component argument instead?
> That way you are not depending on the order of the calls. See also:
> http://jumpstart.doublenegative.com.au/jumpstart6/examples/navigation/whatiscalledandwhen
> for an explanation.
>
>
> --
> ---------------------- Mats Andersson | Ronsoft AB | +46(0)73 368 79 82
>
>
> On 2018-10-27 05:00, abangkis wrote:
>
> Sorry, still having some problems with custom component. I need to pass a
> logged in user object to the component.
>
> So I push the wrapper class from the page to the environment
>
> @BeginRender
> void beginRender() {
>   LoanBundleModel model = new LoanBundleModel();
>   model.setUserId(getCurrentUser().getId());
>   environment.push(LoanBundleModel.class, model);
> }
> And then retrieve it in the component by using environmental
>
> @Environmental
> private LoanBundleModel model;
>
> And use it in a method like this:
> @CommitAfter
> @OnEvent("DeleteDoc")
> void deleteDoc(Long loanDocumentId) {
>   User user = userManager.get(model.getUserId());
>   String message =
> loanDocumentService.deleteLoanApplicationDoc(loanDocumentId, user);
>     if (message != null) {
>       validationTracker.recordError(message);
>     }
> }
>
> But i keep getting. No object of type
> net.mreunionlabs.gri.server.compmodel.gri.LoanBundleModel is available from
> the Environment.
>
> What did I do wrong?
>
> Thanks
>
> On Sat, Oct 27, 2018 at 7:02 AM abangkis <ab...@gmail.com> <ab...@gmail.com> wrote:
>
>
> I see. Thanks Dmitry.
>
> On Sat, Oct 27, 2018 at 12:23 AM Dmitry Gusev <dm...@gmail.com> <dm...@gmail.com>
> wrote:
>
>
> For forms you can use:
>
>     @Environmental
>     private ValidationTracker validationTracker;
>
> and then
>
>     validationTracker.recordError(...)
>
>
> On Fri, Oct 26, 2018 at 6:45 PM abangkis <ab...@gmail.com> <ab...@gmail.com> wrote:
>
>
> Thanks a lot Dmitry. It's working great.
>
> There's another thing. If the custom component inside a form and like to
> set some error message.
> If it's a page we can do something like:
>
> @InjectComponent
> private Form form;
>
> form.recordError(message);
>
> How to do something like that in a component?
>
> Thanks a lot.
>
>
>
> On Fri, Oct 26, 2018 at 7:59 PM Dmitry Gusev <dm...@gmail.com> <dm...@gmail.com>
> wrote:
>
>
> Hi,
>
> I would try something like this:
>
> @Inject ComponentResources resources;
>
> and then
>
> pageRenderLinkSource.createPageRenderLink(resources.getPageName());
>
> On Fri, Oct 26, 2018 at 2:07 PM abangkis <ab...@gmail.com> <ab...@gmail.com> wrote:
>
>
> Hi guys. I'm moving parts of of my page to a custom component. In
>
> the
>
> page
>
> there's a method that will go to another page and go back to the
>
> original
>
> page when finished. Here's the code:
>
> @OnEvent("AddDoc")
> Object addDoc() {
> Link thisPage =
>
> pageRenderLinkSource.createPageRenderLink(this.getClass());
>
> addLoanDocPage.setLoanApplicationId(loanApplication.getId());
> addLoanDocPage.setLinkBack(thisPage);
> return addLoanDocPage;
> }
>
> I'm moving that method to the custom component. How can  the
>
> component
>
> generate the Link to the page that contains it?
>
> Thanks
>
> --http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/> <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Teamhttp://anjlab.com
>
>
>
> --http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/> <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Teamhttp://anjlab.com
>
>
>
> --http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/> <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>
>
>

-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Get link to the page that contains custom component

Posted by Mats Andersson <ma...@ronsoft.se>.
What do you think about passing the model as a component argument 
instead? That way you are not depending on the order of the calls. See 
also: 
http://jumpstart.doublenegative.com.au/jumpstart6/examples/navigation/whatiscalledandwhen 
for an explanation.


-- 
---------------------- Mats Andersson | Ronsoft AB | +46(0)73 368 79 82


On 2018-10-27 05:00, abangkis wrote:
> Sorry, still having some problems with custom component. I need to pass a
> logged in user object to the component.
>
> So I push the wrapper class from the page to the environment
>
> @BeginRender
> void beginRender() {
>    LoanBundleModel model = new LoanBundleModel();
>    model.setUserId(getCurrentUser().getId());
>    environment.push(LoanBundleModel.class, model);
> }
> And then retrieve it in the component by using environmental
>
> @Environmental
> private LoanBundleModel model;
>
> And use it in a method like this:
> @CommitAfter
> @OnEvent("DeleteDoc")
> void deleteDoc(Long loanDocumentId) {
>    User user = userManager.get(model.getUserId());
>    String message =
> loanDocumentService.deleteLoanApplicationDoc(loanDocumentId, user);
>      if (message != null) {
>        validationTracker.recordError(message);
>      }
> }
>
> But i keep getting. No object of type
> net.mreunionlabs.gri.server.compmodel.gri.LoanBundleModel is available from
> the Environment.
>
> What did I do wrong?
>
> Thanks
>
> On Sat, Oct 27, 2018 at 7:02 AM abangkis <ab...@gmail.com> wrote:
>
>> I see. Thanks Dmitry.
>>
>> On Sat, Oct 27, 2018 at 12:23 AM Dmitry Gusev <dm...@gmail.com>
>> wrote:
>>
>>> For forms you can use:
>>>
>>>      @Environmental
>>>      private ValidationTracker validationTracker;
>>>
>>> and then
>>>
>>>      validationTracker.recordError(...)
>>>
>>>
>>> On Fri, Oct 26, 2018 at 6:45 PM abangkis <ab...@gmail.com> wrote:
>>>
>>>> Thanks a lot Dmitry. It's working great.
>>>>
>>>> There's another thing. If the custom component inside a form and like to
>>>> set some error message.
>>>> If it's a page we can do something like:
>>>>
>>>> @InjectComponent
>>>> private Form form;
>>>>
>>>> form.recordError(message);
>>>>
>>>> How to do something like that in a component?
>>>>
>>>> Thanks a lot.
>>>>
>>>>
>>>>
>>>> On Fri, Oct 26, 2018 at 7:59 PM Dmitry Gusev <dm...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I would try something like this:
>>>>>
>>>>> @Inject ComponentResources resources;
>>>>>
>>>>> and then
>>>>>
>>>>> pageRenderLinkSource.createPageRenderLink(resources.getPageName());
>>>>>
>>>>> On Fri, Oct 26, 2018 at 2:07 PM abangkis <ab...@gmail.com> wrote:
>>>>>
>>>>>> Hi guys. I'm moving parts of of my page to a custom component. In
>>> the
>>>>> page
>>>>>> there's a method that will go to another page and go back to the
>>>> original
>>>>>> page when finished. Here's the code:
>>>>>>
>>>>>> @OnEvent("AddDoc")
>>>>>> Object addDoc() {
>>>>>> Link thisPage =
>>>>> pageRenderLinkSource.createPageRenderLink(this.getClass());
>>>>>> addLoanDocPage.setLoanApplicationId(loanApplication.getId());
>>>>>> addLoanDocPage.setLinkBack(thisPage);
>>>>>> return addLoanDocPage;
>>>>>> }
>>>>>>
>>>>>> I'm moving that method to the custom component. How can  the
>>> component
>>>>>> generate the Link to the page that contains it?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> --
>>>>>> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
>>>>>> twitter : @mreunionlabs @abangkis
>>>>>> page : https://plus.google.com/104168782385184990771
>>>>>>
>>>>>
>>>>> --
>>>>> Dmitry Gusev
>>>>>
>>>>> AnjLab Team
>>>>> http://anjlab.com
>>>>>
>>>>
>>>> --
>>>> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
>>>> twitter : @mreunionlabs @abangkis
>>>> page : https://plus.google.com/104168782385184990771
>>>>
>>>
>>> --
>>> Dmitry Gusev
>>>
>>> AnjLab Team
>>> http://anjlab.com
>>>
>>
>> --
>> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
>> twitter : @mreunionlabs @abangkis
>> page : https://plus.google.com/104168782385184990771
>>
>

Re: Get link to the page that contains custom component

Posted by abangkis <ab...@gmail.com>.
Sorry, still having some problems with custom component. I need to pass a
logged in user object to the component.

So I push the wrapper class from the page to the environment

@BeginRender
void beginRender() {
  LoanBundleModel model = new LoanBundleModel();
  model.setUserId(getCurrentUser().getId());
  environment.push(LoanBundleModel.class, model);
}
And then retrieve it in the component by using environmental

@Environmental
private LoanBundleModel model;

And use it in a method like this:
@CommitAfter
@OnEvent("DeleteDoc")
void deleteDoc(Long loanDocumentId) {
  User user = userManager.get(model.getUserId());
  String message =
loanDocumentService.deleteLoanApplicationDoc(loanDocumentId, user);
    if (message != null) {
      validationTracker.recordError(message);
    }
}

But i keep getting. No object of type
net.mreunionlabs.gri.server.compmodel.gri.LoanBundleModel is available from
the Environment.

What did I do wrong?

Thanks

On Sat, Oct 27, 2018 at 7:02 AM abangkis <ab...@gmail.com> wrote:

> I see. Thanks Dmitry.
>
> On Sat, Oct 27, 2018 at 12:23 AM Dmitry Gusev <dm...@gmail.com>
> wrote:
>
>> For forms you can use:
>>
>>     @Environmental
>>     private ValidationTracker validationTracker;
>>
>> and then
>>
>>     validationTracker.recordError(...)
>>
>>
>> On Fri, Oct 26, 2018 at 6:45 PM abangkis <ab...@gmail.com> wrote:
>>
>> > Thanks a lot Dmitry. It's working great.
>> >
>> > There's another thing. If the custom component inside a form and like to
>> > set some error message.
>> > If it's a page we can do something like:
>> >
>> > @InjectComponent
>> > private Form form;
>> >
>> > form.recordError(message);
>> >
>> > How to do something like that in a component?
>> >
>> > Thanks a lot.
>> >
>> >
>> >
>> > On Fri, Oct 26, 2018 at 7:59 PM Dmitry Gusev <dm...@gmail.com>
>> > wrote:
>> >
>> > > Hi,
>> > >
>> > > I would try something like this:
>> > >
>> > > @Inject ComponentResources resources;
>> > >
>> > > and then
>> > >
>> > > pageRenderLinkSource.createPageRenderLink(resources.getPageName());
>> > >
>> > > On Fri, Oct 26, 2018 at 2:07 PM abangkis <ab...@gmail.com> wrote:
>> > >
>> > > > Hi guys. I'm moving parts of of my page to a custom component. In
>> the
>> > > page
>> > > > there's a method that will go to another page and go back to the
>> > original
>> > > > page when finished. Here's the code:
>> > > >
>> > > > @OnEvent("AddDoc")
>> > > > Object addDoc() {
>> > > > Link thisPage =
>> > > pageRenderLinkSource.createPageRenderLink(this.getClass());
>> > > > addLoanDocPage.setLoanApplicationId(loanApplication.getId());
>> > > > addLoanDocPage.setLinkBack(thisPage);
>> > > > return addLoanDocPage;
>> > > > }
>> > > >
>> > > > I'm moving that method to the custom component. How can  the
>> component
>> > > > generate the Link to the page that contains it?
>> > > >
>> > > > Thanks
>> > > >
>> > > > --
>> > > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
>> > > > twitter : @mreunionlabs @abangkis
>> > > > page : https://plus.google.com/104168782385184990771
>> > > >
>> > >
>> > >
>> > > --
>> > > Dmitry Gusev
>> > >
>> > > AnjLab Team
>> > > http://anjlab.com
>> > >
>> >
>> >
>> > --
>> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
>> > twitter : @mreunionlabs @abangkis
>> > page : https://plus.google.com/104168782385184990771
>> >
>>
>>
>> --
>> Dmitry Gusev
>>
>> AnjLab Team
>> http://anjlab.com
>>
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Get link to the page that contains custom component

Posted by abangkis <ab...@gmail.com>.
I see. Thanks Dmitry.

On Sat, Oct 27, 2018 at 12:23 AM Dmitry Gusev <dm...@gmail.com>
wrote:

> For forms you can use:
>
>     @Environmental
>     private ValidationTracker validationTracker;
>
> and then
>
>     validationTracker.recordError(...)
>
>
> On Fri, Oct 26, 2018 at 6:45 PM abangkis <ab...@gmail.com> wrote:
>
> > Thanks a lot Dmitry. It's working great.
> >
> > There's another thing. If the custom component inside a form and like to
> > set some error message.
> > If it's a page we can do something like:
> >
> > @InjectComponent
> > private Form form;
> >
> > form.recordError(message);
> >
> > How to do something like that in a component?
> >
> > Thanks a lot.
> >
> >
> >
> > On Fri, Oct 26, 2018 at 7:59 PM Dmitry Gusev <dm...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I would try something like this:
> > >
> > > @Inject ComponentResources resources;
> > >
> > > and then
> > >
> > > pageRenderLinkSource.createPageRenderLink(resources.getPageName());
> > >
> > > On Fri, Oct 26, 2018 at 2:07 PM abangkis <ab...@gmail.com> wrote:
> > >
> > > > Hi guys. I'm moving parts of of my page to a custom component. In the
> > > page
> > > > there's a method that will go to another page and go back to the
> > original
> > > > page when finished. Here's the code:
> > > >
> > > > @OnEvent("AddDoc")
> > > > Object addDoc() {
> > > > Link thisPage =
> > > pageRenderLinkSource.createPageRenderLink(this.getClass());
> > > > addLoanDocPage.setLoanApplicationId(loanApplication.getId());
> > > > addLoanDocPage.setLinkBack(thisPage);
> > > > return addLoanDocPage;
> > > > }
> > > >
> > > > I'm moving that method to the custom component. How can  the
> component
> > > > generate the Link to the page that contains it?
> > > >
> > > > Thanks
> > > >
> > > > --
> > > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > > twitter : @mreunionlabs @abangkis
> > > > page : https://plus.google.com/104168782385184990771
> > > >
> > >
> > >
> > > --
> > > Dmitry Gusev
> > >
> > > AnjLab Team
> > > http://anjlab.com
> > >
> >
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>


-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Get link to the page that contains custom component

Posted by Dmitry Gusev <dm...@gmail.com>.
For forms you can use:

    @Environmental
    private ValidationTracker validationTracker;

and then

    validationTracker.recordError(...)


On Fri, Oct 26, 2018 at 6:45 PM abangkis <ab...@gmail.com> wrote:

> Thanks a lot Dmitry. It's working great.
>
> There's another thing. If the custom component inside a form and like to
> set some error message.
> If it's a page we can do something like:
>
> @InjectComponent
> private Form form;
>
> form.recordError(message);
>
> How to do something like that in a component?
>
> Thanks a lot.
>
>
>
> On Fri, Oct 26, 2018 at 7:59 PM Dmitry Gusev <dm...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I would try something like this:
> >
> > @Inject ComponentResources resources;
> >
> > and then
> >
> > pageRenderLinkSource.createPageRenderLink(resources.getPageName());
> >
> > On Fri, Oct 26, 2018 at 2:07 PM abangkis <ab...@gmail.com> wrote:
> >
> > > Hi guys. I'm moving parts of of my page to a custom component. In the
> > page
> > > there's a method that will go to another page and go back to the
> original
> > > page when finished. Here's the code:
> > >
> > > @OnEvent("AddDoc")
> > > Object addDoc() {
> > > Link thisPage =
> > pageRenderLinkSource.createPageRenderLink(this.getClass());
> > > addLoanDocPage.setLoanApplicationId(loanApplication.getId());
> > > addLoanDocPage.setLinkBack(thisPage);
> > > return addLoanDocPage;
> > > }
> > >
> > > I'm moving that method to the custom component. How can  the component
> > > generate the Link to the page that contains it?
> > >
> > > Thanks
> > >
> > > --
> > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > twitter : @mreunionlabs @abangkis
> > > page : https://plus.google.com/104168782385184990771
> > >
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
> >
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Get link to the page that contains custom component

Posted by abangkis <ab...@gmail.com>.
Thanks a lot Dmitry. It's working great.

There's another thing. If the custom component inside a form and like to
set some error message.
If it's a page we can do something like:

@InjectComponent
private Form form;

form.recordError(message);

How to do something like that in a component?

Thanks a lot.



On Fri, Oct 26, 2018 at 7:59 PM Dmitry Gusev <dm...@gmail.com> wrote:

> Hi,
>
> I would try something like this:
>
> @Inject ComponentResources resources;
>
> and then
>
> pageRenderLinkSource.createPageRenderLink(resources.getPageName());
>
> On Fri, Oct 26, 2018 at 2:07 PM abangkis <ab...@gmail.com> wrote:
>
> > Hi guys. I'm moving parts of of my page to a custom component. In the
> page
> > there's a method that will go to another page and go back to the original
> > page when finished. Here's the code:
> >
> > @OnEvent("AddDoc")
> > Object addDoc() {
> > Link thisPage =
> pageRenderLinkSource.createPageRenderLink(this.getClass());
> > addLoanDocPage.setLoanApplicationId(loanApplication.getId());
> > addLoanDocPage.setLinkBack(thisPage);
> > return addLoanDocPage;
> > }
> >
> > I'm moving that method to the custom component. How can  the component
> > generate the Link to the page that contains it?
> >
> > Thanks
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>


-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Get link to the page that contains custom component

Posted by Dmitry Gusev <dm...@gmail.com>.
Hi,

I would try something like this:

@Inject ComponentResources resources;

and then

pageRenderLinkSource.createPageRenderLink(resources.getPageName());

On Fri, Oct 26, 2018 at 2:07 PM abangkis <ab...@gmail.com> wrote:

> Hi guys. I'm moving parts of of my page to a custom component. In the page
> there's a method that will go to another page and go back to the original
> page when finished. Here's the code:
>
> @OnEvent("AddDoc")
> Object addDoc() {
> Link thisPage = pageRenderLinkSource.createPageRenderLink(this.getClass());
> addLoanDocPage.setLoanApplicationId(loanApplication.getId());
> addLoanDocPage.setLinkBack(thisPage);
> return addLoanDocPage;
> }
>
> I'm moving that method to the custom component. How can  the component
> generate the Link to the page that contains it?
>
> Thanks
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Get link to the page that contains custom component

Posted by abangkis <ab...@gmail.com>.
Hi mats, thanks. Using componentResources.getPageName work great.


On Fri, Oct 26, 2018 at 8:57 PM Mats Andersson <ma...@ronsoft.se>
wrote:

> Hi,
>
> I think you should use ComponentResources to create an event link to your
> new component. The link will include the current page.
>
> Another solution is the getPageName method of ComponentResources.
>
>
> --
> ---------------------- Mats Andersson | Ronsoft AB | +46(0)73 368 79 82
>
> On 2018-10-26 13:07, abangkis wrote:
>
> Hi guys. I'm moving parts of of my page to a custom component. In the page
> there's a method that will go to another page and go back to the original
> page when finished. Here's the code:
>
> @OnEvent("AddDoc")
> Object addDoc() {
> Link thisPage = pageRenderLinkSource.createPageRenderLink(this.getClass());
> addLoanDocPage.setLoanApplicationId(loanApplication.getId());
> addLoanDocPage.setLinkBack(thisPage);
> return addLoanDocPage;
> }
>
> I'm moving that method to the custom component. How can  the component
> generate the Link to the page that contains it?
>
> Thanks
>
>
>

-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Re: Get link to the page that contains custom component

Posted by Mats Andersson <ma...@ronsoft.se>.
Hi,

I think you should use ComponentResources to create an event link to 
your new component. The link will include the current page.

Another solution is the getPageName method of ComponentResources.


-- 
---------------------- Mats Andersson | Ronsoft AB | +46(0)73 368 79 82


On 2018-10-26 13:07, abangkis wrote:
> Hi guys. I'm moving parts of of my page to a custom component. In the page
> there's a method that will go to another page and go back to the original
> page when finished. Here's the code:
>
> @OnEvent("AddDoc")
> Object addDoc() {
> Link thisPage = pageRenderLinkSource.createPageRenderLink(this.getClass());
> addLoanDocPage.setLoanApplicationId(loanApplication.getId());
> addLoanDocPage.setLinkBack(thisPage);
> return addLoanDocPage;
> }
>
> I'm moving that method to the custom component. How can  the component
> generate the Link to the page that contains it?
>
> Thanks
>