• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't make .htc behavior work in jsp  RSS feed

 
anna_k
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having problem making a css behavior .htc work when the html is served from the servlet container. Here is what I am talking about:
I have a behavior (copied from Microsoft example) in "hilite.htc"
<public:component>
<public :property name="hilitecolor" value="#cccccc"/>
<public:attach event="onmouseover" onevent="Hilite()" />
<public:attach event="onmouseout" onevent="Restore()" />
<script language="Jscript">
var saveColor;

function Hilite()
{
saveColor = currentStyle.backgroundColor;

runtimeStyle.backgroundColor = hilitecolor;
}
function Restore()
{
runtimeStyle.backgroundColor = saveColor;
}
</script>
</public:component>
And "test.html":

<html>
<style type="text/css">
<!--
tr {behavior:url(hilite.htc);}
-->
</style>
<head>
<title>blah</title>
</head>
<body>
<table>
<tr>
<td> one</td>
<td> two</td>
</tr>
<tr hilitecolor="yellow" >
<td> three</td>
<td> four</td>
</tr>
<tr>
<td> five</td>
<td> six</td>
</tr>
</table>
</body>
<html>

If I browse "test.html" as a static html file using:
c:\behavior\test.html
the behavior works.
But if I place both "hilite.htc" and "test.html" in an web app and browse "test.html" through the servlet container:
http://localhost:8080/myapp/test.html
the behavior doesn't work! (I am using wl6.1 but I don't think the web container makes the difference) In both cases the .htc file is downloaded (just to make sure, I delete all temp. files in IE before I try). What do I need to do to make the .htc work from a JSP?
[This message has been edited by anna_k (edited October 28, 2001).]
 
Sreenivasa Majji
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Include your .htc file in the .jsp file using the page directive <%@ inlcude="your_htc_file" %>
Hope this helps,

------------------
Sreenivasa Kumar Majji
Sun Certified Java Programmer
SCJP Mock Test
[This message has been edited by sreenivasa majji (edited October 28, 2001).]
 
anna_k
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean <@ include file="the-htc-file" %>, ritht?
This just includes the htc file in the html before the JSP parse. This is not how the behavior file work. The behavior htc works like an image, it's download separately.
Anyone know htc stuff here?
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"anna_k"
Your name doesn't agree with the javaranch guidelines.
Please take a moment and re-register after reviewing the
guidelines at http://www.javaranch.com/name.jsp
Thanks for your cooperation.
- satya
 
alessandro_migliaccio
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added the following line to the web.xml file:
<mime-mapping>
<extension>htc</extension>
<mime-type>text/x-component</mime-type>
</mime-mapping>
It works for me.
Hope to be useful.
bye
Alessandro
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"alessandro_migliaccio"
Your name doesn't agree with the javaranch guidelines.
Please take a moment and change your "Publicly Displayed Name" by editing your profile after reviewing the guidelines at http://www.javaranch.com/name.jsp
Thanks for your cooperation.
- satya
 
mariolina irace
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by alessandro_migliaccio:
I added the following line to the web.xml file:
<mime-mapping>
<extension>htc</extension>
<mime-type>text/x-component</mime-type>
</mime-mapping>
It works for me.
Hope to be useful.
bye
Alessandro

Grazie ler la tua utile indicazione
Anche ad una neofita come me
mariolina
 
Grace Wee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having the same problem. But it still doesn't help after I set the mime type. I am using weblogic 6.1.
Anybody can help...
Thanks in advance.
 
Bethany Tee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Grace,
I'm curious were you able to solve your problem?
Bethany
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!