开发者

GWT : How to Read Hidden Box value?

I Have a hidden box in my HTML. How I can get it value in my GWT when onModuleLoad??

the hidden box will content a value pass from another page. Now I can see the hidden box content the value but I fail to get the value in my GWT onModuleLoad.

HTML page:

 <%
String sSessionID=request.getParameter("NA_SessionID");
if(sSessionID==null) 
    session.setAttribute("NetAdminSession",(String)session.getAttribut开发者_如何学JAVAe("NetAdminSession"));
else
    session.setAttribute("NetAdminSession",sSessionID);
%>
<form name=frmMain method=post>
    <input type=hidden name=NA_SessionID name=NA_SessionID value="<%=(String)session.getAttribute("NetAdminSession")%>"></input>
</form>


You can access any element in the DOM by using the GWT DOM Class. For example, if your hidden box has the id "NetAdminSession", you may use the following to access the hidden box...

DOM.getElementById("NetAdminSession");


To: Geoffrey Wiseman my HTML file is in the GWT HTML.. but I change it to JSP file instead of HTML

To: prometheus Thanks you information, I will give it a try now.


I'm not sure what your overall approach/architecture is, but it might also be helpful to look into some of the new features added in GWT 2.0. Specifically, Declarative Layout with UIBinder. With this you can actually construct your user interface with declarative XML instead of using pure Java. I would steer away from creating too much of your UI in the actual HTML file since it will be easier to control those UI elements if you construct them in your GWT code. You can still stick to good MVC principles if you break your classes/code up the right way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜