You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dennis Thrysøe <dt...@conscius.com> on 2004/04/01 09:41:17 UTC

Re: JSP problems

Dennis Thrysøe wrote:
> QM wrote:
> 
>> : [snip] the classes are declared in the package org.apache.jsp.
>> : : Any ideas, how I can make tomcat (jasper?) load the classes that 
>> it just : generated and then compiled?
>>
>> So then, you're precompiling the JSPs?
> 
> Nope. Just plain old JSP's in a webapp. Jasper generates servlets and 
> compiles them just fine. But it cannot load them. I get
> 
> java.lang.ClassNotFoundException: org.apache.jsp.index_jsp

I'm still having the problem. Is there anybody out there with a really 
detailed knowledge of how Jasper uses it's temp-dir?

What I experience is that Jasper compiles

   <webapp>/foo/index.jsp

into

   <work>/foo/index_jsp.class (which contains org.apache.jsp.index_jsp)

But Jasper's classloader doesn't seem able to load the file. Actually I 
see two problems here:

1) How can the classloader load a class in the org.apache.jsp package if 
the org/apache/jsp directory structure isn't present. Should this work?

2) What would the fully qualified classname of for instance 
<webapp>/bar/index.jsp be?


Thanks,

-dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: JSP Include and URL encoding

Posted by Dennis Thrysøe <dt...@conscius.com>.
Veniamin Fichin wrote:
> Dennis Thrysøe wrote:
> 
>> Hi,
>>
>> I'm having problems including a JSP page from another JSP page using 
>> parameters with special characters.
>>
>> I looked through the archives, but couldn't find anything about this 
>> issue.
> 
>    Try this URL: http://issues.apache.org/bugzilla/show_bug.cgi?id=23929 
> . Connector attributes mentioned there available since 5.0.19, as I 
> understand.

Thanks, that may be related. Perhaps it could override the VM's language 
properties. But we fixed it by changing those properties instead.

Besides the problem was on 4.1.29.


-dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: JSP Include and URL encoding

Posted by Veniamin Fichin <3c...@mail.ru>.
Dennis Thrysøe wrote:

> Hi,
> 
> I'm having problems including a JSP page from another JSP page using 
> parameters with special characters.
> 
> I looked through the archives, but couldn't find anything about this issue.

    Try this URL: 
http://issues.apache.org/bugzilla/show_bug.cgi?id=23929 . Connector 
attributes mentioned there available since 5.0.19, as I understand.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: JSP Include and URL encoding

Posted by Hiroshi Iwatani <HG...@nifty.ne.jp>.
Dennis Thrysøe wrote:
> Hiroshi Iwatani wrote:
> 
>> (1)Set page directive attributes right
>>    (Maybe, pageEncoding = your platform encoding and charset = UTF-8)
> 
> 
> They are correct. The generated servlet already contains the wrong value 
> '%3F'.
> 
>> (2)Use a Servlet/JSP container other than Tomcat. For example, Resin
>> from caucho.com.
Oh no! (1)+ (2) is a SET. Not separate issues. Tomcat JSP translator doesn't
use these page directive entries. So I called it substandard negligence.

Anyway, thanks for an enjoyable reply!

BTW, bugzilla 23929 OP is wrong.

> 
> 
> I guess that could be an option, but this Tomcat instance is running at 
> our service provider, so they would have to think so too.
> 
> The problem has now been fixed by setting the language and country 
> properties to 'da' and 'DK' respectively. This was apparently necesarry 
> for the JSP parser to read the file correctly.
> 
>>
>> <quote>
>> Scott Ferguson wrote:
>>
>>  > Actually, the underlying problem is a difficult one. Unfortunately, 
>> URLs
>>  > don't have an official character encoding. It looks like we're 
>> drifting
>>  > toward UTF-8 as a default, but that's not specified in the HTTP
>>  > specifications.
>>  >
>>  > Because the HTTP request does not specify the URL encoding, the web
>>  > server needs to guess. It's somewhat of an ugly problem.
> 
> 
> For JSP includes this doesn't seem to be the problem. It is because of 
> characters being replaced with '?' when reading the JSP.
> 
> 
> Thanks anyway,
> 
> 
> -dennis
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
Hiroshi Iwatani

*stop cruelty* Annual number of institutionally euthanized cats and dogs 
including kittens and puppies: US 5 million, JP 500 thousand. How about your 
country? *for our better karma*
---------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: JSP Include and URL encoding

Posted by Dennis Thrysøe <dt...@conscius.com>.
Hiroshi Iwatani wrote:
> (1)Set page directive attributes right
>    (Maybe, pageEncoding = your platform encoding and charset = UTF-8)

They are correct. The generated servlet already contains the wrong value 
'%3F'.

> (2)Use a Servlet/JSP container other than Tomcat. For example, Resin
> from caucho.com.

I guess that could be an option, but this Tomcat instance is running at 
our service provider, so they would have to think so too.

The problem has now been fixed by setting the language and country 
properties to 'da' and 'DK' respectively. This was apparently necesarry 
for the JSP parser to read the file correctly.

> 
> <quote>
> Scott Ferguson wrote:
> 
>  > Actually, the underlying problem is a difficult one. Unfortunately, URLs
>  > don't have an official character encoding. It looks like we're drifting
>  > toward UTF-8 as a default, but that's not specified in the HTTP
>  > specifications.
>  >
>  > Because the HTTP request does not specify the URL encoding, the web
>  > server needs to guess. It's somewhat of an ugly problem.

For JSP includes this doesn't seem to be the problem. It is because of 
characters being replaced with '?' when reading the JSP.


Thanks anyway,


-dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: JSP Include and URL encoding

Posted by Hiroshi Iwatani <HG...@nifty.ne.jp>.
(1)Set page directive attributes right
    (Maybe, pageEncoding = your platform encoding and charset = UTF-8)
(2)Use a Servlet/JSP container other than Tomcat. For example, Resin
from caucho.com.

<quote>
Scott Ferguson wrote:

 > Actually, the underlying problem is a difficult one. Unfortunately, URLs
 > don't have an official character encoding. It looks like we're drifting
 > toward UTF-8 as a default, but that's not specified in the HTTP
 > specifications.
 >
 > Because the HTTP request does not specify the URL encoding, the web
 > server needs to guess. It's somewhat of an ugly problem.
Today's JSPs have page directive, its contentType and pageEncoding
attributes. A server doesn't need to bring rabbit out of a hat. Simply
put in other words, Tomcat behavior is just substandard negligence.

I have noticed that servlet generated from JSP by Resin has correct
setCharacterEncoding() call even when the original JSP doesn't have
the call. Resin may be called 'superstandard.' :)

 > That somewhat translates into the Servlet/JSP forward/include issue.
 > Resin's approach is to realize that the Java string for the
 > URL/QueryString is 16-bits, so there's no need to do any encoding until
 > there's a sendRedirect or something similar.
 >
 > -- Scott
</quote>

Dennis Thrysøe wrote:
> Hi,
> 
> I'm having problems including a JSP page from another JSP page using 
> parameters with special characters.
> 
> I looked through the archives, but couldn't find anything about this issue.
> 
> I can encode a string, and the result is correct
> 
>   URLEncoder.encode("blåbærgrød", "ISO-8859-1")
> 
> But if I make an include with the same value
> 
>   <jsp:include page="bar.jsp" flush="true">
>     <jsp:param name="word" value="blåbærgrød" />
>   </jsp:include>
> 
> The special characters are replaced with question marks '?' (%3F). So 
> the query string seen from bar.jsp becomes
> 
>   word=bl%3Fb%3Frgr%3Fd
> 
> In fact the generated java code for the main jsp file contains this 
> string also. So the problem is already during parsing or servlet 
> generation.
> 
> The requests character encoding is null. The page directive's 
> pageEncoding attribute is "ISO-8859-1" (or not present - doesn't make a 
> difference.
> 
> The user properties user.country and user.language are 'US' and 'en' 
> respectively. Might that be the cause?
> 
> The problem is on Tomcat 4.1.29 on Linux.
> 
> 
> By the way: I still haven't figured out whether Tomcat 4.1.30 is 
> supposed to be able to run on JDK 1.3.1.
> 
> 
> Any help appreciated,
> 
> 
> -dennis
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

-- 
Hiroshi Iwatani

*stop cruelty* Annual number of institutionally euthanized cats and dogs 
including kittens and puppies: US 5 million, JP 500 thousand. How about your 
country? *for our better karma*
---------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


JSP Include and URL encoding

Posted by Dennis Thrysøe <dt...@conscius.com>.
Hi,

I'm having problems including a JSP page from another JSP page using 
parameters with special characters.

I looked through the archives, but couldn't find anything about this issue.

I can encode a string, and the result is correct

   URLEncoder.encode("blåbærgrød", "ISO-8859-1")

But if I make an include with the same value

   <jsp:include page="bar.jsp" flush="true">
     <jsp:param name="word" value="blåbærgrød" />
   </jsp:include>

The special characters are replaced with question marks '?' (%3F). So 
the query string seen from bar.jsp becomes

   word=bl%3Fb%3Frgr%3Fd

In fact the generated java code for the main jsp file contains this 
string also. So the problem is already during parsing or servlet generation.

The requests character encoding is null. The page directive's 
pageEncoding attribute is "ISO-8859-1" (or not present - doesn't make a 
difference.

The user properties user.country and user.language are 'US' and 'en' 
respectively. Might that be the cause?

The problem is on Tomcat 4.1.29 on Linux.


By the way: I still haven't figured out whether Tomcat 4.1.30 is 
supposed to be able to run on JDK 1.3.1.


Any help appreciated,


-dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: JSP problems

Posted by Dennis Thrysøe <dt...@conscius.com>.
Dennis Thrysøe wrote:
> Dennis Thrysøe wrote:
>> Nope. Just plain old JSP's in a webapp. Jasper generates servlets and 
>> compiles them just fine. But it cannot load them. I get
>>
>> java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
> 
> 
> I'm still having the problem. Is there anybody out there with a really 
> detailed knowledge of how Jasper uses it's temp-dir?

It seems that I just found a workaround for the issue: Use JDK 1.4.2 
instead of JDK 1.3.1.

Shouldn't TOmcat 4.1.30 be able to run on JDK 1.3.1?

-dennis

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org