jsp或用js获得服务器的IP地址
js好像本身不能获取服务器的IP,但JSP可以,所以用个隐藏域,js就可以借鸡下蛋了。
jsp代码如下:
<input type="hidden" id="serviceIp" name="serviceIp" value="<%=InetAddress.getLocalHost().getHostAddress()%>">
js代码如下:
function getServiceIP(){
var serviceIp = document.getElementById("serviceIp").value;
var href ='http://'+serviceIp+':8080/test/';
}
相关文档:
修改了css 样式文件后,重新浏览该jsp页面,发现新修改的样式没有生效。总以为是项目缓存所引起的,于是清理所有项目,重新构建项目。不行。执行server 的 publish 还是不行。用window 的搜索功能发现除了 WebContent 目录有该 css 文件外,.metadata\.plugins\org.eclipse.wst.server.core\tmp1\webapps\ 目录下也存在该 c ......
找下面写法。
注意,加单引号,第2个百分号之前没有空格,而在jsp中调用的话要空格。
You may be get some help from the code below.
<%
String str="str";
%>
<script>
function accessVar(){
var varStr='<%=str%>';
alert(varStr);// here will diplay ......
相同点:
如果被包含进去的文件里面有css文件的话,包含的页面会受到被包含文件的css样式的影响!
不同点:
<%@ include
file="date.jsp" %>
<jsp:include
page="date.jsp" flush="true"/>
include
编译指令是在
JSP
程序 ......
在jsp中引用response.setContentType("application/msword");,打开的页面就是word样式。
1、实现word横打:
<style>
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:841.9pt 595.3pt;//纸张的大小
mso-page-orientation:l ......