2012年3月23日

struts2中的session权限控制(转)

摘要: 1.在登录的session中设置一个属性。 在登录的action中的execute方法中加入以下代码。 @SuppressWarnings("unchecked") public String execute() throws Exception{ if ("lirongxing".equals(this.getUsername().trim())&& "lrx".equals(this.getPassword().trim())){ Map map = ActionContext.getContext().getSe 阅读全文

posted @ 2012-03-23 02:04 friday295 阅读(252) 评论(0) 推荐(0) 编辑

2012年3月22日

struts2 ognl备忘

摘要: jsp: <ol> <li>访问值栈中的action的普通属性: username = <s:property value="username"/> </li> <li>访问值栈中对象的普通属性(get set方法):<s:property value="user.age"/> | <s:property value="user['age']"/> | <s:property value="user[\"age 阅读全文

posted @ 2012-03-22 04:22 friday295 阅读(138) 评论(0) 推荐(0) 编辑

struts2 tags之property备忘

摘要: <ol> <li>property: <s:property value="testname"/> </li> <li>property 取值为字符串: <s:property value="'username'"/> </li> <li>property 设定默认值: <s:property value="admin" default="管理员"/> </li> <li&g 阅读全文

posted @ 2012-03-22 04:19 friday295 阅读(147) 评论(0) 推荐(0) 编辑

2012年3月20日

myeclipse的数据库配置种种问题

摘要: 今天在myeclipse里配置数据库,方法若干,直接写下:首先,假定已经有了mysql数据库,首先遇到的问题就是不知道自己数据库端口,在command line数据:show variable like 'port'命令,即可得到端口随后,查看自己数据库的用户和密码:command line 输入:select * from mysql.user \G这些都搞定了,参见http://limingnihao.iteye.com/blog/773787这篇文章,非常之齐全的解释,我就不复制文章了。注意,这里说的是myeclipse10,别的版本好像有些许不同,不过差不多 阅读全文

posted @ 2012-03-20 02:55 friday295 阅读(174) 评论(0) 推荐(0) 编辑

2012年3月13日

struts2中request,session和application的操作(转)

摘要: Strtus2通常情况下使用以下两种方式来访问上述三种对象,即Servlet API解藕和耦合的访问方式。1.Servlet API解藕方式:Struts2分别对Request、Session和Application三个对象封装成了三个Map对象,直接使用封装好的Map对象来读取 和保存数据。可以通过com.opensymphony.xwork2.ActionContext类来得到这三个对象。ActionContext是 Action执行的上下文,保存了很多对象如parameters、request、session、application和locale等。通过 ActionContext类获取 阅读全文

posted @ 2012-03-13 04:39 friday295 阅读(754) 评论(0) 推荐(0) 编辑

strust2.1.6的中文问题

摘要: 理论上,在一段如下struts配置文件中<struts> <constant name="struts.devMode" value="true" /> <constant name="struts.i18n.encoding" value="GBK" /> <!-- internationalization --> <package name="user" extends="struts-default" namespa 阅读全文

posted @ 2012-03-13 04:37 friday295 阅读(120) 评论(0) 推荐(0) 编辑

2012年3月12日

strust2.1.6的中文问题

摘要: 理论上,在一段如下struts配置文件中<struts> <constant name="struts.devMode" value="true" /> <constant name="struts.i18n.encoding" value="GBK" /> <!-- internationalization --> <package name="user" extends="struts-default" namespa 阅读全文

posted @ 2012-03-12 03:05 friday295 阅读(121) 评论(0) 推荐(0) 编辑

2012年3月8日

struts中动态调用

摘要: 在一个project里面,index page如下:<?xml version="1.0" encoding="GB18030" ?><%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><% String context = request.getContextPath(); %><!DOCTYPE html PUBLIC &q 阅读全文

posted @ 2012-03-08 08:14 friday295 阅读(132) 评论(0) 推荐(0) 编辑

struts关于struts.xml运行的一个小解释

摘要: <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <constant name="struts.devMode" value=" 阅读全文

posted @ 2012-03-08 07:56 friday295 阅读(121) 评论(0) 推荐(0) 编辑

myeclipse struts的路径问题

摘要: 在开发struts会遇到路径问题,发现路径跑到别的目录下面去了,一下是个办法:<?xml version="1.0" encoding="GB18030" ?><%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@taglib uri="/struts-tags" prefix="s" %> 阅读全文

posted @ 2012-03-08 07:45 friday295 阅读(119) 评论(0) 推荐(0) 编辑

导航