Решил добавить форму(возможность привязывать к процессу устройство):
Код:
[/BGCRM/webapps/WEB-INF/jspf/user/plugin/bgbilling/custom]# cat process_link_for_add_custom_list.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jspf/taglibs.jsp"%>
<c:set var="plugin" value="${ctxPluginManager.pluginMap['bgbilling']}"/>
<c:forEach var="billing" items="${plugin.dbInfoManager.dbInfoList}">
<c:set var="id" value="bgbilling-${billing.id}"/>
<c:set var="linkObjectItems" scope="request">
${linkObjectItems}
<li value="${id}">Договор: ${billing.title}</li>
<li value="${id}-inetDevice">Устройство: ${billing.title}</li>
</c:set>
<c:set var="linkObjectForms" scope="request">
${linkObjectForms}
<form action="/user/plugin/bgbilling/contract.do" id="${id}" style="display: none;">
<input type="checkbox" name="check" style="display: none;"/>
<input type="hidden" name="processId" value="${form.id}"/>
<input type="hidden" name="billingId" value="${billing.id}"/>
<input type="hidden" name="action" value="addProcessContractLink"/>
<input style="width: 100%;" name="contractTitle" placeholder="Номер договора"/>
</form>
<form action="/user/plugin/bgbilling/custom/contract.do" id="${id}-inetDevice" style="display: none;">
<input type="checkbox" name="check" style="display: none;"/>
<input type="hidden" name="processId" value="${form.id}"/>
<input type="hidden" name="billingId" value="${billing.id}"/>
<input type="hidden" name="action" value="addProcessInetDeviceLink"/>
<input style="width: 100%;" name="devId" placeholder="ID устройтва"/>
<%--
<input style="width: 100%;" name="devIp" placeholder="IP устройтва"/>
--%>
</form>
</c:set>
</c:forEach>
Код:
<!-- Custom link device -->
<action path="/user/plugin/bgbilling/custom/contract" parameter="action" type="ru.bgcrm.dyn.itsm.plugin.bgbilling.struts.action.ExtContractAction" name="form" scope="request">
<forward name="default" path="/WEB-INF/jspf/user/plugin/bgbilling/contract.jsp"/>
</action>
<!-- Custom -->
есть класс с экшеном:
Код:
package ru.bgcrm.dyn.itsm.plugin.bgbilling.struts.action;
...
public class ExtContractAction extends ContractAction {
/**
*
*/
public ExtContractAction() {
super();
}
/*
* Добавляем привязку устройства к процессу.
*
* @param mapping
* @param form
* @param request
* @param response
* @param con
* @return
*
* @throws BGException
*/
public ActionForward addProcessInetDeviceLink(ActionMapping mapping, DynActionForm form, HttpServletRequest request,
HttpServletResponse response, Connection con) throws BGException {
String billingId = form.getParam("billingId");
int processId = form.getParamInt("processId");
int deviceId = form.getParamInt("devId");
// String devIp = form.getParam("devIp");
if ((Utils.isBlankString(billingId)) || (processId <= 0)
|| (deviceId <= 0) /* || Utils.validateIPv4(devIp) */ ) {
throw new BGIllegalArgumentException();
}
User user = form.getUser();
ExtInetDAO inetDao = new ExtInetDAO(user, billingId);
InetDevice inetDevice = inetDao.getDevice(deviceId);
CommonObjectLink link = new CommonObjectLink("process", processId, "device:" + billingId, inetDevice.getId(),
inetDevice.getTitle());
LinkAction.addLink(form, con, link);
return processJsonForward(con, form, response);
}
}
в итоге при изменении прилетает:
Код:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.ClassNotFoundException: ru.bgcrm.dyn.itsm.plugin.bgbilling.struts.action.ExtContractAction
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
ru.bgcrm.servlet.filter.SetRequestParamsFilter.doFilter(SetRequestParamsFilter.java:46)
ru.bgcrm.servlet.filter.AuthFilter.doFilter(AuthFilter.java:115)
ru.bgcrm.servlet.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:38)
root cause
java.lang.ClassNotFoundException: ru.bgcrm.dyn.itsm.plugin.bgbilling.struts.action.ExtContractAction
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
org.apache.struts.chain.commands.util.ClassUtils.getApplicationClass(ClassUtils.java:54)
org.apache.struts.chain.commands.util.ClassUtils.getApplicationInstance(ClassUtils.java:71)
org.apache.struts.chain.commands.servlet.CreateAction.createAction(CreateAction.java:98)
org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:68)
org.apache.struts.chain.commands.AbstractCreateAction.execute(AbstractCreateAction.java:91)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
ru.bgcrm.servlet.filter.SetRequestParamsFilter.doFilter(SetRequestParamsFilter.java:46)
ru.bgcrm.servlet.filter.AuthFilter.doFilter(AuthFilter.java:115)
ru.bgcrm.servlet.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:38)