Javascript の非表示フィールドから XML にデータを挿入しようとしていますが、「null」しか出てきません。変数を宣言しましたが、隠しフィールドをキャプチャできないようです。私は機知に富んでおり、私の問題が解決できることを願っています。
**<<-----I use session to pass the value to the XML page----->>**
<%
String X = (String)session.getAttribute("X");
String Y = (String)session.getAttribute("Y");
String W = (String)session.getAttribute("W");
String H = (String)session.getAttribute("H");
session.setAttribute("X",X);
session.setAttribute("Y",Y);
session.setAttribute("W",W);
session.setAttribute("H",H);
%>
**<<------Snippet of Javascript codes------->>**
function moveIt(){
if (!moveEnabled||!MovableItem) return;
// display info during testing
X = MovableItem.offsetLeft;
Y = MovableItem.offsetTop;
W = MovableItem.offsetWidth;
H = MovableItem.offsetHeight;
==Some codes here==
document.getElementById('X').value = X;
document.getElementById('Y').value = Y;
document.getElementById('W').value = W;
document.getElementById('H').value = H;
}
**<<-----JSP codes that I need to pass the values onto an XML----->>**
<form name='form1' action='UpdateXML.jsp' method='post'>
<input type='hidden' name=source value="<%=src%>" />
<input type='hidden' id="X" name="X" value="<%=X%>"/>
<input type='hidden' id="Y" name="Y" value="<%=Y%>"/>
<input type='hidden' id="W" name="W" value="<%=W%>"/>
<input type='hidden' id="H" name="H" value="<%=H%>"/>
<button type="button" onclick="window.location.href='editcompany.jsp'">Back!</button>
<button type="submit">Insert Into XML!</button>
</form>
隠しフィールド (データ) を XML に挿入する必要があります。試してみましたが、「null」と出てきます。この問題を解決するのを手伝ってくれる人はいますか? 本当にありがとう!