📄 leadcapture.jsp
字号:
<%@ page import="org.ofbiz.entity.*" %>
<%@ page import="org.ofbiz.entity.model.*" %>
<%@ page import="java.lang.reflect.Method" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="org.ofbiz.entity.util.SequenceUtil" %>
<%@ page import="com.sourcetap.sfa.replication.*" %>
<%@ page import="com.sourcetap.sfa.ui.*"%>
<%@ page import="com.sourcetap.sfa.event.*"%>
<%@ page import="com.sourcetap.sfa.util.*" %>
<%@ page import="java.net.*" %>
<%@ page import="javax.servlet.ServletException" %>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.http.HttpServletResponse" %>
<%@ page import="javax.servlet.http.HttpServlet" %>
<%@ include file="/includes/header.jsp" %>
<jsp:useBean id="leadEventProcessor" class="com.sourcetap.sfa.lead.LeadEventProcessor" scope="application" />
<jsp:useBean id="importEventProcessor" class="com.sourcetap.sfa.event.GenericImportEventProcessor" scope="application" />
<%
String screen = "LEAD";
String screenSection = "LeadHeader";
String entityName = "Lead";
CsvConverter csvConverter = null;
String action = "start"; // default action
String onError = request.getParameter("onError");
String onSuccess = request.getParameter("onSuccess");
if ( request.getParameter("action") != null )
{
action = request.getParameter("action");
}
try{
if(action.equals("start")){
%>
<br><br>Please enter your information:<br>
<form action=http://localhost:8080/sfa/control/leadCapture target="_self" method=post>
<input type=hidden name=action value='save'>
<input type=hidden name=cid value='10101.10050'>
<input type=hidden name=uid value='10101.10071'>
<input type=hidden name=onSuccess value='http://my.yahoo.com'>
<input type=hidden name=onError value='leadCapture?action=start'>
<table>
<tr><td>First Name:<td><input name=LeadHeader_Lead_firstName_0></td></tr>
<tr><td>Last Name:<td><input name=LeadHeader_Lead_lastName_0></td></tr>
<tr><td>Company Name:<td><input name=LeadHeader_Lead_companyName_0></td></tr>
<tr><td>Phone:<td><input name=LeadHeader_Lead_businessPhone_0></td></tr>
<tr><td>Email:<td><input name=LeadHeader_Lead_email_0></td></tr>
<tr><td>Address:<td><input name=LeadHeader_Address_mailingAddress_0></td></tr>
<tr><td>City:<td><input name=LeadHeader_Address_city_0></td></tr>
<tr><td>State:<td><input name=LeadHeader_Address_state_0></td></tr>
<tr><td>Zip:<td><input name=LeadHeader_Address_zip_0></td></tr>
<tr><td colspan=2><center><input type=submit value=submit></center></td></tr>
</table>
</form>
<%
}
else if ( action.equals("save") )
{
GenericEventProcessor eventP = leadEventProcessor;
String uid = UtilFormatOut.checkNull(request.getParameter("uid"));
String cid = UtilFormatOut.checkNull(request.getParameter("cid"));
UserInfo importUserInfo = new UserInfo( delegator, uid, cid );
if ( uiCache == null )
uiCache = new UICache();
UIWebScreenSection uiWebScreenSection = importEventProcessor.getUiWebScreenSection(importUserInfo, screen, screenSection, delegator, uiCache);
List fields = uiWebScreenSection.getDisplayFields(uiCache);
Vector importFields = new Vector();
Vector dataValues = new Vector();
Iterator fieldIter = fields.iterator();
while (fieldIter.hasNext())
{
UIFieldInfo fieldInfo = (UIFieldInfo)fieldIter.next();
String fieldName = UIWebUtility.getHtmlName(screenSection, fieldInfo, 0);
String fldValue = request.getParameter(fieldName);
if ( ( fldValue != null ) && (!fldValue.equals("-1")))
{
importFields.add(fieldName);
dataValues.add(fldValue);
System.out.println("adding " + fieldName + " = " + fldValue);
}
}
DataMatrix dataMatrix = new DataMatrix(delegator, uiWebScreenSection.getEntityParamVector());
int status = importEventProcessor.processInsert( importUserInfo, uiWebScreenSection, request, response, delegator, eventP, dataMatrix, dataValues, importFields, uiCache);
if ( status == GenericEventProcessor.STATUS_CONTINUE )
{
if ( ( onSuccess != null ) && ( onSuccess.length() > 0) )
{
System.out.println("redirecting to " + onSuccess);
%>
<script type="text/javascript">location='<%=onSuccess%>'</script>
<%
}
else
out.write("Lead Loaded");
}
else
{
if ( ( onError != null ) && ( onError.length() > 0) )
{
%>
<script type="text/javascript">location='<%=onError%>'</script>
<%
}
else
out.write("Error loading lead");
}
}
%>
</table>
<%
} catch (Exception e) {
e.printStackTrace();
if ( (onError != null ) && ( onError.length() > 0) )
{
%>
<script type="text/javascript">location='<%=onError%>'</script>
<%
}
else
out.write("Error loading lead");
}
%>
<%@ include file="/includes/footer.jsp" %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -