struts +bootstrap+freemarker实现的后台黑名单管理。

package cn.sina.credit;


import cn.sina.credit.payment.czbank.CZPay; 
import cn.sina.credit.payment.czbank.common.CZBankClient;
import cn.sina.credit.service.AddressManagerService;
import cn.sina.credit.service.CustomerService;
import cn.sina.credit.service.ListManagerService;
import cn.sina.credit.service.PaymentService;
import cn.sina.credit.utils.HttpHelper;


import com.google.inject.AbstractModule;
import com.google.inject.Scopes;


public class ServiceModule extends AbstractModule{


@Override
protected void configure() {
bind(PaymentService.class);
bind(CZPay.class);
bind(CZBankClient.class).in(Scopes.SINGLETON);

bind(HttpHelper.class).in(Scopes.SINGLETON);
bind(CustomerService.class).in(Scopes.NO_SCOPE);
bind(ListManagerService.class).in(Scopes.NO_SCOPE);
bind(AddressManagerService.class).in(Scopes.NO_SCOPE);
}


}


================




public class PersistModule extends MyBatisModule {
    protected void initialize() {
        bindDataSourceProviderType(C3p0DataSourceProvider.class);
        bindTransactionFactoryType(JdbcTransactionFactory.class);


        //bind mappers here
        addMapperClass(PaymentSignMapper.class);
        addMapperClass(PaymentTransactionMapper.class);
        addMapperClass(ContractMapper.class);
        addMapperClass(ReportMapper.class);
        //注册用户黑名单,灰名单Mapper
        addMapperClass(BlackListMapper.class);
        addMapperClass(GreyListMapper.class);
        //注册 地址黑名单,灰名单Mapper
        addMapperClass(BlackAddressMapper.class);
        addMapperClass(GreyAddressMapper.class);
        Names.bindProperties(binder(), createProperties());
        addDestroyHook();
    }



========================

@Override
protected Injector getInjector() {
injector = Guice.createInjector(new Struts2GuicePluginModule(),
new AbstractModule() {
@Override
protected void configure() {
bind(Configuration.class).toProvider(
ConfigurationProvider.class).in(
Scopes.SINGLETON);
bind(HttpHelper.class).in(Scopes.SINGLETON);
}
}, new FilterModule(),new PersistModule());


sidebar.jsp
<c:set var="currentMenu" scope="request">
<decorator:getProperty property="meta.menu" />
</c:set>
<ul class="nav nav-sidebar">
   <li class="<c:if test= "${currentMenu == 'payment.query'}">active</c:if>"><a href="<c:url value='/queryPayments'/>"><fmt:message key="title.payment.query"/></a></li>
   <li class="<c:if test= "${currentMenu == 'payment.pay'}">active</c:if>"><a href="<c:url value='/payView' />"><fmt:message key="title.payment.pay"/></a></li>
   <li class="<c:if test= "${currentMenu == 'fraud.blacklist'}">active</c:if>"><a href="<c:url value='/fraud' />"><fmt:message key="title.fraud.blacklist"/></a></li>
</ul>




struct.xml文件:
<!--黑名单,灰名单模块 -->
<package name="blacklist" extends="struts-default" namespace="/">
   <default-action-ref name="defaultquery" />
   
 <!--默认打开页面查询10条黑名单记录 -->
<action name="defaultquery" class="cn.sina.credit.web.action.fraud.CustomerListAction" method="defaultquery">
   <result type="freemarker">/WEB-INF/fraud/blacklist.ftl</result>
</action>
   


<!--查询一条黑/灰名单记录 -->
<action name="queryBlacklist" class="cn.sina.credit.web.action.fraud.CustomerListAction" method="query">
   <result type="freemarker">/WEB-INF/fraud/blacklist.ftl</result>
</action>




<!--插入一条黑/灰名单记录 -->
<action name="addBlackList" class="cn.sina.credit.web.action.fraud.CustomerListAction"
method="addBlackList">
  <!--  <result name="success" type="redirectAction">
<param name="actionName">defaultquery</param>
</result> -->
<result type="freemarker">/WEB-INF/fraud/blacklist.ftl</result>
</action>

<!--更新一条黑/灰名单记录 -->
<action name="updateBlackList" class="cn.sina.credit.web.action.fraud.CustomerListAction"
method="updateBlackList1">
<result type="freemarker">/WEB-INF/fraud/blacklist.ftl</result>
</action>


</package>



dbproperties
mybatis.environment.id = mybatis_env
JDBC.driver=oracle.jdbc.OracleDriver
JDBC.url=jdbc:oracle:thin:@139.196.104.87:1521:sinafq
JDBC.username=sina_credit
JDBC.password=test110
JDBC.autoCommit=true


c3p0.maxPoolSize=20
c3p0.minPoolSize=5
c3p0.acquireIncrement=2
c3p0.maxIdleTime=1800
c3p0.idleConnectionTestPeriod=60
c3p0.testConnectionOnCheckout = false
c3p0.testConnectionOnCheckin = true
#client will wait 30s to get a connection
c3p0.checkoutTimeout=30000


c3p0.maxAdministrativeTaskTime = 600




ApplicationResoures_zh.property


title.fraud.blacklist =\u540d\u5355\u7ba1\u7406

你可能感兴趣的:(struts +bootstrap+freemarker实现的后台黑名单管理。)