📄 codeadd.jsp
字号:
<%@ page import="org.ofbiz.entity.*" %>
<%@ page import="org.ofbiz.entity.model.*" %>
<%@ page import="java.lang.reflect.Method" %>
<%@ page import="java.util.*" %>
<%@ page import="org.ofbiz.entity.util.SequenceUtil" %>
<%@ page import="com.sourcetap.sfa.replication.*" %>
<%@ include file="/includes/header.jsp" %>
<%@ include file="/includes/leftcolumn-codeType.jsp" %>
<%!
// Define function to get the code type corresponding to this code.
GenericValue getCodeTypeDetails(String codeTypeId,
GenericDelegator delegator)
throws GenericEntityException {
ModelEntity codeTypeEntity = delegator.getModelEntity("CodeType");
HashMap codeTypeMap = new HashMap();
codeTypeMap.put("codeTypeId", codeTypeId);
GenericPK codeTypePk = new GenericPK(codeTypeEntity, codeTypeMap);
return delegator.findByPrimaryKey(codeTypePk);
}
%>
<%
String ENTITY = "Code";
String codeTypeId = "";
String action = "";
String name = "";
ModelEntity entity = delegator.getModelEntity(ENTITY);
if(request.getParameter("action") != null){
action = request.getParameter("action");
}
if(request.getParameter("codeTypeId") != null){
codeTypeId = request.getParameter("codeTypeId");
}
//handle creating a code
if(action.equals("create")){
GenericValue genericValue = new GenericValue(entity);
genericValue.setDelegator(delegator);
// genericValue.set("codeId", GenericReplicator.getNextSeqId(ENTITY, delegator));
Enumeration params = request.getParameterNames();
while(params.hasMoreElements()){
String pName = (String)params.nextElement();
if(!pName.equals("action") && !pName.equals("isActive") && !pName.equals("isVisible"))
genericValue.set(pName, request.getParameter(pName));
}
// Handle the check boxes.
if(request.getParameter("isVisible") != null && request.getParameter("isVisible").equalsIgnoreCase("on")){
genericValue.set("isVisible", "Y");
} else {
genericValue.set("isVisible", "N");
}
if(request.getParameter("isActive") != null && request.getParameter("isActive").equalsIgnoreCase("on")){
genericValue.set("isActive", "Y");
} else {
genericValue.set("isActive", "N");
}
delegator.create(genericValue);
}
// Get the code type details.
GenericValue codeTypeDetails = getCodeTypeDetails(codeTypeId, delegator);
%>
<!-- title table -->
<table width="100%" valign="top"><tr><td>
<table border=0 width='100%' cellpadding='<%=headerBoxBorderWidth%>' cellspacing='0' class="viewOneHeader"><tr><td width='100%' height='100%'>
<table border="0" width="100%" class="viewOneHeader"><tr>
<td>
Add New Code
</td>
<td align="right">
<a href="<ofbiz:url>/codeTypeDetail</ofbiz:url>?codeTypeId=<%=codeTypeId%>">Back to Code Type Detail</a>
</td>
</tr>
</table>
<table border="0" width="100%" class="viewOneBox">
<form method="post" action="<ofbiz:url>/codeAdd</ofbiz:url>">
<input type="hidden" value="create" name="action" >
<!-- Code Type Name -->
<tr>
<td width="20%" class="viewOneLabel">Code Type</td>
<td width="30%" class="viewOneField"><%=String.valueOf(codeTypeDetails.get("codeTypeName"))%></td>
</tr>
<!-- Code Type ID -->
<input type="hidden" value="<%=codeTypeId%>" name="codeTypeId" >
<!-- Code ID -->
<tr>
<% name = "codeId"; %>
<td class=viewOneLabel>Code ID</td>
<td><input type="text" name="<%=name%>"></td>
</tr>
<!-- Code Value -->
<tr>
<td class=viewOneLabel>Code Value</td>
<td class="viewOneField"><textarea cols="30" rows="15" name="codeValue" ></textarea></td>
</tr>
<!-- Is Visible -->
<tr>
<td class="viewOneLabel">Visible</td>
<td class="viewOneField"><input type="checkbox" name="isVisible" CHECKED></td>
</tr>
<!-- Is Active -->
<tr>
<td class="viewOneLabel">Active</td>
<td class="viewOneField"><input type="checkbox" name="isActive" CHECKED></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Create" ></td>
</tr>
</form>
</table>
</td></tr></table>
</td>
<td valign="top">
</td>
</tr>
</table>
<%@ include file="/includes/footer.jsp" %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -