Hoho!
Har en javakod där jag försöker köra request.getParameter("NotToBeInovice");
men sen när jag försöker kompilera detta så gnäller den på variabel request.
protected String insertActionInDb(String prId, String userId, String[] to, String[] cc, String solution, String mail,String[] attachmentName, String actionType, String workHours, String workType) throws Exception {
String sql = "select PersonId from CMCompanyPeople where WUIUserID='"+userId+"'";
String[][] tab = rh.executeQuery(sql);
String retInfo = null;
String insertUser = "0";
try {
Double.parseDouble(workHours);
} catch(Exception e) {
workHours = "0";
}
if (tab.length>0) {
insertUser = tab[0][0];
}
StringBuffer toInsert = new StringBuffer("Email sent to:\n");
if(to != null) {
for (int i=0; i<to.length;i++) {
toInsert.append(to[i]);
toInsert.append("\n");
}
}
if(cc != null && cc.length>0) {
toInsert.append("CC:\n");
for (int i=0; i<cc.length;i++) {
toInsert.append(cc[i]);
toInsert.append("\n");
}
}
if(attachmentName != null && attachmentName.length>0) {
for (int i=0;i<attachmentName.length;i++) {
if (attachmentName[i]!= null &&attachmentName[i].length()>0) {
toInsert.append("Attached file: ");
toInsert.append(attachmentName[i]);
toInsert.append("\n");
}
}
}
if (mail != null && mail.length() >0) {
toInsert.append(mail);
toInsert.append("\n");
}
//toInsert.append("Solution/Status:\n");
toInsert.append(solution);
String insertString = toInsert.toString();
if (insertString.length() > 2000) {
retInfo = "The action text will be truncated<br>due to the long email text.";
insertString = insertString.substring(0,2000);
}
insertString = Util.escapeSingleQuotes(insertString);//Util.decode(insertString, 2));
[B]String NotToBeInvoice = request.getParameter("NotToBeInovice");[/B]
sql = "INSERT INTO [PRAction]( [PrId],[PersonId], [CustContactId],[ActionTypeId]"
+",[CreationDate], [Description], [WorkHours], [WorkTypeId], [NotToBeInvoiced])"
+" VALUES('" + prId + "','" +insertUser +"','0', '"+actionType+"', getDate(), '"+ insertString+"','"+workHours+"', '"+workType+"', '"+NotToBeInvoice+"')";
Logging.logDebug(sql);
rh.executeUpdate(sql);
rh.executeUpdate("exec spInsertSOAPHeader 0," + prId + " ,0,1");
return retInfo;
}
protected InternetAddress[] parseEmailAddresses(String toParse) throws Exception{
StringTokenizer strtoken = new StringTokenizer(toParse, ",");
int iSize = strtoken.countTokens();
InternetAddress[] retList = new InternetAddress[iSize];
for(int i = 0; i < iSize; i++) {
String tmpStr = strtoken.nextToken();
tmpStr = tmpStr.trim();
int pos = tmpStr.lastIndexOf(" ");
String tmpName = "";
String tmpAddress = "";
if(pos == -1) { //Just an address if there exist an "@", otherwise just a name
int atPos = tmpStr.indexOf("@");
if(atPos == -1) { //Just a Name
tmpName = tmpStr;
} else { //Just an address
tmpAddress = tmpStr;
}
} else {
if( tmpStr.indexOf("@") == -1 ) { //A name with space
tmpName = tmpStr;
} else {
//There is both a name and an address.
tmpAddress = tmpStr.substring(pos, tmpStr.length());
tmpName = tmpStr.substring(0, pos);
}
}
//At last remove potential "< >" from the address
tmpName = tmpName.trim();
tmpAddress = tmpAddress.trim();
if(tmpAddress.indexOf("<") == 0) {
tmpAddress = tmpAddress.substring(1, (tmpAddress.length()-1));
}
retList[i] = new InternetAddress(tmpAddress, tmpName);
}
return retList;
}
Nån aning om varför detta?
