Pages

Wednesday 26 February 2014

How to configure the JDK with JBoss Server?

Hi,

If you not configure the JDK with JBoss server then the exception like java.lang.IllegalArgumentException will get displayed. and the server will not start

To get the document of screen shorts about the JDK configuration please click on the Download button below.

Download

Thursday 13 February 2014

How to call the Swing applications from jsp at runtime.?


Hi,

This example will explains you how to call the swing applications from jsp at Runtime.


Source code:

<%
java.io.File path1=new java.io.File("D:/myapp");
Runtime.getRuntime().exec("cmd.exe /c start run.bat",null,path1);
%>

Explanations:

1) In the given code "myapp" is a folder which contains our swing applications and has been stored in the "D" drive.

2) "run.bat" is a batch file of the Swing applications in myapp folder.


When a user runs the applications(jsp file) then the batch file will be called  at runtime and displayed. Since the user could performs the functionality of the swing applications.



Wednesday 12 February 2014

Tuesday 11 February 2014

A Visual Program for Developing Grid Applications.

Hi,

This example explains you to create visual for an applications.

Source code:

<%@ page language="java" pageEncoding="ISO-8859-1"%>

<%@page import="java.util.*" %>
<% ArrayList alist=new ArrayList();
    //String color="";
       String temp[]=new String[5];
       String temp1[]=new String[5];
       String temp2[]=new String[5];
       String temp3[]=new String[5];
       String temp4[]=new String[5];
      
       temp[0]="1";
       temp[1]="aaa";
       temp[2]="a.@gamil.com";
       temp[3]="816 456 7890";
       temp[4]="Khammam";
       alist.add(temp);
      
       //second person
      
        temp1[0]="2";
       temp1[1]="bbb";
       temp1[2]="b.@gamil.com";
       temp1[3]="995 446 7886";
       temp1[4]="Hyderabad";
       alist.add(temp1);
       // Third person 
      
       temp2[0]="3";
       temp2[1]="ccc";
       temp2[2]="c.@gamil.com";
       temp2[3]="949 333 7892";
       temp2[4]="vizag";
       alist.add(temp2);
       //fourth person
        temp3[0]="4";
       temp3[1]="ddd";
       temp3[2]="d.@gamil.com";
       temp3[3]="970 100 2187";
       temp3[4]="Sathupally";
       alist.add(temp3);
         //fifth person 
        temp3[0]="5";
       temp3[1]="eee";
       temp3[2]="e.@gamil.com";
       temp3[3]="810 645 8675";
       temp3[4]="Khammam";
       alist.add(temp3);  
                 
   %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
 
    <html:base />
   
    <title>Addtext.jsp</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

 <script type="text/javascript">
        
         function changecolor(id){
         document.getElementById(id).style.backgroundColor="white";
         }
         function restorecolor(id){
         var number = id;
         if(number%2==0){
         document.getElementById(id).style.backgroundColor="#9EACBD";
         }
        else{
         document.getElementById(id).style.backgroundColor="#8FBDC5";
        }
      }  
    </script>
  </head>
 
  <body>
  <br/><br/><br/><br/><br/>
 <center> <h2> Table Grid</h2></center>
   <table align=center RULES=cols FRAME=BOX CELLSPACING="0"
        CELLPADDING="0" width="500" height="200" id="results">
        <tr bgcolor="90AAAA">
        <th>S.No</th>
         <th>Name</th>
        <th>Email Address</th>   
        <th>Phone no</th>
        <th> Address</th>   
           </tr>
      <%
        for (int j = 0; j < alist.size(); j++) {
        String color="";
        if(j%2==0){
         color="#9EACBD";}
        else{
         color="#8FBDC5";
         }
        %><tr bgcolor="<%=color %>" id="<%=j%>" onmouseover="changecolor(this.id)" onmouseout="restorecolor(this.id)">
        <%
        String[] row1 = (String[]) (alist.get(j));
        for (int k = 0; k < row1.length; k++) {
        %>
        <td align="center"><%=row1[k]%>
        </td><%
        }
        %></tr>   
       
        <%}
        %> </table>
  </body>
</html:html>


--------------------------------------------Thank you------------------------------------

How to get the jsp variables in Javascript


Hi,

This Example is used to read the jsp variables from javascript().

Save the file with any name.jsp

Source code:

<html>
<head>
<script type="text/javascript">
function test(){
<% int c=0,a=10,b=20;
    c=a+b;
 %>
var result="<%=c%>";
alert("total result is"+result);
}
</script>
</head>
<body>
<br/><br/><br/><center>
<table>

<tr> <td>UserName:</td>
<td><input type="text" name="uname" id="uname"/></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pwd" id="pwd"/></td>
</tr>
<tr> <td></td> <td><input type="submit" value="submit" onclick="return test()"/></td></tr>
</table>
</center>
</body>
</html>

Note: This Methodology works only ID's.


--------------------------------------  Thank you----------------------------------

Thursday 6 February 2014

HTML5 Form Validations Example for different fileds with Regular Expressions.

This summary is not available. Please click here to view the post.

Calling a JavaScript function on page load.

Hi,

This example explains you how to Focus cursor on Username text filed on page load.

When the page has loaded the function named Focus() will be called and cursor will focus on Username field.

Source Code for the example.

<html>
<head>
<script type="text/javascript">
function Focus(){
document.getElementById("name").focus();
return true;
}
</script>
</head>

<body onload="return Focus()";>
<table>
<tr>
<td>UserName:</td>
<td><input type="text" name="name" id="name"/></td>
</tr>
<tr> <td>Password:</td>
<td><input type="password" name="pwd" id="pwd" /></td>
</tr>
<tr><td></td>  <td> <input type="submit" value="Submit"/></td></tr>
</table>
</body>
</html>