Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

component ID reference

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi - been using/looking into JSF for about 5 weeks. Hooking up a JSF app with tiles, pulled a couple things (tree2, jscookmenu) from myfaces; starting to know it well enough. Done some stuff with bundles, and see that its a bit cumbersome to use extensively.

The question is - can you refer to a component's attributes during its definition?

Here's a good example of what I mean

A typical outputText may look like this

<h utputText styleClass="outputText" id="journalSearchRegNumber" value="#{myBundle[journalSearchRegNumber]}"></h utputText>

So, you need to give the outputText an identifier, and then use some other identifier to get its label from a bundle. You probably want them to be one and the same, so you can readily identify them.

This seems like a lot of extra typing (ok - extra copy and pasting ;-) Plus, if you change the id of the component, you either change the reference into your bundle (and then the entry in the bundle, or you lose the link between the text in the bundle and which field uses it.

What I'm looking for is something like this:
<h utputText styleClass="outputText" id="journalSearchRegNumber" value="#{myBundle[#{id}]}"></h utputText>

(the syntax of the #{id} is purely fictitious)

When the HTML page is generated, the label is gathered from the bundle based on the id of the component - without you having to type it in twice.

I'm using RSA 6.0, websphere 6.0...beleive its just jsf 1.0

thanks
 
Ekim Retrop
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
d'oh! Sorry about that - that syntax isn't correct for accessing a bundle (that's what you get from typing from memory)

Still - can you somehow do this
<h utputText styleClass="outputText" id="journalSearchType" value="#{applicationBundle.${id}}"></h utputText>

rather than the fully specified way (ie
h utputText styleClass="outputText" id="journalSearchType" value="#{applicationBundle.journalSearchType}"></h utputText>

thanks
ciao
 
Tell me how it all turns out. Here is a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic