随笔分类 - newer
摘要:Html界面代码: 编写Action部分: 简述: 提供属性并且给出get/set方法 1.uploadImage文件 2.文件名uploadImageFileName 通过函数:FileUtils.copyFile(srcFile, destFile);达到上传目的。
阅读全文
posted @ 2018-05-31 18:24
呦,可以呦
摘要:Action中定义赋值: ActionContext ctx = ActionContext.getContext(); ctx.getApplication().put("simon", "23"); ctx.getSession().put("kitty", "12"); ctx.put("lu
阅读全文
posted @ 2018-05-31 17:49
呦,可以呦
摘要:自定义一个转换器类,并且继承DefaultTypeConverter 重写方法:convertValue 1.局部类型转换器配置 在Action所在包下新建一个{Action名-conversion.properties}文件 文件内容格式如下 person=com.zhangpn.converte
阅读全文
posted @ 2018-05-31 17:36
呦,可以呦
摘要:<action name="index_*" class="com.zhangpn.struts2.Helloworld" method="{1}"> <result>welcome.jsp</result> </action>
阅读全文
posted @ 2018-05-31 13:12
呦,可以呦
摘要:include 标签 <struts> <include file="struts-user1.xml"></include> <include file="struts-user2.xml"></include> </struts>
阅读全文
posted @ 2018-05-31 13:08
呦,可以呦
摘要:struts.xml文件中,配置 <constant name="struts.action.extension" value="do,action"></constant> 通过配置常量的方式配置。
阅读全文
posted @ 2018-05-31 12:58
呦,可以呦
摘要: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
呦,可以呦
摘要:官方网站下载Jar包:(本案例使用:struts-2.3.20.1) 导入Jar包: 配置web.xml文件: 配置struts.xml文件: 新建一个类 新建一个JSP视图文件 运行http://localhost:8080/Test/index
阅读全文
posted @ 2018-05-31 12:04
呦,可以呦
摘要:注释:(以下代码会抛出多个异常,仅表达出JDBC连接Mysql数据库的过程步骤) 加载数据库驱动(即 实例化驱动类对象) Class.forName("com.mysql.cj.jdbc.Driver"); 获取数据库的连接 Connection conn = null; conn = Driver
阅读全文
posted @ 2018-05-31 11:05
呦,可以呦
摘要:参考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
呦,可以呦
摘要:设置Cookie 设置Cookie很简单,只要创建一个Cookie对象,添加到response中即可。 调用Cookie 调用Cookie也很简单,只要获取cookie集合,遍历即可。 Cookie coo[] = request.getCookies();//获取request中cookie集合
阅读全文
posted @ 2018-05-30 09:54
呦,可以呦
摘要:下载JDK:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 下载根据电脑下载,例如jdk-8u171-windows-x64.exe,傻瓜式安装,点击下一步,自定义安装目录。 配置
阅读全文
posted @ 2018-05-29 16:32
呦,可以呦

浙公网安备 33010602011771号