You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lorenzo Bolzani <l....@gmail.com> on 2008/08/06 19:48:49 UTC
Multiple instances of pages and spring integration
Hi all, I have a page to monitor the status of a remote device.
The page just stay there and refresh automatically to display the actual state.
The problem is that I need to have to distinct pages to monitor two
distinct devices.
My ideal approach would be to define two pages in spring, something like this
<bean class="DeviceMonitorPage" name="monitor1">
<property name="device" ref="device1"/>
<property name="mountUrl" value="deviceMonitor1"/>
</bean>
<bean class="DeviceMonitorPage" name="monitor2">
<property name="device" ref="device2"/>
<property name="mountUrl" value="deviceMonitor2"/>
</bean>
but I know that Wicket is not going to look for this pages in my
spring-config file.
In other words I need two instances of the same page configured in two
different ways.
Is this possibile? How can I pass in the parameters (with or without
spring)? I found nothing about this in the docs.
In this way I could pass in the ref name (device1 or device2) and make
it work with an explicit spring context lookup (no injection).
The @SpringBean annotation works but in this specific case it is not
usable because of the two different parameters.
Thanks for any suggestions.
Bye
Lorenzo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Michael Sparer <mi...@gmx.at>.
Well if it's no dynamic parameter but a static one, different for each page
... why not subclassing a basepage with changed attributes?
If the only problem you see is a missing overview, i.e. you'd like to
control the different values at one place, you should consider setting the
properties e.g. in the application ...
regards
Michael
Lorenzo Bolzani wrote:
>
> Hi Michael, the point is that this is not a user provided parameter
> but a "server-side" page configuration parameter.
>
> In this specific case I need to tell the page how often it should
> auto-refresh. So it is not something that should be passed in from the
> client over the url but something defined at the application startup.
> If my page requires three config parameters I do not want to have to
> provide these on every link to this page.
>
> Am I missing something?
>
> Bye
>
> Lorenzo
>
> 2008/8/11 Michael Sparer <mi...@gmx.at>:
>>
>> I'd say Igor's suggestion is a solution rather than workaround. There's
>> just
>> no point in configuring pages by means of XML or - worse - even a spring
>> config. Passing in page specific parameters is exactly the way to go.
>>
>>> I tryed to pass in these parameters as PageParameters but in this way
>>> I have to convert this from String to Integer to use it and in every
>>> call to the page I have to provide these parameters.
>>
>> I don't get it. Parsing a String with Integer.parse shouldn't be
>> considered
>> as a bad hack or a problem - as far as i know you can even use
>> params.getInt("foobar"). and you're also free to do your custom stuff if
>> a
>> param isn't provided. or am i misunderstanding something?
>>
>> regards,
>> Michael
>>
>>
>> Lorenzo Bolzani wrote:
>>>
>>> Hi Igor, I tried your suggestion and it works but looks like a
>>> workaround more than a solution.
>>>
>>> I have many pages that need some configuration. This is server side
>>> configuration, for example how often a page should refresh itself.
>>> I tryed to pass in these parameters as PageParameters but in this way
>>> I have to convert this from String to Integer to use it and in every
>>> call to the page I have to provide these parameters. At the same time
>>> I do not have an easy place to put this page configuration params. I
>>> think I can define a PageParameters bean for each page inside spring
>>> but looks like a bad hack and this won't solve all the problems.
>>>
>>> I expect page configuration to be a very common problem so I think
>>> there should be a simple/standard approach for this or just some best
>>> practices about this.
>>>
>>> Thanks, bye
>>>
>>>
>>> Lorenzo
>>>
>>>
>>> 2008/8/6 Igor Vaynberg <ig...@gmail.com>:
>>>> well normally you would just do
>>>>
>>>> class monitorpage extends webpage {
>>>> public monitorpage(string deviceid) {
>>>> .. do whatever with deviceid
>>>> }
>>>> }
>>>>
>>>> if you need your pages to be bookmarkable then just use
>>>>
>>>> class monitorpage extends webpage {
>>>> public monitorpage(pageparameters params) {
>>>> string deviceid=params.get("0");
>>>> }
>>>> }
>>>>
>>>> and mount the page with mount("/device",new
>>>> indexedurlcodingstrategy(monitorpage.class));
>>>> then the urls are /device/deviceid
>>>>
>>>> -igor
>>>>
>>>> On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani <l....@gmail.com>
>>>> wrote:
>>>>> Hi all, I have a page to monitor the status of a remote device.
>>>>> The page just stay there and refresh automatically to display the
>>>>> actual
>>>>> state.
>>>>>
>>>>> The problem is that I need to have to distinct pages to monitor two
>>>>> distinct devices.
>>>>>
>>>>> My ideal approach would be to define two pages in spring, something
>>>>> like
>>>>> this
>>>>>
>>>>> <bean class="DeviceMonitorPage" name="monitor1">
>>>>> <property name="device" ref="device1"/>
>>>>> <property name="mountUrl" value="deviceMonitor1"/>
>>>>> </bean>
>>>>>
>>>>> <bean class="DeviceMonitorPage" name="monitor2">
>>>>> <property name="device" ref="device2"/>
>>>>> <property name="mountUrl" value="deviceMonitor2"/>
>>>>> </bean>
>>>>>
>>>>> but I know that Wicket is not going to look for this pages in my
>>>>> spring-config file.
>>>>>
>>>>> In other words I need two instances of the same page configured in two
>>>>> different ways.
>>>>> Is this possibile? How can I pass in the parameters (with or without
>>>>> spring)? I found nothing about this in the docs.
>>>>> In this way I could pass in the ref name (device1 or device2) and make
>>>>> it work with an explicit spring context lookup (no injection).
>>>>>
>>>>> The @SpringBean annotation works but in this specific case it is not
>>>>> usable because of the two different parameters.
>>>>>
>>>>> Thanks for any suggestions.
>>>>>
>>>>>
>>>>> Bye
>>>>>
>>>>> Lorenzo
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> It has to start somewhere, It has to start sometime.
>>> What better place than here, what better time than now?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
>> -----
>> Michael Sparer
>> http://talk-on-tech.blogspot.com
>> --
>> View this message in context:
>> http://www.nabble.com/Multiple-instances-of-pages-and-spring-integration-tp18856317p18924320.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> It has to start somewhere, It has to start sometime.
> What better place than here, what better time than now?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
-----
Michael Sparer
http://talk-on-tech.blogspot.com
--
View this message in context: http://www.nabble.com/Multiple-instances-of-pages-and-spring-integration-tp18856317p18926519.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Igor Vaynberg <ig...@gmail.com>.
On Mon, Aug 11, 2008 at 9:40 AM, Lorenzo Bolzani <l....@gmail.com> wrote:
> So you are saying that wicket does not provide a standard way for page
> configuration.
> So I'll develop a custom solution based on spring or on property files.
there is no one-way-fits-all way of configuring pages, this is too
application specific for us to provide anything.
>> there is no need for a framework to provide anything special for such
>> a usecase, it is just java...
>
> Even I18N is "just java", you could write the wicket code yourself if
> you should. But I chose to use wicket just not to have to.
> I think configurability is a very common requirement for any web
> framework (even servlets had this). Even a simple solution based on
> property files
ok, thats done... getString("key") will read the .properties files...
> or, for example, a complete integration with Spring
> would be useful.
yeah, that would be awesome. and what about all those pesky users we
have who do not use spring?
-igor
>
>
> Thanks, bye
>
> Lorenzo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Lorenzo Bolzani <l....@gmail.com>.
2008/8/11 Igor Vaynberg <ig...@gmail.com>:
> then have your page look it up itself from the spring context using
> some registry
>
> class mypage extends webpage {
> @SpringBean private PageConfigRegistry registry;
>
> public mypage() {
> mydata data=(mydata)registry.getdatafor(getclass());
> // do whatever with data
>
> // ^ or put that lookup into your base page so page just has to
> call getConfigData()
> }
> }
>
So you are saying that wicket does not provide a standard way for page
configuration.
So I'll develop a custom solution based on spring or on property files.
> there is no need for a framework to provide anything special for such
> a usecase, it is just java...
Even I18N is "just java", you could write the wicket code yourself if
you should. But I chose to use wicket just not to have to.
I think configurability is a very common requirement for any web
framework (even servlets had this). Even a simple solution based on
property files or, for example, a complete integration with Spring
would be useful.
Thanks, bye
Lorenzo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Igor Vaynberg <ig...@gmail.com>.
then have your page look it up itself from the spring context using
some registry
class mypage extends webpage {
@SpringBean private PageConfigRegistry registry;
public mypage() {
mydata data=(mydata)registry.getdatafor(getclass());
// do whatever with data
// ^ or put that lookup into your base page so page just has to
call getConfigData()
}
}
there is no need for a framework to provide anything special for such
a usecase, it is just java...
-igor
On Mon, Aug 11, 2008 at 6:46 AM, Lorenzo Bolzani <l....@gmail.com> wrote:
> Hi Michael, the point is that this is not a user provided parameter
> but a "server-side" page configuration parameter.
>
> In this specific case I need to tell the page how often it should
> auto-refresh. So it is not something that should be passed in from the
> client over the url but something defined at the application startup.
> If my page requires three config parameters I do not want to have to
> provide these on every link to this page.
>
> Am I missing something?
>
> Bye
>
> Lorenzo
>
> 2008/8/11 Michael Sparer <mi...@gmx.at>:
>>
>> I'd say Igor's suggestion is a solution rather than workaround. There's just
>> no point in configuring pages by means of XML or - worse - even a spring
>> config. Passing in page specific parameters is exactly the way to go.
>>
>>> I tryed to pass in these parameters as PageParameters but in this way
>>> I have to convert this from String to Integer to use it and in every
>>> call to the page I have to provide these parameters.
>>
>> I don't get it. Parsing a String with Integer.parse shouldn't be considered
>> as a bad hack or a problem - as far as i know you can even use
>> params.getInt("foobar"). and you're also free to do your custom stuff if a
>> param isn't provided. or am i misunderstanding something?
>>
>> regards,
>> Michael
>>
>>
>> Lorenzo Bolzani wrote:
>>>
>>> Hi Igor, I tried your suggestion and it works but looks like a
>>> workaround more than a solution.
>>>
>>> I have many pages that need some configuration. This is server side
>>> configuration, for example how often a page should refresh itself.
>>> I tryed to pass in these parameters as PageParameters but in this way
>>> I have to convert this from String to Integer to use it and in every
>>> call to the page I have to provide these parameters. At the same time
>>> I do not have an easy place to put this page configuration params. I
>>> think I can define a PageParameters bean for each page inside spring
>>> but looks like a bad hack and this won't solve all the problems.
>>>
>>> I expect page configuration to be a very common problem so I think
>>> there should be a simple/standard approach for this or just some best
>>> practices about this.
>>>
>>> Thanks, bye
>>>
>>>
>>> Lorenzo
>>>
>>>
>>> 2008/8/6 Igor Vaynberg <ig...@gmail.com>:
>>>> well normally you would just do
>>>>
>>>> class monitorpage extends webpage {
>>>> public monitorpage(string deviceid) {
>>>> .. do whatever with deviceid
>>>> }
>>>> }
>>>>
>>>> if you need your pages to be bookmarkable then just use
>>>>
>>>> class monitorpage extends webpage {
>>>> public monitorpage(pageparameters params) {
>>>> string deviceid=params.get("0");
>>>> }
>>>> }
>>>>
>>>> and mount the page with mount("/device",new
>>>> indexedurlcodingstrategy(monitorpage.class));
>>>> then the urls are /device/deviceid
>>>>
>>>> -igor
>>>>
>>>> On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani <l....@gmail.com>
>>>> wrote:
>>>>> Hi all, I have a page to monitor the status of a remote device.
>>>>> The page just stay there and refresh automatically to display the actual
>>>>> state.
>>>>>
>>>>> The problem is that I need to have to distinct pages to monitor two
>>>>> distinct devices.
>>>>>
>>>>> My ideal approach would be to define two pages in spring, something like
>>>>> this
>>>>>
>>>>> <bean class="DeviceMonitorPage" name="monitor1">
>>>>> <property name="device" ref="device1"/>
>>>>> <property name="mountUrl" value="deviceMonitor1"/>
>>>>> </bean>
>>>>>
>>>>> <bean class="DeviceMonitorPage" name="monitor2">
>>>>> <property name="device" ref="device2"/>
>>>>> <property name="mountUrl" value="deviceMonitor2"/>
>>>>> </bean>
>>>>>
>>>>> but I know that Wicket is not going to look for this pages in my
>>>>> spring-config file.
>>>>>
>>>>> In other words I need two instances of the same page configured in two
>>>>> different ways.
>>>>> Is this possibile? How can I pass in the parameters (with or without
>>>>> spring)? I found nothing about this in the docs.
>>>>> In this way I could pass in the ref name (device1 or device2) and make
>>>>> it work with an explicit spring context lookup (no injection).
>>>>>
>>>>> The @SpringBean annotation works but in this specific case it is not
>>>>> usable because of the two different parameters.
>>>>>
>>>>> Thanks for any suggestions.
>>>>>
>>>>>
>>>>> Bye
>>>>>
>>>>> Lorenzo
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> It has to start somewhere, It has to start sometime.
>>> What better place than here, what better time than now?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
>> -----
>> Michael Sparer
>> http://talk-on-tech.blogspot.com
>> --
>> View this message in context: http://www.nabble.com/Multiple-instances-of-pages-and-spring-integration-tp18856317p18924320.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> It has to start somewhere, It has to start sometime.
> What better place than here, what better time than now?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Lorenzo Bolzani <l....@gmail.com>.
Hi Michael, the point is that this is not a user provided parameter
but a "server-side" page configuration parameter.
In this specific case I need to tell the page how often it should
auto-refresh. So it is not something that should be passed in from the
client over the url but something defined at the application startup.
If my page requires three config parameters I do not want to have to
provide these on every link to this page.
Am I missing something?
Bye
Lorenzo
2008/8/11 Michael Sparer <mi...@gmx.at>:
>
> I'd say Igor's suggestion is a solution rather than workaround. There's just
> no point in configuring pages by means of XML or - worse - even a spring
> config. Passing in page specific parameters is exactly the way to go.
>
>> I tryed to pass in these parameters as PageParameters but in this way
>> I have to convert this from String to Integer to use it and in every
>> call to the page I have to provide these parameters.
>
> I don't get it. Parsing a String with Integer.parse shouldn't be considered
> as a bad hack or a problem - as far as i know you can even use
> params.getInt("foobar"). and you're also free to do your custom stuff if a
> param isn't provided. or am i misunderstanding something?
>
> regards,
> Michael
>
>
> Lorenzo Bolzani wrote:
>>
>> Hi Igor, I tried your suggestion and it works but looks like a
>> workaround more than a solution.
>>
>> I have many pages that need some configuration. This is server side
>> configuration, for example how often a page should refresh itself.
>> I tryed to pass in these parameters as PageParameters but in this way
>> I have to convert this from String to Integer to use it and in every
>> call to the page I have to provide these parameters. At the same time
>> I do not have an easy place to put this page configuration params. I
>> think I can define a PageParameters bean for each page inside spring
>> but looks like a bad hack and this won't solve all the problems.
>>
>> I expect page configuration to be a very common problem so I think
>> there should be a simple/standard approach for this or just some best
>> practices about this.
>>
>> Thanks, bye
>>
>>
>> Lorenzo
>>
>>
>> 2008/8/6 Igor Vaynberg <ig...@gmail.com>:
>>> well normally you would just do
>>>
>>> class monitorpage extends webpage {
>>> public monitorpage(string deviceid) {
>>> .. do whatever with deviceid
>>> }
>>> }
>>>
>>> if you need your pages to be bookmarkable then just use
>>>
>>> class monitorpage extends webpage {
>>> public monitorpage(pageparameters params) {
>>> string deviceid=params.get("0");
>>> }
>>> }
>>>
>>> and mount the page with mount("/device",new
>>> indexedurlcodingstrategy(monitorpage.class));
>>> then the urls are /device/deviceid
>>>
>>> -igor
>>>
>>> On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani <l....@gmail.com>
>>> wrote:
>>>> Hi all, I have a page to monitor the status of a remote device.
>>>> The page just stay there and refresh automatically to display the actual
>>>> state.
>>>>
>>>> The problem is that I need to have to distinct pages to monitor two
>>>> distinct devices.
>>>>
>>>> My ideal approach would be to define two pages in spring, something like
>>>> this
>>>>
>>>> <bean class="DeviceMonitorPage" name="monitor1">
>>>> <property name="device" ref="device1"/>
>>>> <property name="mountUrl" value="deviceMonitor1"/>
>>>> </bean>
>>>>
>>>> <bean class="DeviceMonitorPage" name="monitor2">
>>>> <property name="device" ref="device2"/>
>>>> <property name="mountUrl" value="deviceMonitor2"/>
>>>> </bean>
>>>>
>>>> but I know that Wicket is not going to look for this pages in my
>>>> spring-config file.
>>>>
>>>> In other words I need two instances of the same page configured in two
>>>> different ways.
>>>> Is this possibile? How can I pass in the parameters (with or without
>>>> spring)? I found nothing about this in the docs.
>>>> In this way I could pass in the ref name (device1 or device2) and make
>>>> it work with an explicit spring context lookup (no injection).
>>>>
>>>> The @SpringBean annotation works but in this specific case it is not
>>>> usable because of the two different parameters.
>>>>
>>>> Thanks for any suggestions.
>>>>
>>>>
>>>> Bye
>>>>
>>>> Lorenzo
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>>
>> --
>> It has to start somewhere, It has to start sometime.
>> What better place than here, what better time than now?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
> -----
> Michael Sparer
> http://talk-on-tech.blogspot.com
> --
> View this message in context: http://www.nabble.com/Multiple-instances-of-pages-and-spring-integration-tp18856317p18924320.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
It has to start somewhere, It has to start sometime.
What better place than here, what better time than now?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Michael Sparer <mi...@gmx.at>.
I'd say Igor's suggestion is a solution rather than workaround. There's just
no point in configuring pages by means of XML or - worse - even a spring
config. Passing in page specific parameters is exactly the way to go.
> I tryed to pass in these parameters as PageParameters but in this way
> I have to convert this from String to Integer to use it and in every
> call to the page I have to provide these parameters.
I don't get it. Parsing a String with Integer.parse shouldn't be considered
as a bad hack or a problem - as far as i know you can even use
params.getInt("foobar"). and you're also free to do your custom stuff if a
param isn't provided. or am i misunderstanding something?
regards,
Michael
Lorenzo Bolzani wrote:
>
> Hi Igor, I tried your suggestion and it works but looks like a
> workaround more than a solution.
>
> I have many pages that need some configuration. This is server side
> configuration, for example how often a page should refresh itself.
> I tryed to pass in these parameters as PageParameters but in this way
> I have to convert this from String to Integer to use it and in every
> call to the page I have to provide these parameters. At the same time
> I do not have an easy place to put this page configuration params. I
> think I can define a PageParameters bean for each page inside spring
> but looks like a bad hack and this won't solve all the problems.
>
> I expect page configuration to be a very common problem so I think
> there should be a simple/standard approach for this or just some best
> practices about this.
>
> Thanks, bye
>
>
> Lorenzo
>
>
> 2008/8/6 Igor Vaynberg <ig...@gmail.com>:
>> well normally you would just do
>>
>> class monitorpage extends webpage {
>> public monitorpage(string deviceid) {
>> .. do whatever with deviceid
>> }
>> }
>>
>> if you need your pages to be bookmarkable then just use
>>
>> class monitorpage extends webpage {
>> public monitorpage(pageparameters params) {
>> string deviceid=params.get("0");
>> }
>> }
>>
>> and mount the page with mount("/device",new
>> indexedurlcodingstrategy(monitorpage.class));
>> then the urls are /device/deviceid
>>
>> -igor
>>
>> On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani <l....@gmail.com>
>> wrote:
>>> Hi all, I have a page to monitor the status of a remote device.
>>> The page just stay there and refresh automatically to display the actual
>>> state.
>>>
>>> The problem is that I need to have to distinct pages to monitor two
>>> distinct devices.
>>>
>>> My ideal approach would be to define two pages in spring, something like
>>> this
>>>
>>> <bean class="DeviceMonitorPage" name="monitor1">
>>> <property name="device" ref="device1"/>
>>> <property name="mountUrl" value="deviceMonitor1"/>
>>> </bean>
>>>
>>> <bean class="DeviceMonitorPage" name="monitor2">
>>> <property name="device" ref="device2"/>
>>> <property name="mountUrl" value="deviceMonitor2"/>
>>> </bean>
>>>
>>> but I know that Wicket is not going to look for this pages in my
>>> spring-config file.
>>>
>>> In other words I need two instances of the same page configured in two
>>> different ways.
>>> Is this possibile? How can I pass in the parameters (with or without
>>> spring)? I found nothing about this in the docs.
>>> In this way I could pass in the ref name (device1 or device2) and make
>>> it work with an explicit spring context lookup (no injection).
>>>
>>> The @SpringBean annotation works but in this specific case it is not
>>> usable because of the two different parameters.
>>>
>>> Thanks for any suggestions.
>>>
>>>
>>> Bye
>>>
>>> Lorenzo
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> It has to start somewhere, It has to start sometime.
> What better place than here, what better time than now?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
-----
Michael Sparer
http://talk-on-tech.blogspot.com
--
View this message in context: http://www.nabble.com/Multiple-instances-of-pages-and-spring-integration-tp18856317p18924320.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Lorenzo Bolzani <l....@gmail.com>.
Hi Igor, I tried your suggestion and it works but looks like a
workaround more than a solution.
I have many pages that need some configuration. This is server side
configuration, for example how often a page should refresh itself.
I tryed to pass in these parameters as PageParameters but in this way
I have to convert this from String to Integer to use it and in every
call to the page I have to provide these parameters. At the same time
I do not have an easy place to put this page configuration params. I
think I can define a PageParameters bean for each page inside spring
but looks like a bad hack and this won't solve all the problems.
I expect page configuration to be a very common problem so I think
there should be a simple/standard approach for this or just some best
practices about this.
Thanks, bye
Lorenzo
2008/8/6 Igor Vaynberg <ig...@gmail.com>:
> well normally you would just do
>
> class monitorpage extends webpage {
> public monitorpage(string deviceid) {
> .. do whatever with deviceid
> }
> }
>
> if you need your pages to be bookmarkable then just use
>
> class monitorpage extends webpage {
> public monitorpage(pageparameters params) {
> string deviceid=params.get("0");
> }
> }
>
> and mount the page with mount("/device",new
> indexedurlcodingstrategy(monitorpage.class));
> then the urls are /device/deviceid
>
> -igor
>
> On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani <l....@gmail.com> wrote:
>> Hi all, I have a page to monitor the status of a remote device.
>> The page just stay there and refresh automatically to display the actual state.
>>
>> The problem is that I need to have to distinct pages to monitor two
>> distinct devices.
>>
>> My ideal approach would be to define two pages in spring, something like this
>>
>> <bean class="DeviceMonitorPage" name="monitor1">
>> <property name="device" ref="device1"/>
>> <property name="mountUrl" value="deviceMonitor1"/>
>> </bean>
>>
>> <bean class="DeviceMonitorPage" name="monitor2">
>> <property name="device" ref="device2"/>
>> <property name="mountUrl" value="deviceMonitor2"/>
>> </bean>
>>
>> but I know that Wicket is not going to look for this pages in my
>> spring-config file.
>>
>> In other words I need two instances of the same page configured in two
>> different ways.
>> Is this possibile? How can I pass in the parameters (with or without
>> spring)? I found nothing about this in the docs.
>> In this way I could pass in the ref name (device1 or device2) and make
>> it work with an explicit spring context lookup (no injection).
>>
>> The @SpringBean annotation works but in this specific case it is not
>> usable because of the two different parameters.
>>
>> Thanks for any suggestions.
>>
>>
>> Bye
>>
>> Lorenzo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
It has to start somewhere, It has to start sometime.
What better place than here, what better time than now?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Multiple instances of pages and spring integration
Posted by Igor Vaynberg <ig...@gmail.com>.
well normally you would just do
class monitorpage extends webpage {
public monitorpage(string deviceid) {
.. do whatever with deviceid
}
}
if you need your pages to be bookmarkable then just use
class monitorpage extends webpage {
public monitorpage(pageparameters params) {
string deviceid=params.get("0");
}
}
and mount the page with mount("/device",new
indexedurlcodingstrategy(monitorpage.class));
then the urls are /device/deviceid
-igor
On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani <l....@gmail.com> wrote:
> Hi all, I have a page to monitor the status of a remote device.
> The page just stay there and refresh automatically to display the actual state.
>
> The problem is that I need to have to distinct pages to monitor two
> distinct devices.
>
> My ideal approach would be to define two pages in spring, something like this
>
> <bean class="DeviceMonitorPage" name="monitor1">
> <property name="device" ref="device1"/>
> <property name="mountUrl" value="deviceMonitor1"/>
> </bean>
>
> <bean class="DeviceMonitorPage" name="monitor2">
> <property name="device" ref="device2"/>
> <property name="mountUrl" value="deviceMonitor2"/>
> </bean>
>
> but I know that Wicket is not going to look for this pages in my
> spring-config file.
>
> In other words I need two instances of the same page configured in two
> different ways.
> Is this possibile? How can I pass in the parameters (with or without
> spring)? I found nothing about this in the docs.
> In this way I could pass in the ref name (device1 or device2) and make
> it work with an explicit spring context lookup (no injection).
>
> The @SpringBean annotation works but in this specific case it is not
> usable because of the two different parameters.
>
> Thanks for any suggestions.
>
>
> Bye
>
> Lorenzo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org