Skip to main content

Posts

Showing posts from August, 2013

input string validation in adf

Following code in your <af:inputText tag will estrict the values entered by user as per your requirement. Validating a InputTextBox for String Value Only <af:validateRegExp pattern="^[a-zA-Z]+$" messageDetailNoMatch="Number Not allowed" /> allowing only string with space  -->   <af:validateRegExp pattern="^[a-zA-Z  a-zA-Z]+$" messageDetailNoMatch="Number Not allowed" />   it will allow only charecters and not numbers.  

Partial Submit , Auto Submit in ADF

Partial Submit   A partial submit actually is a form submit that does not require a page refresh and only updates components in the view that are referenced from the command component   PartialTriggers   property. Another option for refreshing a component in response to a partial submit is call following code in a managed bean. AdfContext.getCurrentInstance.addPartialTarget ( component_instance ) AdfFacesContext.getCurrentInstance.addPartialTarget ( Component_binding )   If a form contains required fields that the user left empty invoking the partial submit, then errors are shown for each of the field as the full form gets submitted.   ADF Faces adds the concept of partial form submit to JavaServer Faces 1.2 and beyond Auto Submit An input component that has its   autosubmit   property set to true also performs a partial submit of the form. However, this time it doesn't submit the entire form but only the component that triggers the submit plus components referen

Getting DB Connection in Bean/Servlet

Using the following method you will get the connection in your Bean/Servlet for your requirement. For this you just need one parameter from your Server that is the DataSource Name. use the following code in your  Bean/Servlet import javax.naming.Context; import javax.naming.InitialContext; private Connection getDBConnection() {         Context ctx;         Connection conn = null;         try {         ctx = new InitialContext();         DataSource ds;         ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ xyzDS ");         conn = ds.getConnection();         } catch (Exception e) {         // TODO: Add catch code         e.printStackTrace();         }         return conn;     } xyzDS -> is the DataSource Name.