Java Servlets: Why hast though forsaken me? Part II

Posted April 8th, 2007 in Technology, University of Iowa by Dennis

Integrating mySQL with Java Servlets is tedious, but at least the GUI is easier to derive. Looks like it works OK, but there are still some java stuff I keep forgetting:

  1. Converting String to an Int -> Integer.parseInt(str); OR new Integer(str).intValue(); OR Integer.valueOf(str).intValue();
  2. String to byte[] -> str.getBytes();
  3. byte[] to String -> str.getBytes();
  4. int to String -> Integer.toStrin(n); OR “” + n;
  5. Integer to int -> num.intValue();
  6. String to char[] -> str.toCharArray();
  7. char[] to String -> new String(ca,0,ca.length);

Ugh. Now, I’m calling it a day.

Java Servlets: Why hast though forsaken me?

Posted April 8th, 2007 in Technology, University of Iowa by Dennis

The current Web Programming project is integrating mySQL with a Java Servlet front-end. This is fine, especially since current Java GUI’s are difficult to create. Doing this through a web page makes MUCH more sense. However, I can’t use cookies to hold some of my session data because my data occasionally contains characters that cookies don’t want me to use. I suppose I could chuck data back and forth using hidden text fields, but I have yet to determine how to parse through more than one hidden field. I don’t want to use instance variables in my java code, because that means I’ll run into problems if MORE THAN ONE client attaches to mySQL (i.e. synchronization issues).

Well. It’s finally up and running. It did take some time with tossing hidden fields back and forth. Actually, the java language has some good hooks that I wasn’t aware of. Nice.