A nice stuff, put it here :) 1: JDK Development System Environment Variable Settings: Win2000: Right-click My Computer - "Properties -" Advanced - "Environmental Variable ClassPath = JDK installation / libpath = jdk installation directory / bin Note: must not be ignored ".". Win98: Modifying AutoCexe.bat is to modify the automatic batch file. Add: set classpath = .; JDK installation / libset path = jdk installation directory / bin;% PATH% 2: (premise settings system environment variable) Do not bring compilation, quite simple: Javac class name .javajava class name About the compilation problem of bag: If your class is packaged, you should compile: Javajava's parent catalog. Javajava package name. Class name 3: Tomcat server configuration: 1): Set the system Environment variable. 2): java_home = g: /jbuilder6/jdk1.3.1 g: /jbuilder6/jdk1.3.1 is a JDK installation directory 3): Tomcat_Home = Tomcat installation directory 4: Modify the Serlet without restart Tomcat modification% Tomcat_Home% / conf / server .xml is approximately as follows:
5: Modify the servlet in WebShpere without restarting the service: Modify ../web-inf below Web.xml: Join
Configuring Database Pilot Step 1: Add Category Library Tools -> Config Libraries Add Your Database Driver Table 2: Tools -> Enterprise Setup -> Database Drivers Add the class library you just added to the third step : After restarting JBilder, Tools -> DATABASE PILOT -> Option -> Drivers, add driver Step 4: New construction in Database Pilot Point, Driver: com.ibm.db2.jdbc.app.db2driver.
URL: JDBC: DB2: DB_SDBC. (DB_SDBC is a DB2 database on the server). 7: Solve Java Chinese issues: For Applet and AWT: 1 :) font f = new font (uiResource.getstring ("default_font", font. Plain, 12); UIManager.Put ("label.font", f); uimanager.put ("label.Foreground", color.black; uimanager.put; uimanager.put "Menu.font", f); uimanager.put ("MenuItem.font", f); uimanager.put ("list.font", f); UIManager.put ("Checkbox.Font", F); UIManager. PUT ("Radiobutton.font", F); UIManager.Put ("ComboBox.Font", F); UIManager.put ("TextArea.font", F); 2 :) font f = new font ("Lishu", Font.Plain, 15); UIManager.Put ("Button.Font", Font); UIManager.put ("ToggleButton.Font", Font); UIManager.put ("Radiobutton.Font", Font); UIManager.put "Checkbox.Font", font; uimanager.put ("colorchooser.font", font); UIManager.put ("ToggleButton.font", font); UIManager.Put ("ComboBox.Font", font); UIManager. PUT ("ComboBoxItem.font", font; uimanager.put ("INTERNALFRAME.TILEFONT", FONT); UIManager .put ("label.font", font; uimanager.put ("list.font", font); uimanager.put ("menubar.font", font); UIManager.put ("menu.font", font) UIManager.Put ("MenuItem.Font", Font; UIManager.Put ("RadiobuttonMenuItem.font", FONT); UIManager.put ("CheckBoxMenuItem.font", font); uimanager.put ("PopupMenu.font", Font); UIManager.Put ("Optionpane.Font", font); UIManager.put ("Panel.Font", font); UIManager.put ("ProgressBar.font", Font);
UIManager.put ("scrollpane.font", font); UIManager.put ("ViewPort", font); UIManager.put ("Tabbedpane.Font", Font); UIManager.put ("TableHeader.Font", font); UIManager.put ("textfield.font", font; uimanager.put ("passwordfiled.font", font); UIManager.put ("textarea.font", font); UIManager.put ("TextPane.Font", font ); UIManager.Put ("editorpane.font", font); UIManager.put ("TitledBorder.font", font); UIManager.put ("Toolbar.Font", Font); UIManager.put ("Tooltip.Font" , UIManager.Put ("Tree.Font", Font); 3 :) For JSP and Servlet: Solution: First: Add: <% @ Page ContentType = "TEXT / HTML; Charset = GB2312 "%> servlet or inside public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {response.setContentType (" text / html; charset = gb2312 "); // this is important if the above not to use The following method is called before the data is stored: public static string unicodetochinese (string s) {{if (s == null || s.equals (")) returno" "; string newstring = null; newstring = new String (S.GetBytes ("ISO8859_1"), "GB2312"); return newstring;} catch (UnsupportedEncodingException e) {return s;}} public static String ChineseToUnicode (String s) {try {if (s == null || s.equals ( "")) return ""; String newstring = null Newstring = new string (S.GetBytes ("GB2312"), "ISO8859_1"); return.comtring;} catch (unsupporteencodingexception e) {return s;}} 3 :) Solve WebLogic / WebShpere Chinese Question: In Web.xml File The Chinese environment is required.
R As:
} // If the file name is quoted IF (CDIS [0] .Charat (CDIS [0] .length () - 1) == '"') {Return CDIS [0] .substring (POS 6, CDIS [0 ] .length () - 1);} Return CDIS [0] .substring (POS 5, CDIS [0] .length ());}} 8: String Split: Public int getCount (String Str, String Sign) {// Find a number of Strs in a string, a number of occurrences of a specific substring S (Str == null) return 0; StringTokenizer S = New StringTokenizer (STR, SIGN); Return S.CountToKens ();} public string [ ] GetArray (String Str, String Sign) {// is marked by a specific substring S, the sub-string is intermediary. INT count = getcount (str, sign); int J = 0; string [] arr = new string [ Count]; for (int i = 0; i 1.3 solve a problem as follows: public String stringReplace (String sourceString, String toReplaceString, String replaceString) {String returnString = sourceString; int stringLength = 0; if (toReplaceString = null!) {StringLength = toReplaceString.length () } If (returnstring! = Null && returnstring.LENGTH ()> StringLength) {int max = 0; string s4 = ""; for (int i = 0; i 10: Digital Transfer Currency Capital (JS) Function Changetobig (Value) {Var Intfen, I; Var Strarr, Strnum, Strfen, Strdw, Strnum, Strbig, Strnow; IF (TRIM (Value) == "") // Data is Returns "zero" return "zero" illegal prompt when it is illegal, and returns the empty string {strr = "data" value "illegal!" "; } StrCheck = value "."; Strr = strcheck.split ("."); StrCheck = strarr [0]; if (strCheck.Length> 12) // data is greater than or equal to 10 trillion tips Unable to handle {streyr = " Data " Value " excessively, unable to handle! "Alert (strerr); return";} try {i = 0; strbig = "; intfen = value * 100; // Convert To divide the numerical STRFEN = intfen.tostring (); strarr = strfen.split ("."); strfen = strarr [0]; intfen = strfen.Length; // Get length strr = strfen.split (""); // Take each value Decompose to the array inside the While (INTFEN! = 0) // Decomposition and conversion = i 1; switch (i) // selection unit {case 1: strdw = "points"; Break; case 2: strdw = "angle "; Break; Case 3: strdw =" yuan "; Break; case 4: strdw =" pick "; break; case 5: strdw =" "; break; case 6: strdw =" 仟 "; Break; Case 7 : strdw = "10,000"; Break; Case 8: strdw = "Pick"; BREAK; Case 9: strdw = ""; Break; case 10: strdw = "仟"; Break; Case 11: strdw = "hundreds"; Break; Case 12: strdw = "pick"; break; casse 13: strdw = "佰"; break; casse 14: strdw = ""; Break;} Switch (strarr [intfEN-1]) // Select Number {CASE "1": Strnum = "壹"; Break; Case "2": strnum = ""; Break; Case "3": Strnum = "叁"; Break; Case "4": strnum = ""; break; case "5": strnum = "Wu"; Break; Case "6": strnum = " "; Break; Case" 7 ": strnum =" 柒 "; break; case" 8 ": strnum =" 捌 "; break; case" 9 ": strnum =" 玖 "; break; case" 0 ": strnum = "Zero"; break;} // handle special case strnow = strbig.split (""); // Divided into zero case IF ((i == 1) && (strarr [intfen-1] == "0 ")) Strbig =" whole "; // angle is zero-when ELSE IF ((i == 2) && (strarr [INTFEN-1] ==" 0 ")) {// At the same time zero Situation IF (strbig! = "Whole") strbig = "zero" strbig;} // yuan is zero case ELSE IF ((i == 3) && (strarr [intfen-1] == "0") Strbig = "Yuan" strbig; // Pick up - 且 ELSE IF ((i <7) && (i> 3) when it is zero and the previous one (yuan or more) is not zero && (Strarr [INTFEN-1] == "0") && (STRNOW [0]! = "zero") && (Strnow [0]! = "yuan")) Strbig = "zero" strbig; // Pick up - 中 一 且 且 且 e e e i i (i ((i ((情况 情况 (((情况 零 (零 为 零 零 为 情况 为 为 为 为 为 零 为") && (STRNOW [0] ==" zero ")) {} // Pick up - 仟 中 位 且 e 且 e e e e ELSE IF ((i <7) && (i> 3) && (strrr [intfEN-1] == "0") && (Strnow [0] == "yuan"))) {} // When 万 万 万 上 上 (((( i == 7) && (strarr [intfEN-1] == "0")) Strbig = "10,000" S TRBIG; // Pick up 10,000,000 in a zero and the previous one (10,000 or more) is not zero, ELSE IF ((i <11) && (i> 7) && (strarr [intfEN-1] == "0") && (Strnow [0]! = "zero") && (Strnow [0]! = "10,000")) Strbig = "zero" strbig; // Pick up Wan - Ten thousand sizes is zero and the previous one (more than 10,000) is also across else IF ((i <11) && (i> 7) && (Strarr [INTFEN-1] == " 0 ") && (Strnow [0] ==" Wan ")) {} // Pick up 10,000 in one bit of zero and the previous one is the case of 10,000 and zero (((((( I <11) && (i> 7) && (strrr [intfEN-1] == "0") && (Strnow [0] == "zero")) {} // million is zero and there is a position and When more than 100,000 yuan, ELSE IF ((i <11) && (I> 8) && (Strarr [INTFEN-1]! = "0") && (Strnow [0] == "10,000" ) && (Strnow [2] == "")) Strbig = Strnum strdw "万 零" strbig.substring (1, strbig.length); // separately handle ELSE IF (i == 11) { When the // billion is zero, when there is zero, it will drop the rumor to zero IF ((strnow [intfen-1] == "0") && (Strnow [0] == "10,000") && [2] == "")) Strbig = "100 million" "zero" strbig.substring (1, strbig.length); // billion is zero and there is no need for zero, remove the ELSE IF ((strrr [intfEN-1] == "0") && (Strnow [0] == "10,000") && (Strnow [2]! = "")) Strbig = "100 million" strbig.substring 1, strbig.Length); // billion is not zero and completely zero-existing position, remove the 万 补 ELSE IF ((Strnow [0] == "10,000") && (Strnow [2] == "")) Strbig = strnum strdw "zero" strbig.substring (1, strbig.Length); // billion is not zero and unable to exist, remove Wan else IF ((strNow [ 0] == "10,000") && (STRNOW [2]! = "")) strbig = strnum strdw strbig.substring (1, strbig.length); // Other normal conditions Else strbig = strnum strdw strbig;} // 补 零 中 中 为 为 且 零 零 不 不 不 ((补 ((((((((((((((((((((( 15) && (I> 11) && (strn [INTFEN-1] == "0") && (Strnow [0]! = "Zero") && (Strnow [0]! = "100 million) Strbig =" Zero " strbig; // pick up ELSE IF when it is zero ((i <15) && (i> 11) && ((i <15) && (i> 11) && ((i <15) && (i> 11) && Strarr [intfEN-1] == "0") && (Strnow [0] == "100 million)) {} // pick up 100 million yuan in zero and the previous one is 100 million and zero Else IF ((i <15) && (I> 11) && (Strarr [INTFEN-1] == "0") && (Strnow [0] == "zero")) {} // 100 million 位 且 且 ((i <15) && (i> 11) && (Strarr [INTFEN-1]! = "0") && (Strnow [0] == "zero") && (Strnow [1] == "100 million") && (Strnow [3]! = "仟")) Strbig = Strnum StrDW strbig.substring (1, strbig .length); // billion is zero and there is 10 million and more than 10 billion times, in 100 million yuan to make up ELSE IF ((i <15) && (i> 11) && (strarr [intfen-1] ! = "0") && (STRNOW [0] == "zero") && (Strnow [1] == "100 million") && (Strnow [3] == "仟")) Strbig = Strnum strDW "billion Zero " strbig.substring (2, strbig.length); Else strbig = strnum strdw strbig; strfen = strfen.substring (0, intfen-1); intfen = strfen.length; strarr = strfen.split (" " );} Catch strbig;} catch (err) {return ""; // Failure is returned to the original value}}} 11: Remove all directories under the folder: / * * Delete all the files under a directory * / public static void deLallFile (String path) {file file = new file (path); if (! File.exists ()) Return; IF (! file.isdirectory ()) return; string [] templist = file.list (); file temp = null; for (int i = 0; i String str = "2002.07.04"; paraSeposition POS = new paraSeposition (0); DATE DT = formatter.parse (STR, POS); if (dt! = Null) {// is a legal date} else {// illegal date } 2 :) Two dates are reduced to import java.util. *; Import java.text. *; Class a {public static void main (string [] args) {string s1 = "2003/08/15 17:15: 30 "; string s2 =" 2002/09/14 14:18:37 "; try {simpledateformat formatter = new SimpleDateFormat (" YYYY / MM / DD HH: MM: SS "); Parseposition POS = New PaSeposition (0); PARSEPSITION POS1 = New PaSeposition (0); DATE DT1 = Formatter.Parse (S1, POS); DATE DT2 = Formatter.Parse (S2, POS1); System.out.Println ("DT1 =" DT1); System.out .println ("DT2 =" DT2); long L = dt1.gettime () - DT2.Gettime (); System.out.Println ("Hello World! =" L);} catch (Exception E) {system .out.println ("exception" e.tostring ());}}} 3 :) Get 2 months later: Import java.util. *; import java.text.dateFormat; public class test2 {public static void main (string args []) throws exception {string Date = "2001/11/30"; DateFormat DA teFormat = DateFormat.getDateInstance (DateFormat.MEDIUM); GregorianCalendar grc = new GregorianCalendar (); grc.setTime (new Date (date)); grc.add (GregorianCalendar.MONTH, 2); System.out.println ( "grc = " dateFormat.format (grc.getTime ()));}} 13: jsp / servet redirects: do not change the url: 1:) servlet: public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { GetServletContext (). getRequestDispatcher (Test2URL) .forward (Request, Response); 2: JSP This way that we do will really be actually effective. WebLogic will only know the JDBC Connection Pool II. Configuring Data Source 1) In the WebLogic Console, use the Services / JDBC / TX Data Sources2 in turn.) Click Configure A New JDBC TX. Data Source ... 3) Fill in each parameter, as follows: JNDI Name: MySQLDataSorucePoolName: MySQLPoolrow Prefetch Size: 48Stream Chunk Size: 2564) Don't forget to apply :) 5) Similarly, choose Targets , Select the Servers check, select MyServer in Available, then click "->", then click Apply. This way that we do will really be actually effective, and WebLogic will only know the DataSource we have configured. JBUILDER 7 related configuration 1. Lame as WebLogic, before performing this configuration, put the database JDBC driver JAR file in the D: / jbuilder7 / lib / jar file (suggesting this, no JDBC directory to build a) 1) Open JBuilder 7, click Tools / Enterprise Setup ....... 2) Select the Database Drivers Sign 3 in the pop-up window) Point Add button, pop up a new window (maybe you Slightly different from the graph) 4) Click the New ... button, pop up a new window, and change the Name: The default value is mysql (as long as it makes sense, what is all the names) 5) Click Add. .. button to find and add a database of JDBC driver, of course, we go to D: / jBuilder7 / lib / jdbc, choose mysql.jar, pay attention, don't expand mysql.jar, select the picture, then press OK. . Tip: You can match the SHIFT and CTRL keys to select multiple .jar files. 6) The result is as follows, if there is a plurality of .jar files that need to be added, you can also click the Add ... button to continue adding. 7) OK exit .8) OK, then MySQL JDBC driver has been added. 9) OK again, JBuilder prompts to restart, the above configuration will take effect, determine and restart JBUILDER. Second, the configuration of EJB 2.0 and application servers, with WebLogic 6.x as an example to install Borland Enterprise Servler 5.02 before doing this configuration, IAS 4.5 is also a matter, both of them, of course, I am new. Old, installation procedure, because it is very easy! Basically, I will install my installation in D: / BorlandEnterpriseserver. 1) Open JBuilder 7, click Tools / Enterprise Setup ....... 2) Select the CORBA sign, drop-down list box under Configuration, select Visibroker 3) Select Edit ..., pop-up Edit Confiuration window Click Path for ORB Tools 4) Click Path for ORB Tools: Browse the ... Browse button, pop up the Select Directory window, select D: / BorlandEnterpriseServer5 / bin and OK. 5) Two times, OK, JBuilder asked you to restart, no way, do it, restart JBuilder. 6) After restart, go to Tools / Enterprise Setup ......., choose CORBA item, select Edit, select Library for Projects next to the pop-up window ... button 7) User in the new window in the pop-up You will find more options Borland Enterprise Server 5.0.2 Client, which is displayed in the picture, and then exits three times ok. 8) Select Project / Default Project Properties item 9) Select a Server sign in the dialog box, click ... Buttons, 10) In the new dialog box that pops up, select WebLogic Application Server 6.x , then Check if enable server, see the red box in the figure. 11) After checking Enable Server, other optional or detailed, click ... buttons, select Home Directory; select Working Directory; for your machine's WebLogic location. 12) Click on the Add button in the Class sign, add it to the D: /Bea/wlserver6.1/lib/cr_wls60f.jar file. As shown in the red line above. Use the MOVE UP button to move the D: /bea/wlserver6.1/lib/cr_wls60f.jar file, because generally added .jar files at the bottom side. This step is also more important, because WebLogic can be launched directly in the JBuilder environment, then it is necessary to test whether License is legal, that is, the cr_wls60f.jar file exists. 13) Select the Custom check, configure it as shown in the following red line, may have a different WebLogic directory location to have me, but it is the same. After configuring, click the OK button to exit Domain Name: MyDomain Server Name: MyServer Version: 6.1 Service Pack1 (D: /Bea/WLSer6.1) 14) Single Server for All Services in Project drop-down list box in the picture window Select WebLogic Application Server 6.x as shown, then OK exits. 15) When this JBuiler 7 is completed with WebLogic 6.x, then let's start! 15. Calculate the date period PUBLIC INT GETDAYS (Date SD, DATE ED) {Return (Ed.getTime () - SD.getTime ()) / (3600 * 24 * 1000)} 16. Date Add or decrease SimpleDateFormat SDF = New SimpleDateFormat "yyyymmdd"); string str = "20011230"; DATE DT = SDF.PARS (Str, New PaSeposition (0)); Calendar RightNow = Calendar.GetInstance (); RightNow.SetTime (DT); RightNow.Add (Calendar. Date, 2); // Date you have to add Date DT1 = rightnow.gettime (); string restr = sdf.format (dt1, ", new fieldPosition (0)); System.out.Println (restr); 17. Time display control first way: 18. Encryption & Decryption When the string STR is encrypted before inserting the database: java.net.urlencoder.Encode (String Str); decoding again when removed from the database: (You can do not encrypt, only decode, try it; No re-encryption) java.net.urdecoder.decode (String Str); 19. Page refresh: There are three ways: 1, add: