摘要: Action中定义赋值: ActionContext ctx = ActionContext.getContext(); ctx.getApplication().put("simon", "23"); ctx.getSession().put("kitty", "12"); ctx.put("lu 阅读全文
posted @ 2018-05-31 17:49 呦,可以呦 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 自定义一个转换器类,并且继承DefaultTypeConverter 重写方法:convertValue 1.局部类型转换器配置 在Action所在包下新建一个{Action名-conversion.properties}文件 文件内容格式如下 person=com.zhangpn.converte 阅读全文
posted @ 2018-05-31 17:36 呦,可以呦 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Action增加属性的get和set方法 接下来在浏览器上运行一下: 获取到了值! 阅读全文
posted @ 2018-05-31 13:23 呦,可以呦 阅读(102) 评论(0) 推荐(0) 编辑
摘要: <action name="index_*" class="com.zhangpn.struts2.Helloworld" method="{1}"> <result>welcome.jsp</result> </action> 阅读全文
posted @ 2018-05-31 13:12 呦,可以呦 阅读(116) 评论(0) 推荐(0) 编辑
摘要: include 标签 <struts> <include file="struts-user1.xml"></include> <include file="struts-user2.xml"></include> </struts> 阅读全文
posted @ 2018-05-31 13:08 呦,可以呦 阅读(124) 评论(0) 推荐(0) 编辑
摘要: struts.xml文件中,配置 <constant name="struts.action.extension" value="do,action"></constant> 通过配置常量的方式配置。 阅读全文
posted @ 2018-05-31 12:58 呦,可以呦 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1.default.properties 默认常量配置 2.struts-default.xml 默认配置文件 3.struts-plugin.xml 插件配置文件 4.struts.xml 核心配置文件 5.struts.properties 自定义常量配置 6.web.xml 项目配置文件 阅读全文
posted @ 2018-05-31 12:33 呦,可以呦 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 官方网站下载Jar包:(本案例使用:struts-2.3.20.1) 导入Jar包: 配置web.xml文件: 配置struts.xml文件: 新建一个类 新建一个JSP视图文件 运行http://localhost:8080/Test/index 阅读全文
posted @ 2018-05-31 12:04 呦,可以呦 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 注释:(以下代码会抛出多个异常,仅表达出JDBC连接Mysql数据库的过程步骤) 加载数据库驱动(即 实例化驱动类对象) Class.forName("com.mysql.cj.jdbc.Driver"); 获取数据库的连接 Connection conn = null; conn = Driver 阅读全文
posted @ 2018-05-31 11:05 呦,可以呦 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 参考Struts2中Cookie的使用:https://www.cnblogs.com/batj/p/9109295.html 创建Session HttpSession se = request.getSession(); se.setAttribute("hello", "world"); 获取 阅读全文
posted @ 2018-05-30 10:31 呦,可以呦 阅读(311) 评论(0) 推荐(0) 编辑