easystruts-1.0.0简单配置注解版,支持json、jsp
来源:互联网 发布:厦门书生商友软件 编辑:程序博客网 时间:2024/06/06 01:40
笔者一直倾向于filter → selvert 的开发模式,根据Springboot简单配置的优点,简化了struts的开发
web.xml配置
<!-- 加载struts2容器 --><listener><listener-class>com.xjcy.easystruts.web.ContextLoaderListener</listener-class></listener>
struts2.properties配置
package=com.xjcy.crownconAdminnotfilter=jpg,png,gif,jpeg,bmp,css,js
请将 struts2.properties文件放在src目录下,1.0.1版本已去除package配置,框架可自动获取当前项目的包名
@RequestMapping("/user")public class UserController extends ActionSupport{@RequestMapping("/test")public String name(){return "hello";}@RequestMapping("/test1")public Map<?,?> name2(){Map<String,Object> map = new HashMap<>();map.put("aa", 1);map.put("bb", 2);map.put("cc", 3);return map;}@RequestMapping("/test2")public ModelAndView name3(){//getRequest();//getResponse();ModelAndView mav = new ModelAndView();mav.addObject("test", 123456);mav.setViewName("index");return mav;}@RequestMapping("/test3")@ResponseNone //自己处理responsepublic void test3() throws IOException{HttpServletResponse response = getResponse();PrintWriter pw = response.getWriter();pw.write("test3");pw.close();}/** * 此方法为上传回调,自己处理file.getInputStream() * 返回上传后的路径 * action通过getMultiparFiles("uploadName1")获取文件上传后路径 */@Overrideprotected String processMultipartFile(MultipartFile file){//file.getInputStream()return null;}}
源码下载:https://github.com/yydf/easystruts-xjcy
DEMO下载:https://github.com/yydf/easystruts-xjcy/blob/master/demo.zip阅读全文
0 0
- easystruts-1.0.0简单配置注解版,支持json、jsp
- 使用注解springmvc配合jsp/ajax/json,实现简单的jsp遍历后台数据
- easystruts-1.0.3重大更新
- Jetty:配置JSP支持
- SpringMvc简单注解配置
- struts+json实现注解配置
- 配置 IIs 支持json 解析
- 配置IIS Express,支持JSON
- Spring 自定义注解,配置简单日志注解
- Spring 自定义注解,配置简单日志注解
- Spring基于注解的零配置支持
- easystruts-1.0.1增加jdbc处理和初始化抽象类
- easystruts-1.0.2增加拦截器抽象类,Session处理
- Servlet3.0的注解支持
- 配置iis支持.json格式的文件
- 配置iis支持.json格式的文件
- 配置iis支持.json格式的文件
- 配置iis支持.json格式的文件
- 碰撞器和触发器的区别
- [git] 如何编写开源项目的 README 文档
- 设计模式-策略模式
- linux下动态库的符号冲突、隐藏和强制优先使用库内符号
- Shell[二]: Shell杂谈
- easystruts-1.0.0简单配置注解版,支持json、jsp
- mybatis在log4j中输出SQL
- //使用条件表达式作为简单的“如果...那么...”判断。 #include <iostream> using namespace std; int main() { int score=2; s
- sklearn中的Pipeline
- AFNetworking 3.0 源码解读(二)之 AFSecurityPolicy
- 开源库BaseRecyclerViewAdapterHelper的简单用法
- 拷贝和赋值的区别
- Shader 法线贴图参考代码
- dump 的生成和调试