tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <>
Subject Re: Embedding custom metadata in a jsp page; access generated Class via reflection?
Date Tue, 29 Jul 2008 12:03:15 GMT

----- Original Message ----- 
From: "Simon Kitching" <>
To: "Tomcat Users List" <>
Sent: Tuesday, July 29, 2008 12:07 PM
Subject: Re: Embedding custom metadata in a jsp page; access generated Class 
via reflection?

> Mikolaj Rydzewski schrieb:
>> > Simon Kitching wrote:
>>> >> Or perhaps someone can suggest an alternate approach to embedding 
>>> >> metadata that can be accessed before the page renders?
>>>     Please provide as with more details, at this point your requirement 
>>> is a little bit strange. Have you considered using filters?
>> >
> Ok, here are some more details.
> I'm working on the myfaces orchestra flow project (for JavaServer Faces, 
> aka JSF). It allows one JSF page to "call" another JSF page like a 
> subroutine, passing parameters and allows the called page(s) to simply 
> "return" to the page that called them, passing back results. This makes 
> navigation between pages easier, makes the data passing explicit, and 
> avoids any potential variablename "collisions" by setting up a completely 
> clean scope for the called page to run in, with only the passed variables 
> visible.
> When a "call" to a page is done, the page from which the call is made must 
> declare metadata about what the parameters to be passed are, and what 
> logical "service" the called page provides. The called page also needs to 
> declare what input parameters it expects, and what logical service it 
> provides. Think of this like a Java method "prototype" (which is also 
> metadata, and can be queried via java reflection).
> The code where this metadata is needed is in a JSF ViewHandler, which is 
> indirectly called from the JSF FacesServlet class, after the user has 
> submitted a form. The metadata is used for sanity-checking of the call and 
> setting up of the passed parameters (rearrangement of variables in the 
> http session scope etc). Then a forward to the "called" page is done.
> As described in the original email, this is currently done by looking for 
> a ".xml" file sitting beside each .jsp. It works ok, and for any JSF view 
> mechanism (jsp, facelets, clay, etc). But some people might find embedding 
> the information in the actual page to be nicer to work with. Doing this 
> with Facelets isn't too hard, but embedding the necessary info into a jsp 
> page is straining my jsp knowledge considerably  :-)
> However I think the issue is a generic one, not anything specific to this 
> particular case: I want to add "metadata" to a jsp page, just like java 
> annotations provide static metadata about a class without needing to 
> create an instance and execute it. I would think that being able to 
> "annotate" a jsp would be useful for many purposes.
> Regards,
> Simon

Ok... you on a mission ;)
Some guesses 4 u...

What about something like...

The JSP is well formed XML so

    <!-- This is Simons meta data">
Yada Yada

Its in a comment so its not compiled... you parse the comment then stick 
your stuff thru your XML digester factory...
A bean pops out... your servlet populates it and forwards it....
Idea... normal JSP mechanics ignore your meta data...

You take that idea a little further and make a tag

        The stuff

Now the tag engine makes the bean and puts it in the pages session 
The calling program just has to get the bean from the session.... introspect 
and populate

You put an event handler in the bean and you on your way to building your 
own Netbeans VWP system.... (swing for the web)
... probably a good place to steal from ;)
I dont use JSF... but I get the feeling that if you did dig around in VWP 
you'd probably find the tags that do it...

ie Tag libs are meta data (I think)... it gets compiled... it makes beans... 
then its Java again... I think ;)

I think the whole reason for XHTML and all the rest is so HTML pages can 
hold meta data... in theory your external XML should drop in... but you just 
have to make sure the JSP compiler ignores it, or processes it (I think)

Anyway its nice to see people throwing idea's around.... best of luck

The most powerful application server on earth.
The only real POJO Application Server.
See it in Action :

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message