当前位置: 动力学知识库 > 问答 > 编程问答 >

jsp - Window.open() in ext Js

问题描述:

I have to load a new jsp page in the on click event of a button in ext js. I put the code like this

 listeners: {

'click': function(){

alert("hai");

window.open('<%=request.getContextPath()%>/jsp/dashboard/helpwindow.jsp','_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=700,height=600');

}

}

But it does not give me the result. '<%=request.getContextPath()%>' makes problem.

Now th new window open with url

http://localhost:8080/hiring/%3C%=request.getContextPath%28%29%%3E/jsp/dashboard/helpwindow.jsp

But I need the url

http://localhost:8080/hiring/jsp/dashboard/helpwindow.jsp

Please help me to solve this.

网友答案:
listeners: {

  'click': function() {                 
       var serverPath = window.location.href;
       var serverPathIndex = serverPath.lastIndexOf("/");
       window.open(serverPath.substring(0, serverPathIndex) + '/jsp/dashboard/helpwindow.jsp','_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=700,height=600');
   }
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: