1

我有一个问题。

我在 JSP 文件中编写了以下内容。

<s:url id="printURL" action="actMod" method="printout">
    <s:param name="txt_ActEdit_accid"><s:property value="%{txt_ActEdit_accid}" /></s:param>
    <s:param name="txt_ActEdit_accffname"><s:property value="%{txt_ActEdit_accffname}" /></s:param>
    <s:set var="loginPassword"><%=OpeCommon.LOGIN_PASSWORD %></s:set>
    <s:param name="%{#loginPassword}"><%=OpeCommon.encriptPassword(p_userID, p_passCode)%></s:param>
</s:url>
<s:submit name="btn_ActList_print" cssClass="dispLvl3 mediumbutton" value="%{getFieldName('S05AccountEdit.print_button')}"
onclick="javascript:popUp('%{printURL}','elastic',500,500);return false;"/>

我在一个js文件中写了以下内容。

var newWin = null;

function popUp(strURL, strType, strHeight, strWidth) {
  if (newWin != null && !newWin.closed)
    newWin.close();
  var strOptions="";
  if (strType=="console")
    strOptions="resizable,height="+
      strHeight+",width="+strWidth;
  if (strType=="fixed")
    strOptions="status,height="+
      strHeight+",width="+strWidth;
  if (strType=="elastic")
    strOptions="toolbar,menubar,scrollbars,"+
      "resizable,location,height="+
      strHeight+",width="+strWidth;
  newWin = window.open(strURL, 'newWin', strOptions);
  newWin.focus();
}

它知道所有参数值,但是当我更改 JavaScript 函数名称和脚本编码时,它不起作用。我的意思是它只知道第一个参数值(txt_ActEdit_accid)。

<s:submit name="btn_ActList_print" cssClass="dispLvl3 mediumbutton" value="%{getFieldName('S05AccountEdit.print_button')}"
onclick="javascript:printWindow('%{printURL}','',500,500);return false;"/>
function printWindow(x_URL, x_ARG, x_WIDTH, x_HEIGHT)
{
    var x_OPT = "dialogHeight: "+x_HEIGHT+"px; "
    +"dialogWidth: "+x_WIDTH+"px; "
    +"edge: Raised; center: Yes; resizable: Yes; status: Yes;";
    window.showModalDialog(x_URL, x_ARG, x_OPT);
}

如何解决这个问题?

4

1 回答 1

0

现在,您遇到了s:url标签的问题。

Struts 标签通常会转义标签的value。但它会阻止 javascript 正常工作。

您需要添加escapeAmp="false"s:url标签以获取其他参数。

于 2013-08-28T08:54:27.400 回答