摘要:
Action中定义赋值: ActionContext ctx = ActionContext.getContext(); ctx.getApplication().put("simon", "23"); ctx.getSession().put("kitty", "12"); ctx.put("lu 阅读全文
摘要:
自定义一个转换器类,并且继承DefaultTypeConverter 重写方法:convertValue 1.局部类型转换器配置 在Action所在包下新建一个{Action名-conversion.properties}文件 文件内容格式如下 person=com.zhangpn.converte 阅读全文
摘要:
Action增加属性的get和set方法 接下来在浏览器上运行一下: 获取到了值! 阅读全文
摘要:
<action name="index_*" class="com.zhangpn.struts2.Helloworld" method="{1}"> <result>welcome.jsp</result> </action> 阅读全文
摘要:
include 标签 <struts> <include file="struts-user1.xml"></include> <include file="struts-user2.xml"></include> </struts> 阅读全文
摘要:
struts.xml文件中,配置 <constant name="struts.action.extension" value="do,action"></constant> 通过配置常量的方式配置。 阅读全文
摘要:
1.default.properties 默认常量配置 2.struts-default.xml 默认配置文件 3.struts-plugin.xml 插件配置文件 4.struts.xml 核心配置文件 5.struts.properties 自定义常量配置 6.web.xml 项目配置文件 阅读全文
摘要:
官方网站下载Jar包:(本案例使用:struts-2.3.20.1) 导入Jar包: 配置web.xml文件: 配置struts.xml文件: 新建一个类 新建一个JSP视图文件 运行http://localhost:8080/Test/index 阅读全文
摘要:
注释:(以下代码会抛出多个异常,仅表达出JDBC连接Mysql数据库的过程步骤) 加载数据库驱动(即 实例化驱动类对象) Class.forName("com.mysql.cj.jdbc.Driver"); 获取数据库的连接 Connection conn = null; conn = Driver 阅读全文