Bob Robertson

Greenhorn
+ Follow
since May 16, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bob Robertson

Well, not that this is really an IDE question, but whatever... probably more an ANT topic, but definitiely servlets... when I'm in the project whether working in notepad or whatever, I need to tell ANT what to do. It needs to know what libraries to use when compiling. However, my local enviornrment maybe windows with a local version of Tomcat, but I'm deploying to a Linux box where I have no visibility outside of dropping in the war file to a folder. I could just set the classpath to the local tomcat instance's servlet.jar but that doesn't seem right. Plus, how will that affect my deployment? Do I need to configure some env variable to abstract this?

I need my project to compile so I can build the WAR, but I don't want to include a servlet.jar in my lib folder of my webapp. How do I organize my project make sure I avoid conflicts? And will Tomcat by default override whatever servlet.jar I've specified with its own?

Thanks!
Hello,

I am curious to know about how to manage my local development of a webapp and the Tomcat server I'm deploying to.

I'm using Netbeans 4.1 where I include the servlet api so those classes are available to me in my project. However, I don't think I should have to include it in my app's lib directory seeing as how Tomcat will already be running that for me. Do I just need to make sure that my ant deploy task omits that jar from the build or do I need to have the api in both the Tomcat lib and the webapp's lib?

Thanks in advance!

br
Ok, so here is what I tried... I'm really starting to like the regex API, by the way. Going to have to read up more on how to use them patterns!

String a = "12.0"; //Valid
String b = "12.5"; //Invalid

Pattern p = Pattern.compile( "([0-9]*)\\.[0]" );

Matcher m = p.matcher(a);
m.matches(); //TRUE

Matcher m = p.matcher(b);
m.matches(); //FALSE

I think this will be me over the hump unless anyone can predict some scenarios where I may miss some data. I'd appreciate any comments.

Thanks!!!

br
13 years ago
[not relevent to this forum]
13 years ago
Ok, I agree that the try/catch method would be the easiest and it is funny that someone mentioned that accounting for floats would add to the hassle. Turns out, all the valid integers I need are actually being stored as floats which invalidates everything.

For example, I am using POI to parse an excel doc. When I grab the data from a column where I expect the data to be a cell type of numeric, I actually get a float represenation of the value (e.g. 12 becomes 12.0 through POI's API).

When I test that value using the regex API pattern [0-9]* it fails because the value is a float. But floats should fail because 12.5 would be an invalid value.

So now once I get this value as a String(), I have to do the following:

1- Remove all whitespace
2- Test for non-numeric values
3- Somehow make sure that the value after the decimal is always a 0.

Regex may get me where I need if I can figure out a pattern that accepts decimals points, but only allows that value after the decimal to be a 0. Otherwise, I guess I could try/catch on a parseFloat() and figure out some logic to test the value after the decimal, right?
13 years ago
[Not relevant to this forum]
13 years ago
Hello,

I have a situation where I want to validate whether the value passed in as a String() is a numeric v. alpha/special char value. The process that will consume this data post-validation will be expecting numeric values.

Can someone give me a hint with how to do this without using a NumberFormatException? If the Exception is encountered the only recovery necessary will be to log the data that needs to be reviewed since the data is subjective and cannot be modified at runtime based on any conditions. I could just try to catch a NFE when trying to convert the value to an integer and then log that that data needs to be eye-balled, but I was hoping to do something a little more purdy.

If I were to use the java regex uitils, would I be provided a means to eliminate all alpha and special characters?

Just looking for a thums-up/thumbs-down or a possible alternative.

Thanks!

bo-bizzle po-pizzle
13 years ago
Hello,

[not relevant to this forum]
13 years ago
Hello,

I've searched the web, this BB, and apache's site and still have not found my answer so I thought I would take a stab at posting a question.

I am trying to create a WAR file that includes directories that would reside as peers to the WEB-INF directory. Using the WAR task this works fine for classes and the lib directory, but not for special folders that are necessary like a folder I have called config or templates.

Using the fileset tag, I can get the contents of the directories in the WAR, but not the actual directory with its contents which is what I need. I

I noticed that the TAR task had a fullpath attrbiute that allowed for this, but I can't find docs on a similar jarfileset tag that supports this.

What I have resorted to is copying the necessary folders to my project's web folder, setting web as the basdir, and war'ing from there (using jar task). I then delete the copied folders so I don't have double the space taken up.

Can someone tell me a leaner way to script this build?

Thanks in advance!

br
13 years ago
Thank you for the insight, David. On a recommendation from a colleague, this is what was implemented. Please note, I am not totally happy with this resolution:

14 years ago
Hello,

I am updating an application that is requiring me to write something that will match on the HTML element names in a JSP.

The goal is to exclude the dynamically generated elements in the result. The elements are built from a loop to present a list on the page. The logic is used to uniquely ID a selected element. The format of the elements are as follows:

elementName_i, where i can be 0-15.

Now, I can't leverage the REGEX API like I was hoping to where I could exclude those elements with a character sequence ending in "_i" where I could use the expression for 0-9. I am working with JDK 1.2.

Can someone recommend a solution that will get me started in the right direction?

I can write something that does String evaluations or something and muddle my way through it, but I would like to see if there is a more clean way to go about it.

Any hints would be appreciated.

br
14 years ago
Thanks for the responses. I do acutally like the try/catch solution the best, since I just found out the problem is actually that the value null is "null". Somewhere someone is initializing the value to the string "null". Nobody knows why. So the value isn't null afterall which falls right into your response.

There is some nervousness about implementing something like this because no one knows what would change if we checked this way because we have no idea what the original intent of the developers were.

I'll try it out and see if I can break some stuff reeeal good (but I doubt it).

Thanks!!!

You guys rawk.
14 years ago