OK. I used the IHeader contributor and the problem still exist!

The error:

http-6789-2 ERROR html.WebPage -
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
http-6789-2 ERROR html.WebPage - You probably forgot to add a <body> or
<header> tag to your markup since no Header Container was 
found but components where found which want to write to the <head> section.
<script type="text/javascript"
src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script>
<script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
Wicket.Event.add(window, "load", function() { function removeBlur(checked) {
if(checked) {
document.getElementById('login_button').disabled = false;
} else {
document.getElementById('login_button').disabled = true;
} }
;});
/*-->]]>*/</script>


http-6789-2 ERROR html.WebPage -
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The html:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en"
          xmlns:wicket="http://wicket.apache.org/"; wicket:id="htmlTag" 
dir="ltr">  
  <head>
  
    <title wicket:id="title">title</title>
    
    <style type="text/css">
        body {background-color: #FFFFFF; font-family:verdana;}
        a {margin:0px 3px 0px 3px;}
        .link{  font-weight: bold; 
                        white-space: nowrap;
                        margin-left: 5px; 
                 }
        .center{ text-align: center;}
        .header {background:#FFFFFF; 
            border-bottom: rgb(51,102,204) solid 3px; 
                        width:100%;
                        line-height: 150%;
                        text-align: center;
        }
        .footer{background:rgb(204,236,255); 
            border-top: blue solid 3px; 
            text-align: center;
                        /* position:fixed; */
                        /* bottom:0px; */       
                        width:100%;
                        line-height: 125%; 
                }
                .form {
                        line-height: 150%;      
                        margin-bottom: 5px;
                }
                #submitButton {
                        width: 100px;
                }
    </style>
  </head>
  
  <body wicket:id="body" onload="JavaScript:removeBlur(false);">

The java:

        public void renderHead(IHeaderResponse response) {

                StringBuffer config = new StringBuffer();


                config.append("function removeBlur(checked) {\n");
                config.append("if(checked) {\n");
                config.append("document.getElementById('login_button').disabled 
=
false;\n");
                config.append("} else {\n");
                config.append("document.getElementById('login_button').disabled 
=
true;\n");
                config.append("} }\n");

                        response.renderOnLoadJavascript(config.toString());
                }

What am I doing wrong???



igor.vaynberg wrote:
> 
> huh? it did not create the file....your javascript will be inlined!
> 
> you are using the onloadjavascript which needs support for the onload
> event, which is why the wicket-event.js is included before your
> javascript.
> 
> all this is apparent just by looking at the output code, you can see
> your code being inlined...
> 
> -igor
> 
> On Tue, Oct 28, 2008 at 11:45 AM, eyalbenamram <[EMAIL PROTECTED]>
> wrote:
>>
>> OK. What if I want all the JS to be inline (no .js file to be made)?
>> I saw that wicket created a .js file...
>>
>>
>> igor.vaynberg wrote:
>>>
>>> response.renderOnLoadJavascript() takes just the javascript - like the
>>> javadoc says. no need for you to output the script tags.
>>>
>>> -igor
>>>
>>> On Tue, Oct 28, 2008 at 11:33 AM, eyalbenamram <[EMAIL PROTECTED]>
>>> wrote:
>>>>
>>>>        public void renderHead(IHeaderResponse response) {
>>>>
>>>>
>>>>                StringBuffer config = new StringBuffer();
>>>>
>>>>                config.append("<script language=\"JavaScript\">\n");
>>>>                config.append("function removeBlur(checked) {\n");
>>>>                config.append("if(checked) {\n");
>>>>
>>>> config.append("document.getElementById('login_button').disabled =
>>>> false;\n");
>>>>                config.append("} else {\n");
>>>>
>>>> config.append("document.getElementById('login_button').disabled =
>>>> true;\n");
>>>>                config.append("} }\n");
>>>>                config.append("</script>\n");
>>>>
>>>>                response.renderOnLoadJavascript(config.toString());
>>>>
>>>>
>>>>
>>>> igor.vaynberg wrote:
>>>>>
>>>>> what is your code look like?
>>>>>
>>>>> -igor
>>>>>
>>>>> On Tue, Oct 28, 2008 at 11:28 AM, eyalbenamram
>>>>> <[EMAIL PROTECTED]>
>>>>> wrote:
>>>>>>
>>>>>> Hi again,
>>>>>>
>>>>>> I used IHeaderContributer, and the javascript code is now garbled and
>>>>>> not
>>>>>> working.
>>>>>> Here is what I got:
>>>>>>
>>>>>> <script type="text/javascript"
>>>>>> src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script>
>>>>>> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>>>>> Wicket.Event.add(window, "load", function() { <script
>>>>>> language="JavaScript">
>>>>>> function removeBlur(checked) {
>>>>>> if(checked) {
>>>>>> document.getElementById('login_button').disabled = false;
>>>>>> } else {
>>>>>> document.getElementById('login_button').disabled = true;
>>>>>> } }
>>>>>> </script>
>>>>>> ;});
>>>>>> /*-->]]>*/</script>
>>>>>>
>>>>>>
>>>>>>
>>>>>> igor.vaynberg wrote:
>>>>>>>
>>>>>>> use iheadercontributor, that should work much better
>>>>>>>
>>>>>>> also make sure your page has <body> tag.
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On Tue, Oct 28, 2008 at 10:57 AM, eyalbenamram
>>>>>>> <[EMAIL PROTECTED]>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi
>>>>>>>> I am inserting javascript code like this:
>>>>>>>>
>>>>>>>>                StringBuffer config = new StringBuffer();
>>>>>>>>
>>>>>>>>                config.append("<script language=\"JavaScript\">\n");
>>>>>>>>                config.append("function onLoad() { getValue();
>>>>>>>> setTimeout(\"onRefresh();\","+ns.getAutoRefreshSecs()*1000+");
>>>>>>>> }\n");
>>>>>>>>                config.append("function onRefresh(){\n");
>>>>>>>>
>>>>>>>> config.append("document.getElementById('hiddenVar').value
>>>>>>>> =
>>>>>>>> document.getElementById('textString').value;\n");
>>>>>>>>                config.append("window.location.reload(); }\n");
>>>>>>>>                config.append("function getValue() {\n");
>>>>>>>>
>>>>>>>> config.append("document.getElementById('textString').value
>>>>>>>> =
>>>>>>>> document.getElementById('hiddenVar').value; }\n");
>>>>>>>>                config.append("</script>\n");
>>>>>>>>
>>>>>>>>                /*open to activate JS*/
>>>>>>>>                add(new StringHeaderContributor(config.toString()));
>>>>>>>>
>>>>>>>>
>>>>>>>> and receive an error in log file:
>>>>>>>>
>>>>>>>> http-6789-2 ERROR html.WebPage -
>>>>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>>>>> http-6789-2 ERROR html.WebPage - You probably forgot to add a
>>>>>>>> <body>
>>>>>>>> or
>>>>>>>> <header> tag to your markup since no Header Container was
>>>>>>>> found but components where found which want to write to the <head>
>>>>>>>> section.
>>>>>>>> <script language="JavaScript">
>>>>>>>> function removeBlur(checked) {
>>>>>>>> if(checked) {
>>>>>>>> document.getElementById('login_button').disabled = false;
>>>>>>>> } else {
>>>>>>>> document.getElementById('login_button').disabled = true;
>>>>>>>> } }
>>>>>>>> </script>
>>>>>>>>
>>>>>>>> although my html file contains a <head> tag, and the javascript
>>>>>>>> code
>>>>>>>> actually appears in the rendered page (when I look at the source of
>>>>>>>> the
>>>>>>>> page).
>>>>>>>>
>>>>>>>> any idea?
>>>>>>>>
>>>>>>>> Thanks,Eyal.
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20212650.html
>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20213238.html
>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20213326.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20213513.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20223155.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to