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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>:
>>
>> 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 <[EMAIL PROTECTED]>:
>>>> 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 <[EMAIL PROTECTED]>
>>>> 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: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> It has to start somewhere, It has to start sometime.
>>> What better place than here, what better time than now?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>>
>> -----
>> 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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
> --
> It has to start somewhere, It has to start sometime.
> What better place than here, what better time than now?
>
> ---------------------------------------------------------------------
> 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]

Reply via email to