Thursday, 17 October 2013

Configure Log4j with JBOSS Application Server

Configure log4j in JBOSS Application Server

Steps to Configure log4j in JBOSS Application Server

Be default jboss provide an support for loggers. so if we want to to apply our own created loggers,then first you have to exclude default JBOSS loggers, then only it will take your own logger configurations.

Following are the steps to configure your own logger in JBOSS.........


Step1: Create jboss-deployment-structure.xml under main project ---> src >---->conf directory with following configurations.

<--jboss-deployment-structure> <--ear-subdeployments-isolated>false<--/ear-subdeployments-isolated> <--deployment> <--exclusions> <--module name="org.apache.log4j" /> // you can configure the things here that you want to exclude from JBOSS <--module name="org.slf4j" /> <--/exclusions> <--/deployment> <--sub-deployment name="YourApplicationName.war">// if you have sub modules <--exclusions> <--module name="org.apache.log4j" /> // you can configure the things here that you want to exclude from JBOSS <--module name="org.dom4j" /> <--/exclusions> <--/sub-deployment> <--sub-deployment name="YourApplicationName .jar"> <--exclusions> <--module name="org.apache.log4j"/> // you can configure the things here that you want to exclude from JBOSS <--module name="org.dom4j" /> <--/exclusions> <--/sub-deployment> <--/jboss-deployment-structure> <--/p>


remove comment '--' from jboss-deployment-structure before using


Note: There is no need of placing jboss-deployment-structure.xml any where else in your application, place it under conf directory only.

Here I had used Net Beans directory structure.

Directory Structure: -


Monday, 6 May 2013

Code for forgot password module using JSP and Servlet

code for forgot password

Following directory Structure you need to create for this(Tomcat directory i had used)

WEB.xml

JSP files

  • ResetPassword.jsp
  • SetNewPassword.jsp

CSS File

  • tableLayout.css

Servlet

  • AuthenticateRequest.java
  • ResetPassword.java
  • SendResetLink.java

Common Classes

  • AESEncryption.java
  • Base64Coder.java
  • Datedifference.java
  • DBconnection.java
  • SendMail.java

DAO

  • FPDao.java

Utility Class

  • Utility.java

Properties files

  • DB.properties
  • mail-config.properties
To get full code just click on the link
click to get
Please give your feedback by giving comments

Friday, 3 May 2013

code to create a Stylish Html Table with Rows having Alternate Colours

code to create table with rows having Alternate Colours
/* Author     : Gaurav Pathak 

 * JavaScript code 

 *
 */

function altRows(id){
    if(document.getElementsByTagName){ 
        var table = document.getElementById(id); 
        var rows = table.getElementsByTagName("tr");
        for(i = 1; i < rows.length; i++){         
            if(i % 2 == 0){
                rows[i].className = "evenrowcolor";
            }else{
                rows[i].className = "oddrowcolor";
            }     
        }
    }
}







Stylesheet to used....


/*
    Document   : alttabcolorsheet
  
 Created on : 26 Feb, 2013, 4:16:31 PM

   Author     : Gaurav Pathak 
 Description: Purpose of the stylesheet follows.

*/


table.altrowstable {
    font-family: verdana,arial,sans-serif;
    font-size:11px;
    color:#333333;
    border-width: 1px;
    border-color: #000000;
    border-collapse: collapse;
    width:900px;
}
table.altrowstable th {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color:#000000;
    background-color:#DBBF6B;
    color: #ffffff;
   
}
table.altrowstable td {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
/*    border-color: #a9c6c9;*/
}
.oddrowcolor{
    background-color:#ffffff;
}
.evenrowcolor{
    background-color:#BCB7B7;
}

 paste the below code on the page in which u want alternate colour

<script type="text/javascript">
 window.onload=function()
{
altRows('alternatecolor');// table id should be mention here
}
</script>



Note: The id your are mention in altRows() function must be similar to one used with Table.

for example:-
 <table class="altrowstable" id="alternatecolor" border="1">
</table>