Javascript declaration in jspX files
Hello,
I have a problem with <script> tag in the jspX file.
When I include this declaration <script language="JavaScript" type="text/javascript" src="javascript/file.js"></script> or <script ..../>
in the jspx file (playing the role of a JSF page) the result is an uncorrect page. Only some parts are correctly rendered.
But when I do the same in classic JSP page, everything is correct.
Thank you for any response.
[552 byte] By [
tomla] at [2007-11-27 2:12:42]

# 2
I use it this way:
<?xml version="1.0" encoding="utf-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=utf-8"/>
<f:loadBundle basename="package.labels" var="labels"/>
<f:view>
<html>
<head>
<title>PAGE</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="cs" />
<link rel="SHORTCUT ICON" href="images/icon.gif"/>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="javascript/script.js"></script>
</head>
<body>
.
.
but it doesn't work in body neither.
I use JSF 1.2.
tomla at 2007-7-12 2:07:20 >

# 3
Well, I found what's wrong but don't know why it is wrong:
Doesn't work:
<?xml version="1.0" encoding="utf-8"?>
<jsp:root
.
.>
<script language="JavaScript" type="text/javascript" src="javascript/script.js"></script>
<h:form....>
<h:dataTable.....>
Works:
<?xml version="1.0" encoding="utf-8"?>
<jsp:root
.
.>
<h:form....>
<h:dataTable.....>
.
.
</h:form>
!!!!!! <script language="JavaScript" type="text/javascript" src="javascript/script.js"></script>
The problem seems to be the <script code...>
generated by JSF.
Is it a bug or do I do anything wrong?
tomla at 2007-7-12 2:07:20 >

# 4
Ok,another point:
I don't know who (IDEA,JSP compiler...) changes <script lang=""></script>
to <script lang="" />
That makes troubles in browser when followed by
<script lang=""..>
var foo = ...
</script>
So I changed
<script lang=""></script>
to
<script lang="">HELLO</script>
and it runs fine.
Can anybody explain me this strange behaviuor?
I'd like to do it correctly, this I consider only a hack.
Thank you
tomla at 2007-7-12 2:07:20 >
