无意在网上看到某个人发的一种写法, 这是什么写法那么怪异,而且是用txt文件,不是用java文件。但是内容确实是
java的呀。运用ssh框架术。不懂这个#{Entity}类似这种.请高人指点,这个从某种意义上来说是一种类的规范,像泛型的思想有点,只是不断的替换类名,其实架构还是不变,内容变。
import #{dao_p}.#{Entity}Dao;
import #{entity_p}.#{Entity};
import #{manager_p}.#{Entity}Mng;@Service
@Transactional
public class #{Entity}MngImpl implements #{Entity}Mng {
@Transactional(readOnly = true)
public Pagination getPage(int pageNo, int pageSize) {
Pagination page = dao.getPage(pageNo, pageSize);
return page;
} @Transactional(readOnly = true)
public #{Entity} findById(Integer id) {
#{Entity} entity = dao.findById(id);
return entity;
} public #{Entity} save(#{Entity} bean) {
dao.save(bean);
return bean;
} public #{Entity} update(#{Entity} bean) {
Updater<#{Entity}> updater = new Updater<#{Entity}>(bean);
bean = dao.updateByUpdater(updater);
return bean;
} public #{Entity} deleteById(Integer id) {
#{Entity} bean = dao.deleteById(id);
return bean;
}
public #{Entity}[] deleteByIds(Integer[] ids) {
#{Entity}[] beans = new #{Entity}[ids.length];
for (int i = 0,len = ids.length; i < len; i++) {
beans[i] = deleteById(ids[i]);
}
return beans;
} private #{Entity}Dao dao; @Autowired
public void setDao(#{Entity}Dao dao) {
this.dao = dao;
}
}
java的呀。运用ssh框架术。不懂这个#{Entity}类似这种.请高人指点,这个从某种意义上来说是一种类的规范,像泛型的思想有点,只是不断的替换类名,其实架构还是不变,内容变。
import #{dao_p}.#{Entity}Dao;
import #{entity_p}.#{Entity};
import #{manager_p}.#{Entity}Mng;@Service
@Transactional
public class #{Entity}MngImpl implements #{Entity}Mng {
@Transactional(readOnly = true)
public Pagination getPage(int pageNo, int pageSize) {
Pagination page = dao.getPage(pageNo, pageSize);
return page;
} @Transactional(readOnly = true)
public #{Entity} findById(Integer id) {
#{Entity} entity = dao.findById(id);
return entity;
} public #{Entity} save(#{Entity} bean) {
dao.save(bean);
return bean;
} public #{Entity} update(#{Entity} bean) {
Updater<#{Entity}> updater = new Updater<#{Entity}>(bean);
bean = dao.updateByUpdater(updater);
return bean;
} public #{Entity} deleteById(Integer id) {
#{Entity} bean = dao.deleteById(id);
return bean;
}
public #{Entity}[] deleteByIds(Integer[] ids) {
#{Entity}[] beans = new #{Entity}[ids.length];
for (int i = 0,len = ids.length; i < len; i++) {
beans[i] = deleteById(ids[i]);
}
return beans;
} private #{Entity}Dao dao; @Autowired
public void setDao(#{Entity}Dao dao) {
this.dao = dao;
}
}
解决方案 »
- 请问servlet中如何获得post来的数据
- Jquery qtip 问题
- BBS中mySQL的异常
- 用ajax怎么实现两个selectManyListBox之间互相传值?高分哦!
- 哪位有webeq,共享一下
- 如何用Spring实现分页功能??
- 晕,大家帮我来看看这是不是jbuilder出错了。。
- 请教HttpSessionBindingListener问题?!!!!!
- servlet中是否也可以有<%@ include file="consql.jsp" %>这样的语句?
- 用Tomcat做服务器,类应该放哪儿?
- jsp与ACCESS数据库,添加数据成功,修改不成功,新手,在线等!!!
- java.util.ArrayList cannot be cast to com.hxll.hr.entity.SalaryStandard
el表达式不是dollar符吗?
(抱歉,说了不少推测的话)
不过这样似乎只能解决通用的CRUD的操作,更特殊的操作,貌似仍有缺陷.
是模板 okgo123
少见多怪了。
只是不太明白为什么删除方法还要有返回 public #{Entity} deleteById(Integer id)
我原来用python处理过这种文件,预处理完后就是java代码了。