Solved

tapestry question on jwcid

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

what is this format
         jwcid="table@contrib:Table"
based on?
0
Comment
Question by:bhomass
[X]
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
  • 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

705 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