论坛首页 Java企业应用论坛

struts2小技巧

浏览 2782 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-10-10  
[1]. struts2 类里面获取客户端ip
import org.apache.struts2.ServletActionContext;
//得到用户IP地址
String ip = ServletActionContext.getRequest().getRemoteAddr();
[2]. 获得web工程路径Jsp页面:
${pageContext.request.contextPath}
如:
<link href="${pageContext.request.contextPath}/swspt/css/main.css" rel="stylesheet" type="text/css" />


[2]. Struts2,google浏览器出现TypeError: object is not a function错误原因及解决方法

Jsp页面的<s:div  ….>标签一定要指明id值,不然会出错。也可以用普通div标签。比如显示项目描述的时候
<div Style="border:1px;"><pre style="overflow: hidden; word-wrap: break-word; width: 680px;"><s:property value="fsyw.conent" /></pre>
</div>

   发表时间:2008-10-17  
...这个跟STRUTS2的关系不是很大..很大...
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics