Re: JSP in Static Resources

2013-07-13 Thread Alireza Fattahi
Guys please concentrate on the main issue !!

I ask again:

When you set jsp servlet to process the css files by adding:

    jsp
    *.css



The tomcat does not set the CSS file extension mime type to text/css. Although 
below line is set in localhost-config/web.xml

    
    css
    text/css
    


When you manually set the content mime type <%@page contentType="text/css" %> 
every thing will work fine


~Regards,
~~Alireza Fattahi

tomcat 5.5.34

2013-07-13 Thread Christopher Valerio
Hi , I have an instance of tomcat that I need to clone, for developing 
purpose.  I change connectors port, I added a new Service with the command 
Tomcat5.exe //IS// and I added --Environment option to change CATALINA_BASE 
and CATALINA_HOME variables. I'm using windows server 2008 and isapi 
redirector with IIS 7. Event though it still is showing an error that ports 
are busy.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JSP in Static Resources

2013-07-13 Thread André Warnier

Terence M. Bandoian wrote:

On 7/13/2013 9:29 AM, André Warnier wrote:

Alireza Fattahi wrote:

Hi,

My situation is this:
The site which i work should work in RTL and LTR modes ( I am using
YAML for layout)

The site.css should have this for LTR:

@import url(../yaml/navigation/hlist.css);
@import url(../yaml/forms/gray-theme.css);
@import url(../yaml/screen/typography.css);
@import url(../yaml/screen/screen-FULLPAGE-layout.css);

for RTL it must have

@import url(../../yaml/add-ons/rtl-support/core/base-rtl.css);
@import url(../../yaml/add-ons/rtl-support/navigation/hlist-rtl.css);
@import url(../../yaml/add-ons/rtl-support/forms/gray-theme-rtl.css);   


So I want to path a parameter to CSS and do some thing like this:

http://www.mysite.com/site.css?direction=rtl

and in the CSS
@import
url(../../yaml/add-ons/rtl-support/core/base-<%=request.getParameter("direction")%>.css);


I donot want to to use if parameters in the jsp and do some thing
like this:
if request.getParameter("direction")="RTL"
{


}
else{


}

I agree that the above does not look very elegant.

I don't really know JSP syntax, but can't you do something like

.css" 
rel="stylesheet" type="text/css" />


I am looking at this from a naive point of view, and thinking about
the poor guys who are going to have to debug one of these pages in 12
month's time, and who'll have to figure out that the .css stylesheets
on that site are not, as usual, plain CSS files usable everywhere, but
have to be processed like JSP files.
(Also, if you ever have to give this to a graphic guy, he may have
some trouble working with this).
I guess that there is nothing wrong in the /principle/ of having a CSS
file being compiled into a servlet generating a CSS document, but
somehow it does not seem the most straightforward thing to do.





The problem is that, although you set the mime type of css to
text/css in web.xml. it does not take effect.
I just find a bad work around which you must put <%@page
contentType="text/css" %>in top of all css files

 
~Regards,

~~Alireza Fattahi



 From: André Warnier 
To: Tomcat Users List  Sent: Saturday, 13
July 2013, 14:21
Subject: Re: JSP in Static Resources
 


Alireza Fattahi wrote:

Hi,

I want to add some jsp code in to my site.css.

Maybe it is just me, but that does not seem to make any sense.
Usually, it would be the other way around.
Can you explain why you want to do this ?

The idea of JSP is to have Java code which in the end produces a HTML
page which is sent to the browser.  The JSP is compiled into a
servlet, which is executed when the browser "calls" that JSP page.
The servlet produces HTML, which is sent the browser.
The HTML page may contain links to CSS stylesheets, Javascript
libraries etc.
The browser retrieves these directly, as static objects, when it
finds a link in the HTML.
A CSS stylesheet is meant to provide instructions to the browser,
about how to /render/ (display nicely) the final product, which is
the HTML page (produced by the JSP/servlet).
I cannot really imagine a scenario in which having Java code in there
would make any sense.  At the very least, that would make the later
maintenance of that application hopelessly confusing.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org





JSP files may be used to generate any type of content dynamically -
HTML, JSON, CSS...  It's up to the programmer to make their usage clear
through the use of conventions, documentation, etc.


Yes, but experience says that they don't.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: ClassNotFoundException org.apache.juli.FileHandler in Tomcat 7.0.42 / OpenJDK 6 b27 (FreeBSD)

2013-07-13 Thread Mark Thomas
On 13/07/2013 20:39, Martin Gainty wrote:
> Matthias

You may have already realised it but it is generally best to ignore any
posts by Martin Gainty. They are rarely helpful, often confusing and
sometimes completely irrelevant.

Mark


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: ClassNotFoundException org.apache.juli.FileHandler in Tomcat 7.0.42 / OpenJDK 6 b27 (FreeBSD)

2013-07-13 Thread Martin Gainty
Matthias

MG>this is what $CATALINA_HOME/conf/logging.properties is SUPPOSED to look like

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
handlers = 1catalina.org.apache.juli.FileHandler, 
2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 
4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, 
java.util.logging.ConsoleHandler

# Handler specific properties.
# Describes specific configuration info for Handlers.

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


# Facility specific properties.
# Provides extra control for each logger.

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 
2localhost.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level 
= INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers
 = 3manager.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level
 = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers
 = 4host-manager.org.apache.juli.FileHandler
# For example, set the org.apache.catalina.util.LifecycleBase logger to log
# each component that extends LifecycleBase changing state:
#org.apache.catalina.util.LifecycleBase.level = FINE


 
> Date: Sat, 13 Jul 2013 20:04:15 +0200
> From: matth...@petermann-it.de
> To: users@tomcat.apache.org
> Subject: Re: ClassNotFoundException org.apache.juli.FileHandler in Tomcat 
> 7.0.42 / OpenJDK 6 b27 (FreeBSD)
> 
> Am 13.07.2013 16:07, schrieb Konstantin Kolinko:
> > 2013/7/13 Konstantin Kolinko :
> >> 2013/7/13 Matthias Petermann :
> >>> Hello,
> >>>
> >>> when I try to start Tomcat 7.0.42 with OpenJDK 6 b27, it complains about 
> >>> not
> >>> finding classes for the logging handlers. I created a minimal
> >>> logging.properties to narrow down the problem:
> >>>
> >>>  handlers = 1catalina.org.apache.juli.FileHandler,
> >>> java.util.logging.ConsoleHandler
> >>>  .handlers = java.util.logging.ConsoleHandler
> >>>
> >>>  1catalina.org.apache.juli.FileHandler.level = FINE
> >>>  1catalina.org.apache.juli.FileHandler.directory = 
> >>> ${catalina.base}/logs
> >>>  1catalina.org.apache.juli.FileHandler.prefix = catalinatest.
> >>>
> >>>  java.util.logging.ConsoleHandler.level = FINE
> >>>  java.util.logging.ConsoleHandler.formatter =
> >>> java.util.logging.SimpleFormatter
> >>>
> >>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
> >>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
> >>> 1catalina.org.apache.juli.FileHandler
> >>>
> >>> The output of "./catalina.sh run" is the following:
> >>>
> >>>  INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
> >>>  Can't load log handler "1catalina.org.apache.juli.FileHandler"
> >>>  java.lang.ClassNotFoundException: 
> >>> 1catalina.org.apache.juli.FileHandler
> >>>  java.lang.ClassNotFoundException: 
> >>> 1catalina.org.apache.juli.FileHandler
> >>>  at java.net.URLClassLoad

Re: JSP in Static Resources

2013-07-13 Thread Terence M. Bandoian
On 7/13/2013 9:29 AM, André Warnier wrote:
> Alireza Fattahi wrote:
>> Hi,
>>
>> My situation is this:
>> The site which i work should work in RTL and LTR modes ( I am using
>> YAML for layout)
>>
>> The site.css should have this for LTR:
>>
>> @import url(../yaml/navigation/hlist.css);
>> @import url(../yaml/forms/gray-theme.css);
>> @import url(../yaml/screen/typography.css);
>> @import url(../yaml/screen/screen-FULLPAGE-layout.css);
>>
>> for RTL it must have
>>
>> @import url(../../yaml/add-ons/rtl-support/core/base-rtl.css);
>> @import url(../../yaml/add-ons/rtl-support/navigation/hlist-rtl.css);
>> @import url(../../yaml/add-ons/rtl-support/forms/gray-theme-rtl.css);   
>>
>> So I want to path a parameter to CSS and do some thing like this:
>>
>> http://www.mysite.com/site.css?direction=rtl
>>
>> and in the CSS
>> @import
>> url(../../yaml/add-ons/rtl-support/core/base-<%=request.getParameter("direction")%>.css);
>>
>>
>> I donot want to to use if parameters in the jsp and do some thing
>> like this:
>> if request.getParameter("direction")="RTL"
>> {
>> 
>>
>> }
>> else{
>> 
>>
>> }
>
> I agree that the above does not look very elegant.
>
> I don't really know JSP syntax, but can't you do something like
>
> .css" 
> rel="stylesheet" type="text/css" />
>
> I am looking at this from a naive point of view, and thinking about
> the poor guys who are going to have to debug one of these pages in 12
> month's time, and who'll have to figure out that the .css stylesheets
> on that site are not, as usual, plain CSS files usable everywhere, but
> have to be processed like JSP files.
> (Also, if you ever have to give this to a graphic guy, he may have
> some trouble working with this).
> I guess that there is nothing wrong in the /principle/ of having a CSS
> file being compiled into a servlet generating a CSS document, but
> somehow it does not seem the most straightforward thing to do.
>
>
>
>>
>>
>> The problem is that, although you set the mime type of css to
>> text/css in web.xml. it does not take effect.
>> I just find a bad work around which you must put <%@page
>> contentType="text/css" %>in top of all css files
>>
>>  
>> ~Regards,
>> ~~Alireza Fattahi
>>
>>
>> 
>>  From: André Warnier 
>> To: Tomcat Users List  Sent: Saturday, 13
>> July 2013, 14:21
>> Subject: Re: JSP in Static Resources
>>  
>>
>> Alireza Fattahi wrote:
>>> Hi,
>>>
>>> I want to add some jsp code in to my site.css.
>>
>> Maybe it is just me, but that does not seem to make any sense.
>> Usually, it would be the other way around.
>> Can you explain why you want to do this ?
>>
>> The idea of JSP is to have Java code which in the end produces a HTML
>> page which is sent to the browser.  The JSP is compiled into a
>> servlet, which is executed when the browser "calls" that JSP page.
>> The servlet produces HTML, which is sent the browser.
>> The HTML page may contain links to CSS stylesheets, Javascript
>> libraries etc.
>> The browser retrieves these directly, as static objects, when it
>> finds a link in the HTML.
>> A CSS stylesheet is meant to provide instructions to the browser,
>> about how to /render/ (display nicely) the final product, which is
>> the HTML page (produced by the JSP/servlet).
>> I cannot really imagine a scenario in which having Java code in there
>> would make any sense.  At the very least, that would make the later
>> maintenance of that application hopelessly confusing.
>>
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


JSP files may be used to generate any type of content dynamically -
HTML, JSON, CSS...  It's up to the programmer to make their usage clear
through the use of conventions, documentation, etc.

-Terence Bandoian


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: ClassNotFoundException org.apache.juli.FileHandler in Tomcat 7.0.42 / OpenJDK 6 b27 (FreeBSD)

2013-07-13 Thread Matthias Petermann

Am 13.07.2013 16:07, schrieb Konstantin Kolinko:

2013/7/13 Konstantin Kolinko :

2013/7/13 Matthias Petermann :

Hello,

when I try to start Tomcat 7.0.42 with OpenJDK 6 b27, it complains about not
finding classes for the logging handlers. I created a minimal
logging.properties to narrow down the problem:

 handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
 .handlers = java.util.logging.ConsoleHandler

 1catalina.org.apache.juli.FileHandler.level = FINE
 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
 1catalina.org.apache.juli.FileHandler.prefix = catalinatest.

 java.util.logging.ConsoleHandler.level = FINE
 java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
1catalina.org.apache.juli.FileHandler

The output of "./catalina.sh run" is the following:

 INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
 Can't load log handler "1catalina.org.apache.juli.FileHandler"
 java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
 java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
 at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
 at java.util.logging.LogManager$3.run(LogManager.java:654)
 at java.security.AccessController.doPrivileged(Native Method)
 at
java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:641)
 at java.util.logging.LogManager.access$900(LogManager.java:150)
 at
java.util.logging.LogManager$LoggerContext.addLogger(LogManager.java:437)
 at
java.util.logging.LogManager$UserLoggerContext.demandLogger(LogManager.java:596)
 at
java.util.logging.LogManager$LoggerContext.demandLogger(LogManager.java:475)
 at java.util.logging.Logger.getLogger(Logger.java:329)
 at org.apache.juli.logging.DirectJDKLog.(DirectJDKLog.java:71)
 at
org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:196)
 at
org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:170)
 at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:311)
 at
org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:452)
 at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1102)
 at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
 at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
 at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
 at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
 at java.util.concurrent.FutureTask.run(FutureTask.java:166)
 at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
 at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:679)

There can be found many mentions on this topic on the web, each of them
proposing one of those solutions which I tried:

  * Check/set JAVA_HOME / JRE_HOME

 $ export JAVA_HOME=/usr/local/openjdk6/
 $ export JRE_HOME=/usr/local/openjdk6/jre/

  * Check/set CATALINA_HOME

 $ export
CATALINA_HOME=/home/mpeterma/System/Apps/apache-tomcat-7.0.42

  * Ensure LOGGING_CONFIG and LOGGING_MANAGER are set properly

 --> validated, LOGGING_MANAGER is set to
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager in
catalina.sh if unspecified, which should be correct; LOGGING_CONFIG is found
because it contains the handlers where Tomcat complains about

  * Ensure tomcat-juli.jar is in the classpath

 --> validated, it's using
/home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/bootstrap.jar:/home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/tomcat-juli.jar

  * Place tomcat-juli.jar into Tomcat lib folder  --> tested, unsuccessful
  * Place tomcat-juli.jar into OpenJDK / JRE lib folder(s) --> tested,
unsuccessful

None of this proposals fixed the problem for me. When I comment out the
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].* -lines from
logging.properties, the problem disappears. Anyway - this is not a solution
as the logging is not working then.

The only workaround which *is* working is to use OpenJDK 7 instead of
OpenJDK 6. But I would like t

Re: Moving Tomcat to work externally.

2013-07-13 Thread Terence M. Bandoian
On 7/12/2013 10:52 AM, Terence M. Bandoian wrote:
> On 7/11/2013 6:46 PM, Mark Eggers wrote:
>> Comments mostly inline.
>>
>> Lots at the end - channeling James Fenimore Cooper.
>>
>> On 7/11/2013 3:26 PM, Mark Eggers wrote:
>>> On 7/11/2013 3:06 PM, Caldarale, Charles R wrote:
> From: john Matlock [mailto:johndmatl...@gmail.com] Subject: Re:
> Moving Tomcat to work externally.
>> Remove the ROOT directory from Tomcat's webapps directory,
>> replacing it with your webapp renamed to ROOT.war (or, if it's
>> already an expanded .war file, put it in the ROOT directory under
>> webapps).
> Do I understand that you are telling me to put the whole web
> application into the webapps/ROOT directory?
 That's what the ROOT webapp is for - it's the default webapp.  If the
 application is packaged as a .war file, just copy it to
 webapps/ROOT.war, and delete the existing ROOT directory.

> That's a couple of hundred pages and several sub-directories just
> for the main application.
 Why is that relevant?

> And I have to move another half dozen applications to Tomcat as
> well.
>>> Define applications. From my quick reading of the railo documentation,
>>> you can different scenarios
>>>
>>> 1. one railo administrator and one application (site ?) per
>>> administrator
>>> 2. one railo administrator and multiple applications (sites ?)
>>>
>>> The first is easy to set up, but it will probably be memory-expensive.
>>>
>>> The second is more complex to set up, and once again the railo
>>> documentation really advocates some practices that not good practices.
>>>
>> Never mind. Railo sets up each application in its own  (at least
>> from the examples).
>>
>> You could run multiple railo applications in one . You would
>> just copy railo.war to appname.war and place it in your webapps
>> directory.
>>
 If your applications are organized properly, that is each in their
 own subdirectory under a common directory, with nothing but the
 webapps under the common directory, then just change the appBase
 attribute in the  element to point there.  Your default webapp
 must still be named ROOT (case sensitive).

> Further these are almost all dynamic pages, and I may be incorrect,
> but I've read that .war files can only contain static web pages.
 You're definitely reading garbage somewhere.  If that were the case,
 there would be no reason to have anything other than a standard web
 server, such as httpd.  A .war file will normally contain a
 collection of servlets, JSPs, static pages, configuration files, and
 any other resources needed by the webapp.

> These are all in ColdFusion.
>> This is almost exactly but not quite like JSF. It's more like PHP, or
>> various tag libraries with JSP.
>>
>> In short, WAR files can happily serve dynamic content. Actually, the
>> files get processed on the server and the resulting HTML gets sent to
>> the client.
>>
 How a .war file or webapp was created is also not relevant, once it
 exists.

> Is my understanding incorrect, and somehow this can connect to
> Railo to handle the database interaction?
>>> It looks like railo manages its own database connections. So if the
>>> railo infrastructure is there, the connections should work.
>>>
 I have no idea about Railo, but Mark E did a pretty good job of
 explaining how to make it work.

>>> Thanks. With the latest message (I'm writing a reply to it as well),
>>> there are some wrinkles. These are all due to the way railo is written.
>>>
>>> For multiple web applications using the same railo administrator, set up
>>> and configuration will get a bit messy (as in not best practices messy).
>>>
>> What URL did you try to use?
> www.books-on-line.com
>>> It looks like the current site isn't running.
>>>
 That's not a complete URL, since you're missing the scheme (usually
 http).  Assuming you are using http (not https), you'll be sending a
 request for the default webapp's welcome page to port 80 at whatever
 IP address the client machine evaluates www.books-on-line.com as.
 Verify that the client can resolve www.books-on-line.com into the IP
 address you expect.  Since you have nothing after the domain name,
 you must have a ROOT webapp deployed in order to get a response.

>> What port is specified in server.xml?
> 80 -- localhost:80 works, localhost:8080 doesn't.
 Ok, that's good.

>> Is there a firewall blocking that port?
> There's a hole in the firewall to let page requests through to the
> on-line server.
>> Register the DNS name for your server with your DNS providers.
> This site is about 17 years old with several million home page
> hits.  I think it is registered.
 But it sounds like you're expecting requests to magically appear at
 the new server when the old one is still running.  If that

Re: JSP in Static Resources

2013-07-13 Thread André Warnier

Alireza Fattahi wrote:

Hi,

My situation is this:
The site which i work should work in RTL and LTR modes ( I am using YAML for 
layout)

The site.css should have this for LTR:

@import url(../yaml/navigation/hlist.css);
@import url(../yaml/forms/gray-theme.css);
@import url(../yaml/screen/typography.css);
@import url(../yaml/screen/screen-FULLPAGE-layout.css);

for RTL it must have

@import url(../../yaml/add-ons/rtl-support/core/base-rtl.css);
@import url(../../yaml/add-ons/rtl-support/navigation/hlist-rtl.css);
@import url(../../yaml/add-ons/rtl-support/forms/gray-theme-rtl.css);



So I want to path a parameter to CSS and do some thing like this:

http://www.mysite.com/site.css?direction=rtl

and in the CSS
@import 
url(../../yaml/add-ons/rtl-support/core/base-<%=request.getParameter("direction")%>.css);


I donot want to to use if parameters in the jsp and do some thing like this:
if request.getParameter("direction")="RTL"
{


}
else{


}


I agree that the above does not look very elegant.

I don't really know JSP syntax, but can't you do something like

.css"  rel="stylesheet" 
type="text/css" />


I am looking at this from a naive point of view, and thinking about the poor guys who are 
going to have to debug one of these pages in 12 month's time, and who'll have to figure 
out that the .css stylesheets on that site are not, as usual, plain CSS files usable 
everywhere, but have to be processed like JSP files.
(Also, if you ever have to give this to a graphic guy, he may have some trouble working 
with this).
I guess that there is nothing wrong in the /principle/ of having a CSS file being compiled 
into a servlet generating a CSS document, but somehow it does not seem the most 
straightforward thing to do.







The problem is that, although you set the mime type of css to text/css in 
web.xml. it does not take effect.
I just find a bad work around which you must put <%@page contentType="text/css" 
%>in top of all css files

 
~Regards,

~~Alireza Fattahi



 From: André Warnier 
To: Tomcat Users List  
Sent: Saturday, 13 July 2013, 14:21

Subject: Re: JSP in Static Resources
 


Alireza Fattahi wrote:

Hi,

I want to add some jsp code in to my site.css.


Maybe it is just me, but that does not seem to make any sense.
Usually, it would be the other way around.
Can you explain why you want to do this ?

The idea of JSP is to have Java code which in the end produces a HTML page which is sent 
to the browser.  The JSP is compiled into a servlet, which is executed when the browser 
"calls" that JSP page. The servlet produces HTML, which is sent the browser.

The HTML page may contain links to CSS stylesheets, Javascript libraries etc.
The browser retrieves these directly, as static objects, when it finds a link 
in the HTML.
A CSS stylesheet is meant to provide instructions to the browser, about how to /render/ 
(display nicely) the final product, which is the HTML page (produced by the JSP/servlet).
I cannot really imagine a scenario in which having Java code in there would make any 
sense.  At the very least, that would make the later maintenance of that application 
hopelessly confusing.




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: ClassNotFoundException org.apache.juli.FileHandler in Tomcat 7.0.42 / OpenJDK 6 b27 (FreeBSD)

2013-07-13 Thread Konstantin Kolinko
2013/7/13 Konstantin Kolinko :
> 2013/7/13 Matthias Petermann :
>> Hello,
>>
>> when I try to start Tomcat 7.0.42 with OpenJDK 6 b27, it complains about not
>> finding classes for the logging handlers. I created a minimal
>> logging.properties to narrow down the problem:
>>
>> handlers = 1catalina.org.apache.juli.FileHandler,
>> java.util.logging.ConsoleHandler
>> .handlers = java.util.logging.ConsoleHandler
>>
>> 1catalina.org.apache.juli.FileHandler.level = FINE
>> 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
>> 1catalina.org.apache.juli.FileHandler.prefix = catalinatest.
>>
>> java.util.logging.ConsoleHandler.level = FINE
>> java.util.logging.ConsoleHandler.formatter =
>> java.util.logging.SimpleFormatter
>>
>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
>> 1catalina.org.apache.juli.FileHandler
>>
>> The output of "./catalina.sh run" is the following:
>>
>> INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
>> Can't load log handler "1catalina.org.apache.juli.FileHandler"
>> java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
>> java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>> at java.util.logging.LogManager$3.run(LogManager.java:654)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:641)
>> at java.util.logging.LogManager.access$900(LogManager.java:150)
>> at
>> java.util.logging.LogManager$LoggerContext.addLogger(LogManager.java:437)
>> at
>> java.util.logging.LogManager$UserLoggerContext.demandLogger(LogManager.java:596)
>> at
>> java.util.logging.LogManager$LoggerContext.demandLogger(LogManager.java:475)
>> at java.util.logging.Logger.getLogger(Logger.java:329)
>> at org.apache.juli.logging.DirectJDKLog.(DirectJDKLog.java:71)
>> at
>> org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:196)
>> at
>> org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:170)
>> at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:311)
>> at
>> org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:452)
>> at
>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1102)
>> at
>> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
>> at
>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>> at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
>> at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
>> at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>> at java.lang.Thread.run(Thread.java:679)
>>
>> There can be found many mentions on this topic on the web, each of them
>> proposing one of those solutions which I tried:
>>
>>  * Check/set JAVA_HOME / JRE_HOME
>>
>> $ export JAVA_HOME=/usr/local/openjdk6/
>> $ export JRE_HOME=/usr/local/openjdk6/jre/
>>
>>  * Check/set CATALINA_HOME
>>
>> $ export
>> CATALINA_HOME=/home/mpeterma/System/Apps/apache-tomcat-7.0.42
>>
>>  * Ensure LOGGING_CONFIG and LOGGING_MANAGER are set properly
>>
>> --> validated, LOGGING_MANAGER is set to
>> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager in
>> catalina.sh if unspecified, which should be correct; LOGGING_CONFIG is found
>> because it contains the handlers where Tomcat complains about
>>
>>  * Ensure tomcat-juli.jar is in the classpath
>>
>> --> validated, it's using
>> /home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/bootstrap.jar:/home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/tomcat-juli.jar
>>
>>  * Place tomcat-juli.jar into Tomcat lib folder  --> tested, unsuccessful
>>  * Place tomcat-juli.jar into OpenJDK / JRE lib folder(s) --> tested,
>>unsuccessful
>>
>> None of this proposals fixed the problem for me. When I comment out the
>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].* -lines from
>> logging.properties

Re: ClassNotFoundException org.apache.juli.FileHandler in Tomcat 7.0.42 / OpenJDK 6 b27 (FreeBSD)

2013-07-13 Thread Konstantin Kolinko
2013/7/13 Matthias Petermann :
> Hello,
>
> when I try to start Tomcat 7.0.42 with OpenJDK 6 b27, it complains about not
> finding classes for the logging handlers. I created a minimal
> logging.properties to narrow down the problem:
>
> handlers = 1catalina.org.apache.juli.FileHandler,
> java.util.logging.ConsoleHandler
> .handlers = java.util.logging.ConsoleHandler
>
> 1catalina.org.apache.juli.FileHandler.level = FINE
> 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
> 1catalina.org.apache.juli.FileHandler.prefix = catalinatest.
>
> java.util.logging.ConsoleHandler.level = FINE
> java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
>
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
> 1catalina.org.apache.juli.FileHandler
>
> The output of "./catalina.sh run" is the following:
>
> INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
> Can't load log handler "1catalina.org.apache.juli.FileHandler"
> java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
> java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
> at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at java.util.logging.LogManager$3.run(LogManager.java:654)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:641)
> at java.util.logging.LogManager.access$900(LogManager.java:150)
> at
> java.util.logging.LogManager$LoggerContext.addLogger(LogManager.java:437)
> at
> java.util.logging.LogManager$UserLoggerContext.demandLogger(LogManager.java:596)
> at
> java.util.logging.LogManager$LoggerContext.demandLogger(LogManager.java:475)
> at java.util.logging.Logger.getLogger(Logger.java:329)
> at org.apache.juli.logging.DirectJDKLog.(DirectJDKLog.java:71)
> at
> org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:196)
> at
> org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:170)
> at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:311)
> at
> org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:452)
> at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1102)
> at
> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:679)
>
> There can be found many mentions on this topic on the web, each of them
> proposing one of those solutions which I tried:
>
>  * Check/set JAVA_HOME / JRE_HOME
>
> $ export JAVA_HOME=/usr/local/openjdk6/
> $ export JRE_HOME=/usr/local/openjdk6/jre/
>
>  * Check/set CATALINA_HOME
>
> $ export
> CATALINA_HOME=/home/mpeterma/System/Apps/apache-tomcat-7.0.42
>
>  * Ensure LOGGING_CONFIG and LOGGING_MANAGER are set properly
>
> --> validated, LOGGING_MANAGER is set to
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager in
> catalina.sh if unspecified, which should be correct; LOGGING_CONFIG is found
> because it contains the handlers where Tomcat complains about
>
>  * Ensure tomcat-juli.jar is in the classpath
>
> --> validated, it's using
> /home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/bootstrap.jar:/home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/tomcat-juli.jar
>
>  * Place tomcat-juli.jar into Tomcat lib folder  --> tested, unsuccessful
>  * Place tomcat-juli.jar into OpenJDK / JRE lib folder(s) --> tested,
>unsuccessful
>
> None of this proposals fixed the problem for me. When I comment out the
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].* -lines from
> logging.properties, the problem disappears. Anyway - this is not a solution
> as the logging is not working then.
>
> The only workaround which *is* working

Re: JSP in Static Resources

2013-07-13 Thread Konstantin Kolinko
2013/7/13 Alireza Fattahi :
> Hi,
>
>
> I copied below in my web.xml
>
> 
> 
> *.css
> text/css
> 
>  
>
> It did not helped ?! Is it a config for tomcat 7. I am using tomcat 6.
> The eclipse says that   is invalid.
>

Yes, it is from JSP 2.2 which requires Servlet 3.0 / Tomcat 7.

For Tomcat 6 maybe you could make use of  include-prelude  element,
though it is a bit more work.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



ClassNotFoundException org.apache.juli.FileHandler in Tomcat 7.0.42 / OpenJDK 6 b27 (FreeBSD)

2013-07-13 Thread Matthias Petermann

Hello,

when I try to start Tomcat 7.0.42 with OpenJDK 6 b27, it complains about 
not finding classes for the logging handlers. I created a minimal 
logging.properties to narrow down the problem:


handlers = 1catalina.org.apache.juli.FileHandler, 
java.util.logging.ConsoleHandler

.handlers = java.util.logging.ConsoleHandler

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalinatest.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = 
java.util.logging.SimpleFormatter


org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 
1catalina.org.apache.juli.FileHandler


The output of "./catalina.sh run" is the following:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Can't load log handler "1catalina.org.apache.juli.FileHandler"
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.util.logging.LogManager$3.run(LogManager.java:654)
at java.security.AccessController.doPrivileged(Native Method)
at 
java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:641)

at java.util.logging.LogManager.access$900(LogManager.java:150)
at 
java.util.logging.LogManager$LoggerContext.addLogger(LogManager.java:437)
at 
java.util.logging.LogManager$UserLoggerContext.demandLogger(LogManager.java:596)
at 
java.util.logging.LogManager$LoggerContext.demandLogger(LogManager.java:475)

at java.util.logging.Logger.getLogger(Logger.java:329)
at 
org.apache.juli.logging.DirectJDKLog.(DirectJDKLog.java:71)
at 
org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:196)
at 
org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:170)

at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:311)
at 
org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:452)
at 
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1102)
at 
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:679)

There can be found many mentions on this topic on the web, each of them 
proposing one of those solutions which I tried:


 * Check/set JAVA_HOME / JRE_HOME

$ export JAVA_HOME=/usr/local/openjdk6/
$ export JRE_HOME=/usr/local/openjdk6/jre/

 * Check/set CATALINA_HOME

$ export 
CATALINA_HOME=/home/mpeterma/System/Apps/apache-tomcat-7.0.42


 * Ensure LOGGING_CONFIG and LOGGING_MANAGER are set properly

--> validated, LOGGING_MANAGER is set to 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager in 
catalina.sh if unspecified, which should be correct; LOGGING_CONFIG is 
found because it contains the handlers where Tomcat complains about


 * Ensure tomcat-juli.jar is in the classpath

--> validated, it's using 
/home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/bootstrap.jar:/home/mpeterma/System/Apps/apache-tomcat-7.0.42/bin/tomcat-juli.jar


 * Place tomcat-juli.jar into Tomcat lib folder  --> tested, unsuccessful
 * Place tomcat-juli.jar into OpenJDK / JRE lib folder(s) --> tested,
   unsuccessful

None of this proposals fixed the problem for me. When I comment out the 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].* -lines 
from logging.properties, the problem disappears. Anyway - this is not a 
solution as the logging is not working then.


The only workaround which *is* working is to use OpenJDK 7 instead of 
OpenJDK 6. But I would like to make it run on OpenJDK 6.


$ java -version
openjdk version "1.6.0_32"
OpenJDK Runtime Environment (build 1

Re: JSP in Static Resources

2013-07-13 Thread Konstantin Kolinko
2013/7/13 Alireza Fattahi :
> Hi,
>
> My situation is this:
> The site which i work should work in RTL and LTR modes ( I am using YAML for 
> layout)
>
> The site.css should have this for LTR:
>
> @import url(../yaml/navigation/hlist.css);
> @import url(../yaml/forms/gray-theme.css);
> @import url(../yaml/screen/typography.css);
> @import url(../yaml/screen/screen-FULLPAGE-layout.css);
>
> for RTL it must have
>
> @import url(../../yaml/add-ons/rtl-support/core/base-rtl.css);
> @import url(../../yaml/add-ons/rtl-support/navigation/hlist-rtl.css);
> @import url(../../yaml/add-ons/rtl-support/forms/gray-theme-rtl.css);
>
>
> So I want to path a parameter to CSS and do some thing like this:
>
> http://www.mysite.com/site.css?direction=rtl
>
> and in the CSS
> @import 
> url(../../yaml/add-ons/rtl-support/core/base-<%=request.getParameter("direction")%>.css);
>
>
> I donot want to to use if parameters in the jsp and do some thing like this:
> if request.getParameter("direction")="RTL"
> {
> 
>
> }
> else{
> 
>
> }
>
>
> The problem is that, although you set the mime type of css to text/css in 
> web.xml. it does not take effect.
> I just find a bad work around which you must put <%@page 
> contentType="text/css" %>in top of all css files
>
>


1.


*.css
text/css



Adding above to your WEB-INF/web.xml should both implicitly map your
*.css files to a JSP servlet (no explicit servlet-mapping is needed)
and set default content-type for them.

2. mime-mapping is useless here. It is used when serving static
resources (be DefaultServlet) only.

Moreover, such mapping is already present in conf/web.xml (which
provides site-wide defaults). That is if you are using 7.0.42. You
have not mentioned your version of Tomcat.

3. Top-posting is bad.
http://tomcat.apache.org/lists.html#tomcat-users
-> "6."

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JSP in Static Resources

2013-07-13 Thread Alireza Fattahi
Hi,

My situation is this:
The site which i work should work in RTL and LTR modes ( I am using YAML for 
layout)

The site.css should have this for LTR:

@import url(../yaml/navigation/hlist.css);
@import url(../yaml/forms/gray-theme.css);
@import url(../yaml/screen/typography.css);
@import url(../yaml/screen/screen-FULLPAGE-layout.css);

for RTL it must have

@import url(../../yaml/add-ons/rtl-support/core/base-rtl.css);
@import url(../../yaml/add-ons/rtl-support/navigation/hlist-rtl.css);
@import url(../../yaml/add-ons/rtl-support/forms/gray-theme-rtl.css);    


So I want to path a parameter to CSS and do some thing like this:

http://www.mysite.com/site.css?direction=rtl

and in the CSS
@import 
url(../../yaml/add-ons/rtl-support/core/base-<%=request.getParameter("direction")%>.css);


I donot want to to use if parameters in the jsp and do some thing like this:
if request.getParameter("direction")="RTL"
{


}
else{


}


The problem is that, although you set the mime type of css to text/css in 
web.xml. it does not take effect.
I just find a bad work around which you must put <%@page contentType="text/css" 
%>in top of all css files

 
~Regards,
~~Alireza Fattahi



 From: André Warnier 
To: Tomcat Users List  
Sent: Saturday, 13 July 2013, 14:21
Subject: Re: JSP in Static Resources
 

Alireza Fattahi wrote:
> Hi,
> 
> I want to add some jsp code in to my site.css.

Maybe it is just me, but that does not seem to make any sense.
Usually, it would be the other way around.
Can you explain why you want to do this ?

The idea of JSP is to have Java code which in the end produces a HTML page 
which is sent 
to the browser.  The JSP is compiled into a servlet, which is executed when the 
browser 
"calls" that JSP page. The servlet produces HTML, which is sent the browser.
The HTML page may contain links to CSS stylesheets, Javascript libraries etc.
The browser retrieves these directly, as static objects, when it finds a link 
in the HTML.
A CSS stylesheet is meant to provide instructions to the browser, about how to 
/render/ 
(display nicely) the final product, which is the HTML page (produced by the 
JSP/servlet).
I cannot really imagine a scenario in which having Java code in there would 
make any 
sense.  At the very least, that would make the later maintenance of that 
application 
hopelessly confusing.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Re: JSP in Static Resources

2013-07-13 Thread André Warnier

Alireza Fattahi wrote:

Hi,

I want to add some jsp code in to my site.css.


Maybe it is just me, but that does not seem to make any sense.
Usually, it would be the other way around.
Can you explain why you want to do this ?

The idea of JSP is to have Java code which in the end produces a HTML page which is sent 
to the browser.  The JSP is compiled into a servlet, which is executed when the browser 
"calls" that JSP page. The servlet produces HTML, which is sent the browser.

The HTML page may contain links to CSS stylesheets, Javascript libraries etc.
The browser retrieves these directly, as static objects, when it finds a link 
in the HTML.
A CSS stylesheet is meant to provide instructions to the browser, about how to /render/ 
(display nicely) the final product, which is the HTML page (produced by the JSP/servlet).
I cannot really imagine a scenario in which having Java code in there would make any 
sense.  At the very least, that would make the later maintenance of that application 
hopelessly confusing.




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



JSP in Static Resources

2013-07-13 Thread Alireza Fattahi
Hi,

I want to add some jsp code in to my site.css.

So, as this is a static resource I add below to my web.xml and ask tomcat to 
compile it as a jsp.
    
    jsp
    *.css
    


When I view the site in firefox it shows an error which says:
[11:46:41.547] The stylesheet site.css was not loaded because its MIME type, 
"text/html", is not "text/css". @ chrome://fdm_ffext/content/fdm_brcache.js:86

 
I have added below to web.xml
    
    css
    text/css
        

It did not helped. The site pages link to css as below:



When I remove the servlet mapping and mime-mapping everything works fine. So I 
believe the mime type is not set correctly for css files.
Any comments ?!


~Regards,
~~Alireza Fattahi