### WebCommonUtil: Web Request Utility Source: https://github.com/drchhun/jexframe/blob/main/test.html WebCommonUtil simplifies servlet request and response handling in web applications. It provides methods to retrieve input domains, create output domains, and access session data. It is typically instantiated using `WebCommonUtil.getInstance(request, response)`. ```Java // In a servlet or action class WebCommonUtil util = WebCommonUtil.getInstance(request, response); // Read incoming parameters JexData input = util.getInputDomain(); // Prepare output JexData output = util.createResultDomain(); output.put("STATUS", "OK"); // Send back util.createResultDomain().put("DATA", output.toJSON()); ``` -------------------------------- ### JexConnectionManager: Create IDO Connection Source: https://github.com/drchhun/jexframe/blob/main/test.html JexConnectionManager acts as a factory for creating database and session connections. It is essential to call `createIDOConnection()` to obtain a `JexConnection` instance before executing any IDO operations. ```Java // Acquire a connection to run IDO queries JexConnection conn = JexConnectionManager.createIDOConnection(); ``` -------------------------------- ### StringUtil: String Manipulation Helpers Source: https://github.com/drchhun/jexframe/blob/main/test.html StringUtil offers common methods for string manipulation, including conversion, null-safety, and message building. It provides utilities like `null2Void` for default values, `toInt` for safe integer parsing, and `append` for concatenating strings and other types. ```Java String id = StringUtil.null2Void(request.getParameter("id"), "N/A"); int page = StringUtil.toInt(request.getParameter("page"), 1); String full = StringUtil.append("User:", id, "|Page:", page); ``` -------------------------------- ### DomainUtil: Error & Validation Helper Source: https://github.com/drchhun/jexframe/blob/main/test.html DomainUtil provides utility methods for checking and extracting errors from `JexData` or lists, helping to keep action code concise. It includes functions like `isError`, `getErrorCode`, and `getErrorMessage` to streamline error handling after IDO calls. ```Java // After an IDO call: if (DomainUtil.isError(idoOut)) { String code = DomainUtil.getErrorCode(idoOut); String msg = DomainUtil.getErrorMessage(idoOut); throw new JexWebBIZException("Error " + code + ": " + msg); } ``` -------------------------------- ### JexData: Core Data Container for IDO Parameters Source: https://github.com/drchhun/jexframe/blob/main/test.html JexData is a JSON-compatible key/value store used for request and response payloads in JexFrame. It facilitates building IDO parameters, reading service outputs, and nesting sub-data. It supports putting and retrieving various data types and merging other JexData objects. ```Java // Create and populate an IDO input object JexData idoIn = util.createIDOData("TB_BOOK_L001"); idoIn.put("BOOK_ID", "B001"); idoIn.put("END_PAGE_NO", 50); // Read a single record response JexData result = conn.execute(idoIn); String title = result.getString("BOOK_TITLE"); System.out.println("Title: " + title); // Merge another JexData JexData extras = new JexData(); extras.put("CATEGORY", "Fiction"); idoIn.putAll(extras); ``` -------------------------------- ### JexConnection: Transactional Query Executor Source: https://github.com/drchhun/jexframe/blob/main/test.html JexConnection manages the execution of `JexData` payloads and transaction boundaries. It supports both single-record (`execute`) and multi-record (`executeList`) calls. Proper transaction management with `beginTransaction`, `commit`, `rollback`, and `endTransaction` is crucial for data integrity. ```Java conn.beginTransaction(); try { // Single-record call JexData out = conn.execute(idoIn); // Multi-record call JexDataList list = conn.executeList(idoIn); conn.commit(); } catch (Exception e) { conn.rollback(); throw e; } finally { conn.endTransaction(); } ``` -------------------------------- ### JexException Hierarchy: Error Signaling Source: https://github.com/drchhun/jexframe/blob/main/test.html The JexException hierarchy defines base classes and subtypes for signaling controlled business logic errors or transaction rollbacks. Uncaught exceptions within this hierarchy can trigger automatic rollbacks, ensuring data consistency. ```Java // Business logic error throw new JexBIZException("Invalid data"); // Web-layer error throw new JexWebBIZException(idoOut); // Transaction rollback throw new JexTransactionRollbackException("DB failure") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.