you dont generate the entire code. you have your javacode lookup the
external css and load it into a string[]. then you can parse out the ognl
tag lines, and have your parser replace that with the necessary css code.
therefore you are creating a tapestry component which will accomadate the
use of OGNL in css. I didnt' say that it was impossible todo, the fact is
that nobody has made a component in tapestry yet to handle OGNL in external
resources. generally you would use client side scripting to handle all of
that rather then have your app server handle that
----- Original Message -----
From: "Kalle Korhonen" <[EMAIL PROTECTED]>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Tuesday, June 26, 2007 10:46 AM
Subject: Re: is ognl usable inside *.css files ?
Sounds too expensive to me to generate the whole CSS dynamically. If you
just want to change the style for different applications, you can override
the style in later style sheet; or, if you really want it dynamic, keep
the
link static but process it in servlet/service and serve up the image of
your
choice dynamically.
Kalle
On 6/26/07, Evan Rawson - Work <[EMAIL PROTECTED]> wrote:
i do not believe so, cuz tapestry is only generating a link tag to load
and
cache your external asset (the external css sheet)
a way to get around this would be to create a java method to generate
your
external asset (your css code + whatever variable data you wanna inject
into
it). then have your page class load this generated external asset onto
the
page when it renders. another possible way is to create a component which
injects some javascript (this js could change specific css class
properties). this component could be loaded onto your desired page class.
if
you need the properties to be dynamic to the page, meaning to change
during
event handling, you could even incorporate AJAX into this js component. i
would actually have my Javascript modify at the DOM level and not at the
css
level.
javascript to be inserted into page via component
<script>
window.onload = changeBackground {ognl:app.intrinsics.background.url ,
ognl:app.intrinsics.getObject.getContainerId}
function changeBackground (var background, var objectId){
document.getElementById(objectId).style.backgroundImage = background;
}
......
</script>
you could easily make this component a generic core component which any
other component could us. usually when i code UI i will segregate id and
classes. I only use classes to hanxdle direct external css, and i only
use
IDs to handle JS DOM level styling and control. Also if you wrap all
components with <div class="myObjectContainer">component code.... </div>
you
can easily control UI styling directly though java methods handled on the
server side.
----- Original Message -----
From: "Ken nashua" <[EMAIL PROTECTED]>
To: <users@tapestry.apache.org>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, June 26, 2007 10:19 AM
Subject: is ognl usable inside *.css files ?
> Folks,
>
> Want to impact my css-framework by entity based intrinsic's.
>
> Ex. I have an app wide pojo that is stored inside MySQL that
characterizes
> a background.gif (yes it is a blob but thats irrelevent)
>
> In any event, my blob gets put into an ASO and is sitting there at
> bootstrap accessible via ognl object graph.
>
> I want my css file to layout using that blob.
>
> Can I use OGNL inside my css file?
>
> Normally one would use
> background: #fff url( images/background.jpg ) top left no-repeat;
>
> I would like to use
> background: #fff url( ognl:app.intrinsics.background.url ) top left
> no-repeat;
>
> Is this possible?
>
> Any ideas on the appropriate way one should implement this? Thanks in
> advance.
>
> Best regards
> Ken in nashua
>
> _________________________________________________________________
> Who's that on the Red Carpet? Play & win glamorous prizes.
>
http://club.live.com/red_carpet_reveal.aspx?icid=REDCARPET_hotmailtextlink3
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]