You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Goran Novak <gn...@gmail.com> on 2008/06/19 15:18:11 UTC

Static text and condition

Hi,

What is the best (wicket) way to do the next:

I have one page which has to show few sentences (static text), but the
sentences are different according to the input data.

For example if input to the page constructor is:
Page(input1 = 0, input2 = 0, inpu3 = 0)
Page has to show these three sentences:
  This first 'sentence 1' variation
  This first 'sentence 2' variation
  This first 'sentence 3' variation

Second time different input parameters come:
Page(input1 = 1, input2 = 0, inpu3 = 0)
Page has to show these three sentences:
  This second 'sentence 1' variation and some other text
  This first 'sentence 2' variation
  This first 'sentence 3' variation

And so on...

Is it better to put every possiable sentence to resource file and than to
show the right one according to the input parameter.
If(input1 = 0) {
  add(new Label(getLocalizer().getString("firstVariationKey", this)));
} else if (input1 = 1){
  add(new Label(getLocalizer().getString("secondVariationKey", this)));
}


Or to put all sentences staticaly to html file and than use in code
setVisible(true/false) method on that span/'webmarkup container' in which
sentence is.

Or is there a smarter way.

Thanks :)

-- 
View this message in context: http://www.nabble.com/Static-text-and-condition-tp18008831p18008831.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: Static text and condition

Posted by Igor Vaynberg <ig...@gmail.com>.
just give labels a model that can figure out which sentence to show.
if you want them stored in .properties files that is fine too.

-igor

On Thu, Jun 19, 2008 at 6:18 AM, Goran Novak <gn...@gmail.com> wrote:
>
> Hi,
>
> What is the best (wicket) way to do the next:
>
> I have one page which has to show few sentences (static text), but the
> sentences are different according to the input data.
>
> For example if input to the page constructor is:
> Page(input1 = 0, input2 = 0, inpu3 = 0)
> Page has to show these three sentences:
>  This first 'sentence 1' variation
>  This first 'sentence 2' variation
>  This first 'sentence 3' variation
>
> Second time different input parameters come:
> Page(input1 = 1, input2 = 0, inpu3 = 0)
> Page has to show these three sentences:
>  This second 'sentence 1' variation and some other text
>  This first 'sentence 2' variation
>  This first 'sentence 3' variation
>
> And so on...
>
> Is it better to put every possiable sentence to resource file and than to
> show the right one according to the input parameter.
> If(input1 = 0) {
>  add(new Label(getLocalizer().getString("firstVariationKey", this)));
> } else if (input1 = 1){
>  add(new Label(getLocalizer().getString("secondVariationKey", this)));
> }
>
>
> Or to put all sentences staticaly to html file and than use in code
> setVisible(true/false) method on that span/'webmarkup container' in which
> sentence is.
>
> Or is there a smarter way.
>
> Thanks :)
>
> --
> View this message in context: http://www.nabble.com/Static-text-and-condition-tp18008831p18008831.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
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org