1

I have one question.

I write the following in a JSP file.

<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;"/>

I write the following in a js file.

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();
}

it knows all parameter value but when I change the JavaScript function name and script coding, it does not work. I means it knows only first parameter value (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);
}

How to fix this?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Sandar Min Aye
  • 499
  • 6
  • 15
  • 28
  • Looks like `x_ARG === ''`. You can pass exactly one argument to dialog with `arguments` argument of `showModalDialog()`. If you need more than one, you need to create an array or object to pass more values. – Teemu Aug 28 '13 at 04:57
  • If I use array or object to pass the values from X_ARG, how to call that parameter value from java action method? – Sandar Min Aye Aug 28 '13 at 05:13
  • Unfortenately Java is beyond my knowledge. – Teemu Aug 28 '13 at 06:45

1 Answers1

0

Now, you have the problem with s:url tag.

Struts tags usually escape the value of the tag. But it prevents the javascript to work correctly.

You need to add escapeAmp="false" to the s:url tag to get other parameters.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • I have one more question,please.Today, I noticed that the parameter(e.g: ``) don't display correctly Japanese Font in Popup Page. I wrote as the following in Popup Page (JSP). `<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> ` The other Japanese Sentences are displayed correctly but the parameter from JScript Popup don't display correctly.Could you explain me, pls? Thanks in advance !!! – Sandar Min Aye Sep 20 '13 at 04:04
  • Parameters aren't encoded with the page encoding. You have either encode it manually or configure the server to your favorite encoding. – Roman C Sep 20 '13 at 08:44
  • pls give me some suggestion for this my problem; [link]http://stackoverflow.com/questions/19086190/request-getparameter-does-not-display-properly-character-encoding-in-java-serv – Sandar Min Aye Sep 30 '13 at 05:22