Tuesday, December 27, 2011

JSF with JQurey for Clientside Validations

Step1: Writing JSF managed beans

package beans;
public class UserBean {     

private String username;
public UserBean() { }
public String getPassword() {return password;}
public void setPassword(String password) {this.password = password;}

}
 Step2: Writing faces-config.xml

<managed-bean>
<managed-bean-name>userBean</managed-bean-name>
<managed-bean-class>beans.UserBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
Step3: JSF Form with JQuery
(We are validating username field)

<%@page contentType="text/html" %>de"> <%@page contentType="text/html" %>
<script language="javascript" src="jquery-1.4.2.js"></script>
        

<script language="javascript">
function checkUsername(){
$.get( "checkusername.jsp",{username : $("#registerform\\:username").val()},updateUsername);
}
function updateUsername(response) {
if (response) {
$("#usernameresult").text(response);
// update SPAN item with result
}
        </script>          

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<f:view>
<h2>Registration </h2>
<h:form id="<b><font color=">registerform">
Username : <h:inputtext id="<b><font color=">username" value="#{userBean.username}" required="true" onblur="checkUsername()" /></h:inputtext>
</h:form>
</f:view>
</pre>
               
               usernameresult" /> 

              

lt;/f:view>

The most important thing is to know how to access JSF component from JQuery.

The id given to inputText is consisting of formid:componentid. So in this example the id given to textbox is registerform:username. But the presence of : (colon) causes problem to JQuery. So, we need to escape : (colon) using two \\ characters before colon - registerform\\:username.


Step 4: checkusername.jsp ( to check the user is valid)

<%@ page import="java.sql.*"  contentType="text/plain"%> <%  String username = request.getParameter("username");  // sent from client  // connect to oracle using thin driver  Class.forName("oracle.jdbc.driver.OracleDriver"); 
try{  Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","youruser","yourpassword");  PreparedStatement ps = con.prepareStatement("select username from users where username = ?");  ps.setString(1,username);  ResultSet  rs = ps.executeQuery();  if ( rs.next()) { // found username     out.println("Username is already present!");  // send this to client as response   }
}catch(Exception e){e.printStackTrace();}
finally{
try{  rs.close();  ps.close();  con.close();
}catch(Exception e) {}
%>

Tuesday, December 13, 2011

Oracle Help

  • How to Find a Child Tables List from the Parent Table?

SELECT table_name, constraint_name FROM user_constraints
WHERE r_constraint_name in
(SELECT constraint_name FROM user_constraints WHERE table_name = 'PARENT_TABLE' )
ORDER BY Table_name ;

Friday, December 9, 2011

PrimeFaces 3.0.M4 is integrated with JQuery Mobile on JSF2.0

  • 100+ Readily available RICH Components

  • Configurable Themes

  • Ajax PUSH

  • Mobile TouchFaces built with JQuery mobile

  • Light Weight

  • Easy to use

  • Standard based development



Wednesday, August 31, 2011

jQuery Mobile !!!! Looking forward to use

http://jquerymobile.com/blog/2011/08/03/jquery-mobile-beta-2-released/

Looking for the best framework to develop web app with tagets as IPhone, Android and Blackberry.

Solution is almost available. just have to integrate with Grails and see how it works.

Tuesday, August 16, 2011

Grails to develop Mobile(Android/Iphone/Blackberry) based Web App with JQuery

Spent some time and started the Grails 1.3.7 to develop web application with the target devices as different hand held devices mainly Android, IPhone, Balck berry in my local setup

Saturday, August 6, 2011

Struts2, EJB3.0. MQ Series, IBM RAD, Web Sphere

Am back development of Enterprise Level Applications in Struts 2.x, EJB3.0. IBM MQ series, Web sphere !!!!! due to job change at CGI Federal Project "PECOS" pronounced as "PAYCOS" (CMS Medicare project) after working in Spring IOC, DAO, EE,MVC, Hibernate 3,x. JSF 1.2.x, Grails 1.0 to Grails 1.3.7 on GIS and Spatial Projects for 4 years from 2007.

Saturday, March 19, 2011

Tuesday, March 1, 2011

Open Source VoIP Server

Have build the open Source VoIP server on SuSE Linux server with Asterisk open source Tools.

Please get in touch if you are looking to implement your own VoIP server setup for your office.

World Class GIS Mapping solution to integrate with any Spatial Database

I have developed World Class GIS Mapping solution to Integrate with any Spatial Database (Oracle Spatial, ARC SDE, POstGIS, Shape files) with the Web application built with JSP/Servlets/JSF/Struts/ Grails applications.

Have Excellent programming skills with OpenLayers API, Google Map API V2 and V3, Geo Server, OGC Standards like WMS, WCS, WFS technologies.

Successfully hosted the Geoserver, Tomcat, PostGIS deployment on Linux servers to maintain the GIS mapping solution with realtime Traffic applications with Schedulers and Webservices.

Please get in touch to get technical assitance in developeing or improving the performance of Geo Spatial or GIS Mapping or GIS analysis processes involved in COre Spatial Databases.