You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Per Newgro <pe...@gmx.ch> on 2009/08/18 09:58:00 UTC
How can i load my css
Hi *,
i would like to add a css-class to my div to display a background image.
So i've added this to css
my.css
div.myimg {
background: url("navi_items.gif") no-repeat;
width: 12px;
height: 10px;
cursor: pointer;
}
The navi_items.gif is located in
- webapp
- WEB-INF
- webresources
- my.css
- navi_items.gif
If i add this to my HomePage.html
<link rel="stylesheet" href="webresources/my.css"
type="text/css" media="all" />
everything works fine.
But with the following code in my HomePage i get the error message below
HomePage.java
public HomePage() {
// add .. for every package level of Application to come to
application root
add(HeaderContributor.forCss(new
CompressedResourceReference("../../../webresources/my.css")));
}
error-message
ERROR - SharedResources -
----------------------------------------------------------------------------------------
ERROR - SharedResources - Your path looks like:
../../../webresources/my.css
ERROR - SharedResources - For security reasons moving up
'../' is disabled by default. Please see
ERROR - SharedResources -
IResourceSettings.getParentFolderPlaceholder() and PackageResourceGuard
for more details
ERROR - SharedResources -
----------------------------------------------------------------------------------------
WARN - PackageResource - Unable to find package resource
[path = webresources/my.css, style = null, locale = null]
Setting the parentFolderPlaceholder to $up$ and use
"$up$/$up$/$up$/webresources/my.css" solved the error message display
but the css
is still not loaded.
This was formerly working (wicket1.3.6). With wicket-1992 and
wicket1.3.7 it was disabled. But how can i load my css now?
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How can i load my css
Posted by Per Newgro <pe...@gmx.ch>.
Now i've upgraded to 1.4. I changed the resource ref from CompressedRR
to ContextRelativeResource. Css is found now. But the images loaded with
url("xy.gif") defined in css are not loaded. They always tried to be got
from the Application scope
(org.apachahe.wicket.Application/webresources/xy.gif). This is not
existing and i get no image.
Is noone loading images from css? Do i realy have to split my css into
multiple?
Thanks
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How can i load my css
Posted by Per Newgro <pe...@gmx.ch>.
Major Péter schrieb:
> I guess, you could do something like this:
> add(HeaderContributor.forCss(new
> CompressedResourceReference(((WebRequest)
> getRequest()).getHttpServletRequest().getContextPath() +
> "/webresources/my.css")));
> but this isn't a nice way to do it...
>
That was my thought to. But it seems to be recommened to work with the
ResourceGuard. The simples way seems to reopen the old possibilities by
adding the $up$
property. But it's not working as i did it. Is there an example on that?
> Upgrading to a newer version has always benefits. ;)
>
And many effort (generics :O)
> Regards,
Thanks
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How can i load my css
Posted by Major Péter <ma...@sch.bme.hu>.
I guess, you could do something like this:
add(HeaderContributor.forCss(new
CompressedResourceReference(((WebRequest)
getRequest()).getHttpServletRequest().getContextPath() +
"/webresources/my.css")));
but this isn't a nice way to do it...
Upgrading to a newer version has always benefits. ;)
Regards,
Peter
//maybe you could also use an own HeaderContributor, or the
<wicket:head> tags to solve your problem somehow.
2009-08-18 11:46 keltezéssel, Per Newgro írta:
> But i'm realy instressted in solving this with 1.3.7. Is there no other
> way then jumping to 1.4?
>
> Cheers
> Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How can i load my css
Posted by Per Newgro <pe...@gmx.ch>.
But i'm realy instressted in solving this with 1.3.7. Is there no other
way then jumping to 1.4?
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How can i load my css
Posted by "Haulyn R. Jason" <sa...@gmail.com>.
Hi, I tried this line below in my application.java init(){
resourceFolder.add("/home/haulynjason/workspace/wicketproject/web/css");
}
and everything works well.
I do not familiar with wicket 1.3, I test this with wicket 1.4. Hope this
should help.
On Tue, Aug 18, 2009 at 4:27 PM, Per Newgro <pe...@gmx.ch> wrote:
> Haulyn R. Jason schrieb:
>
>> Hi, I didn't use this style, but I leave my css in resources folder, and
>> use
>> the following code
>> here:add(CSSPackageResource.getHeaderContribution(AbstractWebPage.class,
>> "resources/base.css"));
>>
>> everything works well.
>>
>>
> Thanks for reply Haulyn,
>
> i can't find a CssPackageResource in 1.3.7
> If i use the class scope i have to put my css-file beside my HomePage
> class. I would like to avoid this.
> I would like to use a big "Application folder" for all css, img and so on.
>
> I hope there is a solution.
>
>
> Cheers
> Per
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
------------------
Enjoy. Thanks!
Haulyn Microproduction
Mobile: +086-15864011231
email: saharabear@gmail.com,
hmp.haulyn@foxmail.com
website: http://haulynjason.net
gtalk: saharabear@gmail.com
yahoo: jia_haolin@yahoo.com
msn: saharabear@gmail.com
skype: saharabear
QQ: 378606292
Haulyn Jason
Re: How can i load my css
Posted by Per Newgro <pe...@gmx.ch>.
Haulyn R. Jason schrieb:
> Hi, I didn't use this style, but I leave my css in resources folder, and use
> the following code
> here:add(CSSPackageResource.getHeaderContribution(AbstractWebPage.class,
> "resources/base.css"));
>
> everything works well.
>
Thanks for reply Haulyn,
i can't find a CssPackageResource in 1.3.7
If i use the class scope i have to put my css-file beside my HomePage
class. I would like to avoid this.
I would like to use a big "Application folder" for all css, img and so on.
I hope there is a solution.
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How can i load my css
Posted by "Haulyn R. Jason" <sa...@gmail.com>.
Hi, I didn't use this style, but I leave my css in resources folder, and use
the following code
here:add(CSSPackageResource.getHeaderContribution(AbstractWebPage.class,
"resources/base.css"));
everything works well.
On Tue, Aug 18, 2009 at 3:58 PM, Per Newgro <pe...@gmx.ch> wrote:
> Hi *,
>
> i would like to add a css-class to my div to display a background image. So
> i've added this to css
>
> my.css
> div.myimg {
> background: url("navi_items.gif") no-repeat;
> width: 12px;
> height: 10px;
> cursor: pointer;
> }
>
> The navi_items.gif is located in
> - webapp
> - WEB-INF
> - webresources
> - my.css
> - navi_items.gif
>
>
> If i add this to my HomePage.html
> <link rel="stylesheet" href="webresources/my.css" type="text/css"
> media="all" />
> everything works fine.
>
> But with the following code in my HomePage i get the error message below
>
> HomePage.java
> public HomePage() {
> // add .. for every package level of Application to come to application
> root
> add(HeaderContributor.forCss(new
> CompressedResourceReference("../../../webresources/my.css")));
> }
>
> error-message
> ERROR - SharedResources -
> ----------------------------------------------------------------------------------------
> ERROR - SharedResources - Your path looks like:
> ../../../webresources/my.css
> ERROR - SharedResources - For security reasons moving up '../'
> is disabled by default. Please see
> ERROR - SharedResources -
> IResourceSettings.getParentFolderPlaceholder() and PackageResourceGuard for
> more details
> ERROR - SharedResources -
> ----------------------------------------------------------------------------------------
> WARN - PackageResource - Unable to find package resource [path
> = webresources/my.css, style = null, locale = null]
>
> Setting the parentFolderPlaceholder to $up$ and use
> "$up$/$up$/$up$/webresources/my.css" solved the error message display but
> the css
> is still not loaded.
>
> This was formerly working (wicket1.3.6). With wicket-1992 and wicket1.3.7
> it was disabled. But how can i load my css now?
>
> Cheers
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
------------------
Enjoy. Thanks!
Haulyn Microproduction
Mobile: +086-15864011231
email: saharabear@gmail.com,
hmp.haulyn@foxmail.com
website: http://haulynjason.net
gtalk: saharabear@gmail.com
yahoo: jia_haolin@yahoo.com
msn: saharabear@gmail.com
skype: saharabear
QQ: 378606292
Haulyn Jason