« Return to Thread: [Help:] DWR integrates with jsf(myfaces) failed.

[Help:] DWR integrates with jsf(myfaces) failed.

by 王建志 :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.



Hi all,

Thank you in advanced.
When I try to integrates DWR with jsf(myfaces) I can get the data from back end.
But the data can't be showed successfully. No error message in server(tomcat 6) log.
The code line can't get the successful show.
<h:outputText id="output" value="User Home Address"/>
Here is my jsp code.

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>My JSF 'login.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
   
    <script type='text/javascript' src='/myjsf/dwr/interface/JHelloWorld.js'></script>
    <script type='text/javascript' src='/myjsf/dwr/engine.js'></script>
    <script type='text/javascript' src='/myjsf/dwr/util.js'></script>
    <script type="text/javascript">
        function callback() {
           //alert("here1");
           JHelloWorld.sayHelloWorld("ddd JavaTwo 2006", load);
        }
       
        function load(data) {
            //alert(data);
            //$('output').innerHTML = data;
            alert(document.getElementById('formLogin:output').innerHTML);
            //document.getElementById('formLogin:output').innerHTML= "Hello World!";
            //document.getElementById('formLogin:output').value = "Hello World!";
            //document.getElementById('output').innerText = "Hello World!";
            dwr.util.setValue("formLogin:output", data); //???
        }
    </script>
</head>
 
<body>
   
    <f:view>
        This is my JSF JSP page. <br>
        <h:form id="formLogin">
            <h:commandButton value="click on me!" onclick="callback()" /><br />
           
            <h:outputLabel for="address">
              <h:outputText id="output" value="User Home Address"/> <!-- can't be changed here -->
            </h:outputLabel>

            <h:commandButton value="check user!!!" action="#{login.checkUser}"></h:commandButton>
        </h:form>
    </f:view>
   
   
</body>
</html>

Thanks,
Jianzhi


使用新一代 Windows Live Messenger 轻松交流和共享! 立刻下载!

MSN上小游戏,工作休闲两不误! 马上就开始玩!

 « Return to Thread: [Help:] DWR integrates with jsf(myfaces) failed.