ssh实现ajax最简单的方法
2017-10-06 00:00
309 查看
如何在SSH框架中使用ajax?需要的工作以下所示:
1. 在Struts配置文件中不写result。即不需要给action配置结果集
2. 方法的返回值为void
3. ServletActionContext.getResponse().getWriter().write("this is ajax"); //以这种方式传值
如何给properties配置文件读写?关键是获取到路径
读:
InputStream in = PropertiesHelper.class.getClassLoader().getResourceAsStream("setting.properties");
properties.load(in);
public static String getProperty(String key)
{
if(properties != null && properties.containsKey(key))
return properties.getProperty(key);
return "";
}
写:
String classPath = PropertiesHelper.class.getClassLoader().getResource("/").toURI().getPath();
//OutputStream fos = new FileOutputStream(PropertiesHelper.class.getClassLoader().getResource("/")+"setting.properties");
OutputStream fos = new FileOutputStream(classPath+"setting.properties");
properties.put(key, value);
properties.store(fos, key+"setValue:"+value);
1. 在Struts配置文件中不写result。即不需要给action配置结果集
2. 方法的返回值为void
3. ServletActionContext.getResponse().getWriter().write("this is ajax"); //以这种方式传值
如何给properties配置文件读写?关键是获取到路径
读:
InputStream in = PropertiesHelper.class.getClassLoader().getResourceAsStream("setting.properties");
properties.load(in);
public static String getProperty(String key)
{
if(properties != null && properties.containsKey(key))
return properties.getProperty(key);
return "";
}
写:
String classPath = PropertiesHelper.class.getClassLoader().getResource("/").toURI().getPath();
//OutputStream fos = new FileOutputStream(PropertiesHelper.class.getClassLoader().getResource("/")+"setting.properties");
OutputStream fos = new FileOutputStream(classPath+"setting.properties");
properties.put(key, value);
properties.store(fos, key+"setValue:"+value);
相关文章推荐
- ssh实现ajax最简单的方法
- 用jquery的ajax方法实现简单的数字显示
- 原生js实现ajax方法(超简单)
- jQuery+ajax简单实现文件上传的方法
- ajax方法简单实现
- ASP.NET2.0中Tabs的简单实现 不用Asp.net Ajax ControlToolKit中的Tabs控件实现Tabs效果的简单实现方法:
- 页面上一段时间内通过ajax轮询后台数据的简单实现方法
- sql server 关于表中只增标识问题 C# 实现自动化打开和关闭可执行文件(或 关闭停止与系统交互的可执行文件) ajaxfileupload插件上传图片功能,用MVC和aspx做后台各写了一个案例 将小写阿拉伯数字转换成大写的汉字, C# WinForm 中英文实现, 国际化实现的简单方法 ASP.NET Core 2 学习笔记(六)ASP.NET Core 2 学习笔记(三)
- 利用javascript实现原生简单ajax的方法。
- SpringMVC(26):简单的json数据校验示例(实现功能:使用jQuery框架的ajax()方法来实现 userCode的校验)
- 用最简单的方法实现Ajax
- Ajax简单实现文件异步上传的多种方法
- jquery实现ajax提交表单信息的简单方法(推荐)
- MVC中Ajax的简单实现(多种传值方法)
- jQuery实现Ajax提交form表单的简单方法
- 最简单的Ajax点赞实现方法
- ajax的简单使用——get&post两种方法的实现(1)
- 基于ajax的简单搜索实现方法
- 原生JS简单实现ajax的方法示例
- ajaxpro实现无刷新更新数据库【简单方法】