Thursday, August 8, 2013

Creating Validation TextArea in DOJO

Creating Validation TextArea in DOJO:

Sometimes we may need to do the validation of the data entered in TextArea but unfortunately the default TextArea provided by DOJO will not support the validation .

We can create a custom component extending both dijit.form.ValidationTextBox and dijit.form.SimpleTextarea, this will provide the functionality of both the ValidationTextBox and
SimpleTextarea.

dojo.declare(
            "ValidationTextarea",
            [dijit.form.ValidationTextBox,dijit.form.SimpleTextarea],
            {
                  postCreate: function() {
                    this.inherited(arguments);
                },
                validate: function() {
                    if (arguments.length==0) {
                    return this.validate(false);
                    }
                    return this.inherited(arguments);
                    },           
                onFocus: function() {
                    if (!this.isValid()) {
                        this.displayMessage(this.getErrorMessage());
                    }
                },
               onBlur: function() {
                    this.validate(false);
                }
             }
        );

We have to add the dojo require for ValidationTextarea  -  dojo.provide("ValidationTextarea");

Using the ValidationTextarea in jsp page:

<textarea id="clntlocn" name="clntlocn" data-dojo-type="ValidationTextarea" required="true" missingMessage="Enter the Client Location Name" rows="2" cols="20"" maxLength="50" style="resize:none"></textarea>

Now we can include all the validations applicable for dijit.form.ValidationTextBox to
ValidationTextarea.

Validating the Email address in DOJO

Validating the Email address in DOJO


<input  data-dojo-type="dijit.form.ValidationTextBox"regExpGen="dojox.validate.regexp.emailAddress" required="true" name="email"  id="email" missingMessage="Enter the Email id"> </input>

We have to add  regExpGen="dojox.validate.regexp.emailAddress" in the
dijit.form.ValidationTextBox

Also, we have to add the following dojo require

dojo.require("dojox.validate.regexp");



Handling the select event of dojo tab container

Handling the select event of dojo tab container:

<div data-dojo-type="dijit/layout/TabContainer" style="height:  400px;" id="client">
   <div id="usersTab" data-dojo-type="dijit/layout/ContentPane" title="Users" >
  
</div>
  <div id="akrTdrTab" data-dojo-type="dijit/layout/ContentPane" title="AKR/TDR" >
   </div>
</div>

Add the below code in the JSP page to handle the selection event of the tab.

<script>
      dojo.addOnLoad(function() {
             tabContainer = dijit.byId('client');
             dojo.connect(tabContainer, "selectChild",handleSelectedTabs);
     });


    function handleSelectedTabs(selectedTab){
           switch(selectedTab.id){
                  case "usersTab":searchUsersData();
                  break;
                  case "akrTdrTab":searchAkrtdrData();
                  break;
       }
}
</script>

Wednesday, August 7, 2013

Configuring the subeclipse plugin in eclipse

Configuring the subeclipse plugin in eclipse:

Subversion is a version control system, similar to CVS. Subclipse is an Eclipse plug-in that provides the functionality to interact with a Subversion server, and to manipulate a project on a Subversion server in the Eclipse environment.

 Click on Help--> Eclipse Marketplace in eclipse editor.

Search for subeclipse in the window





Click on Install and Click Next


Accept license and click on Finish

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value - iBatis

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value - iBatis

Sometimes we will be receiving the following exception when executing the iBatis queries.

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.tr.spm.app.persistence.mybatis.clientmgmt.ClientManagmentMapper.getTntGrpid
        at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178)
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.tr.spm.app.persistence.mybatis.clientmgmt.ClientManagmentMapper.getTnt
        at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)

The issue is due to server could not able to locate the mapper xml file.

Approaches to fix the issue

This might be due to multiple reason, the following are the some of the ways the issue can be fixed.

1. Make sure the mapper xml file is in the same location as the mapper interface



2. Make sure the mapper interface java class name and the mapper xml file is same.

3. When u are using maven make sure the xml files are getting copied when packaging. Make sure we have added the below resource entry under resources section in pom.xml

         <resource>
                <directory>src/main/java</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.xml</include>
                </includes>
          </resource>