Tuesday, December 28, 2010

javascript : anchor href

use href="javascript:void(0)" in place of (#)
this is the most common method to get around this problem .
the anchor still get an href attribute , but it doesn't do anything .

Display tag : Editable Display Tag Table

http://demo.raibledesigns.com/appfuse/demos/users-edit.jsp

Wednesday, December 22, 2010

HTML : pop-up window

<script language="JavaScript">
function PopupMe1(){
myleft=(screen.width)?(screen.width-300)/2:100;mytop=(screen.height)?(screen.height-200)/2:100;
settings='top=' + mytop + ',left=' + myleft + ',width=300,height=200,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,fullscreen=no'
PopupWin1=window.open('sample.htm','PopupWin1', settings);
PopupWin1.focus();}
</script> 
<a href="javascript:PopupMe1()">Click here</a>

Tuesday, December 21, 2010

Spring and Hibernate : integration

<beans>
    <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName">
            <value>oracle.jdbc.driver.OracleDriver</value>
        </property>
        <property name="url">
            <value>jdbc:oracle:thin:@server-lms:1521:orcl</value>
        </property>
        <property name="username">
            <value>cvupload</value>
        </property>
        <property name="password">
            <value>cvupload</value>
        </property>
    </bean>
    <bean id="mySessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="myDataSource" />
        </property>
        <property name="mappingResources">
            <list>
                <value>cvDetails.hbm.xml</value>
                <value>TestType.hbm.xml</value>
                <value>Status.hbm.xml</value>
                <value>TestDetails.hbm.xml</value>
                <value>Tester.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <!-- <prop key="hibernate.hbm2ddl.auto">create</prop> -->
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.max_fetch_depth">2</prop>
            </props>
            <!--<value>hibernate.dialect=org.hibernate.dialect.Oracle10gDialect</value> -->
        </property>
    </bean>

Sunday, December 19, 2010

The Steps Needed to Integrate and Configure Hibernate

1- Identify the POJOs that have a database representation
2- Identify which properties of those POJOs need to be persisted
3- Create Hibernate XML mapping files for each of the POJOs that map properties       to columns in a table.
4- Create the database schema using the schema export tool, use an existing                 database, or create your own database schema .
5- Add the Hibernate Java libraries to your application’s classpath .
6- Create a Hibernate XML configuration file that points to your database                 and   your XML mapping files.
7- In your Java application, create a Hibernate Configuration  object  that               references your XML configuration file.
8- Also in your Java application, build a Hibernate SessionFactory object from the
    Configuration object.
9- Finally, retrieve Hibernate Session objects from the SessionFactory, and write   your data access logic for your application.

Saturday, December 18, 2010

Dojo : Ajax

 <button id="bb" name="bb" value="AJAX" dojoType="dijit.form.Button" title="AJAX" onclick="koko();">
         <script type="text/javascript"  >
function koko(){
dojo.xhrGet( {
     
        url: "ajaxTest.jsp",
        handleAs: "text",

        timeout: 5000, // Time in milliseconds

        // The LOAD function will be called on a successful response.
        load: function(response, ioArgs) { //
          dojo.byId("dataArea").innerHTML = response; //
          return response; //
        }});
}
        </script>
    </button>
<textarea  id="dataArea" >
</textarea>

Wednesday, December 15, 2010

Dojo : DateTextBox

<html>
<head>
  <title>Dojo: Hello World!</title>

  <!-- SECTION 1 -->
  <style type="text/css">
      @import "js/dijit/themes/tundra/tundra.css";
      @import "js/dojo/resources/dojo.css"
  </style>
  <script type="text/javascript" src="js/dojo/dojo.js"
    djConfig="parseOnLoad: true"></script>
</head>

<body class="tundra">
  <script type="text/javascript">
     // Load Dojo's code relating to the Button widget
     dojo.require("dijit.form.Button");
  dojo.require("dijit.form.DateTextBox");
  </script>

  <button dojoType="dijit.form.Button" id="helloButton">
      Hello World!
      <script type="dojo/method" event="onClick">
         alert('You pressed the button');
      </script>
  </button>
<input id="q14b" type="text" name="date1" value="2005-12-30"
    dojoType="dijit.form.DateTextBox"
    lang="en-us"
    required="true"
    promptMessage="mm/dd/yyyy"
    invalidMessage="Invalid date. Use mm/dd/yyyy format." />
</body>
</html>