User Profile
Collapse
-
Get the path to WEB-INF
Hello all, I'm currently trying to figure out how I can get the path to the WEB-INF directory on some server-side code I've written. I have resources there I need to modify and I was wondering what calls I need to make to get the path. I've read some post saying to use the servletContext object, but I have no global servletContext instance in my application. Thank you. -
Java Mail API sending HTML email won't display images from cid
My collegue and I are at the point of pulling our hair out. I'm currently writting a little piece of Java code to send an email confirmation page that sends both html and text. Not a problem. In my html, I'm using an image with which I reference through a cid i1. My problem is, in the email I send, I can only get the images to show up if I do:
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
-
This gives me what I need from my test and the conditions I posed above (although it would be nice to know how to do this in one statement):
public static boolean validateValue1( String value)
{
Pattern p2 = Pattern.compile ("[^0-9-\\s]");
Matcher m2 = p2.matcher(valu e);
if(m2.find())
{
return false;
}
Pattern p = Pattern.compile ("[0-9]+[-]*[\\s]*");... -
Thanks so much for the help. Yes I compiled everything and it gives me correct output for any combination of white space, digits, and - characters (assuming the condition that there is at least 1 digit). The problem I am having is if someone enters (for example):
1111-11 111-x111
1x
1-x
--- x
etc.
(I will use the character 'x' here for example only, assume x is any non-digit, non-whitespace,...Leave a comment:
-
I need to verify a serial number is correct. Ok this is what I have now:
public static boolean validateValue(S tring value)
{
Pattern p = Pattern.compile ("[0-9]+[-]*[\\s]*");
Matcher m = p.matcher(value );
return m.find();
}
The thing is the string must contain as least 1 digit, but the "-" and " " characters are optional (there can be zero...Leave a comment:
-
Well, I've tried several things. Here are a few:
mystring.matche s("(\\d*)?(-*)?(\\s*)?")
and I've tried things this way:
Pattern patter1 = Pattern.compile ("(\\d)+(\\s )*(-)*");
Matcher m = patter1.matcher (mystring);
return m.find();...Leave a comment:
-
Need some regex help here please :)
I suck at regex's and I need a little hope. Hopefully there is a guru out there to help me on this one. I want to do a match on the following:
one or more numeric characters [0-9]
zero or more blank spaces \s
zero or more dash characters -
I've tried everything I know for now, but I still can't get my unit test to pass my conditions above. Anyone out there who could help? Thanks so...
No activity results to display
Show More
Leave a comment: