开发者

problem getting value from jsp to servlet

I am trying to get value of count (which is 1) from the parent jsp page into servlet. But it gives an error: "opener.document.getElementById(...)is null or not an object". Is this because i'm trying to get value without submitting the form?? Will be glad if someone could开发者_开发技巧 help.

jsp:

 <td> <input type="hidden" name="count" id="count" value="1"></td>

servlet:

 out.print("var oWindow = window.external.menuArguments;");
        out.println("var ctr=oWindow.opener.document.getElementById(\"count\").getAttribute(\"value\");");


That all depends on which page window, oWindow, or oWindow.opener is pointing to, do you really have 3 client-side window objects involved in this operation? Perhaps it should just be:

var ctr=oWindow.document.getElementById('count').getAttribute('value');

...or you should give a little more information as to the structure of your application. For example, window.external is for when you have extended MSIE and added your own context menu item, this has very little to do with servlets.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜