Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

tapestry question on jwcid

Posted on 2006-10-29
17
553 Views
Last Modified: 2013-11-24
any tapestry experts?

what is this format
         jwcid="table@contrib:Table"
based on?
0
Comment
Question by:bhomass
  • 9
  • 8
17 Comments
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17832371
The jwcid attribute is tapestry-specific. It means that you are defining an instance of a Table component, which comes from the contrib package, and you are giving it the reference id 'table'. You can reference the component from elsewhere (for example to iterate through the rows of the table) using your 'table' id.
0
 

Author Comment

by:bhomass
ID: 17835365
I don't think you got my question. I know all about the jwcid itself.

the question is about the FORMAT of "table@contrib:Table". seems like a strange notation to me. how are you suppose to interpret the @ and :?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17835601
I think of '@' as 'instance-of' and ':' as a qualifier to avoid name clashes. (I should have said 'library' instead of 'package' in my previous posting.)

So jwcid="table@contrib:Table" reads as "jwcid is 'table', which is an instance of contrib:Table"

I haven't thought about it more than that - it's just a notation.
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:bhomass
ID: 17835684
and what does contrib:Table mean in terms of designated a specific java class?

I know its just a notation, and java is just a language. how would you apply such notation if you don't know the rules?

I am particularly interested in the foundation of this notation. which standard is at its base?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17837463
You have to look at the component specification to discover the corresponding java class. If you take a look inside the tapestry-contrib-<version>.jar you find the Java class named in the Table.jwc file:

<component-specification class="org.apache.tapestry.contrib.table.components.Table"
      allow-body="yes" allow-informal-parameters="yes">
...
</component-specification>

You're going to run into difficulties applying a notation if you don't know its syntax and semantics, although you might have some (perhaps limited) success by copying the pattern of some working code.

I doubt that this notation adheres to any standard external to Tapestry. I had a scan of the WebObjects manuals, as the component-based approach of Tapestry is, I believe, loosely derived from WebObjects, but I didn't see anything resembling this notation.
0
 

Author Comment

by:bhomass
ID: 17837621
I also already know that this particular jwcid points to the contributed Table.Component class.

here is my problem. I like to create my own components intead of using those included in Tapestry. without knowing how the name convention gets applied, how do I decide what package, class name, and jwcid format to use?

if someone knows the rules, please enlighten me.
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17838700
Sounds like you are looking for a style guide.

For the class name, use whatever choice of class you would use in any project. This is not affected by the use of Tapestry. For example, many organisations stipulate allowed choices of Java package based on the organisation's URL and departmental or project structure, so this is often in a company style guide.

For the package/library, it depends on how you see the reuse of your libraries. Which parts are reusable and which parts are likely to be reused? How much effort do you want to spend in making sure they are independently deployable? Such issues arise in many contexts - not just in Tapestry. This runs far deeper than a question about a jwcid format! Usually your manager or company strategy will define how much effort to spend here.

What jwcid format to use? Whether to use fully qualified components in the HTML templates, anonymous components, page classes, annotations etc. is all a matter of personal preference. The "trend" (judging by the latest versions of Tapestry) is to pack as much as possible into the Java class via Java 1.5 annotations.
0
 

Author Comment

by:bhomass
ID: 17838995
I think you are getting further and further afield as we go on.

Let me try rephrase:

we know that jwcic="table@contrib:Table" maps to org.apache.tapestry.contrib.table.components.Table.

so once I developed a class com.mycompany.myproject.MyClass, what do I put for jwcid to map to this clas?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17840744
Your component is defined in a .jwc file
If it is called MyClass.jwc then you make an entry in your .application file to declare the component:

<component-type type="MyClass" specification-path="MyClass.jwc"/>

and refer to the component using @MyClass


0
 

Author Comment

by:bhomass
ID: 17843870
ok, now we are hitting it.

what about the library name "contrib" used in contrib:Table. how would I create a cutom lib for my html's to reference?

I have increased the points for the efforts and results shown.
0
 
LVL 1

Accepted Solution

by:
OneOrTwo earned 100 total points
ID: 17844924
A custom library is just another JAR file. The JAR file contains a .library file that has a library-specification:

<library-specification>
  <component-type type="MyClass" specification-path="MyClass.jwc"/>
  ...
</library-specification>

The library is then referenced from your .application file:

<library id="myLib" specification-path="/com/foo/components/MyComponents.library"/>

Here, the specification-path is the path to the library specification within the JAR file.
Once you have given the library the id "myLib", you should refer to components from that library using that prefix, as in @myLib:MyClass
0
 

Author Comment

by:bhomass
ID: 17846225
you truly are an expert on this subject.

Thanks for all the info, which really helps to speed ahead.
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17848324
Thanks - Glad I was able to help!
0
 

Author Comment

by:bhomass
ID: 17859696
if I can ask one more thing. where can I find the references to your answers?
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17865677
If you're serious about using Tapestry, I recommend 'Enjoying Web Development with Tapestry' by Kent Tong Ka Iok ("Tong's book"). You can buy it from Amazon, or buy a PDF version online. See http://www.agileskills2.org/EWDT/

(I'm not connected in any way with the author - I just think it is a very practical book and much more useful than 'Tapestry in Action', published by Manning)

Other than that, I use the tapestry documentation at http://tapestry.apache.org/ and the Tapestry forums at http://www.tapestryforums.com/
0
 

Author Comment

by:bhomass
ID: 17868065
did you get the details concerning the libray tag in the .application file from the tapestry website or from the book you recommended?

It will help me locate the references on the web if they are there at all.
0
 
LVL 1

Expert Comment

by:OneOrTwo
ID: 17868207
In Tong's book, there is a chapter called 'Creating Custom Components' that should answer your questions (see from p. 155 in the Tapestry 4 edition)

The DTD specs might also be useful: http://tapestry.apache.org/tapestry4/UsersGuide/spec.html
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HashTable highest marks enumeration alternative 9 42
How to convert String matching to regex in java 4 49
jboss wildfly 10.1 10 225
ejb example issues 3 20
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question