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

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

by David Marginian-2 :: Rate this Message:

Reply to Author | View in Thread

You already asked this question on the list. No you are spamming the
list. "can't be showed" is not a good enough description to tell us what
you are doing wrong.

Have you actually looked at the HTML produced from the jsp (the id of the HTML elements)? Have you tried this from the DWR test page
(http://yourhost:yourport/yourapp/dwr/index.html)? Have you tried using firebug to look at the data being returned?  What gets alerted if you uncomment //alert(data);?  Try using alert(dwr.util.toDescriptiveString(data, 3)) instead.

The setValue function uses the id of the HTML element so if there is no element with an id of "formLogin:output" it will not populate the element (which is why I told you to look at the generated HTML and make sure this id exists).
dwr.util.setValue("formLogin:output", data);




王建志 wrote:

>
>
> ------------------------------------------------------------------------
> 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 轻松交流和共享! 立刻下载!
> <http://im.live.cn/>
> ------------------------------------------------------------------------
> MSN上小游戏,工作休闲两不误! 马上就开始玩! <http://im.live.cn/minigame>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...

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