22 June, 2012

JSTL a rich Web solution for JSP ! Kick your scriptlet over JSP.

By our traditional web development with J2EE is quite deprecated.Now-a-days there are ample of technology provided by different vendors like sun, oracle, micro soft , etc. Out of all JSTL(Java Standard Tag Library) a tech of sun has supreme power to optimize    and encapsulate the core functionality that common to many JSP applications. Instead of mixing tags from numerous vendors in your JSP applications, JSTL allows you to employ a single, standard set of tags.The sun has provides enormous benefits through JSTL.


  I am really disappointed; I am not using JSTL in my current project. Although I know it has many benefits over JSP scriptlet tags. I really want to kick out the scriptlet tags from my jsp. Scriptlets are difficult to maintain & execute by container also.It is a complete solution for web developers/front end developer , no need of prior knowledge of java/j2ee.It support full tag syntax, no need of jsp scriptlet tags.It has following major tag areas :-
      
         -- Core Tags
         -- Formatting Tags
         -- SQL Tags
         -- XML Tags
         -- Function Tags ( JSTL Functions)

There are many advantages of JSTL over JSP. 

         -- It is easy to use, ( avoid scriptlet tags)
         -- We can create our own custom tags
         -- These tags are standardize by sun.
         -- More functionality with easy iteration support tags
         -- XML supports
         -- It uses EL (Expression Language )  

You can get more about these from below given link from sun.

But, its quite simple to use JSTL with your jsp.I have posted here an easy example of JSTL below:-

Before go to the example, you need certain setups & resources like jstl.jar and  standard.jar.

1. You can Download the binary distribution from Apache Standard Taglib and unpack the compressed jar file.
2. Extract those files , and copy all extracted files ( .tld and other files) into WEB-INF\lib .

3. set some necessary tag-lib inside web.xml & enjoy the flavor of JSTL.

Simple Example-


web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <jsp-config>
      <taglib>
          <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
          <taglib-location>/WEB-INF/lib/c.tld</taglib-location>
      </taglib>
       </jsp-config>
</web-app>

jsp file


<%@ taglib uri="/WEB-INF/lib/c.tld"  prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <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">
  </head>
 
  <body>
  <table>
    <c:forEach var="i"  begin="1" end="10" step="1">
    <tr>
        <c:forEach var="k" begin="1" end="5" step="1">
            <td><c:out value="${k}"></c:out></td>
        </c:forEach>
    </tr>
    </c:forEach>
    </table>
          </body>
</html>

 
Now start the tomcat and run from browser. The out put of the program will be like below :-


I have only used core tag in this example. But there are so many tags including other tag sections discuss above. Also you can develop you own .tld file and own custom tags. 


Read all about JSTL from sun.

By Manoj.

20 June, 2012

Arbic Data/Text in mySql Database Table

Some time we need this type of requirement as per the client given. I have faced this one. But need not to worry there are lots of way by which we can insert data/text into mysql table. Create a table with following steps:-

1. Create a table with Collation - utf8- utf8-bin
2. Then , set all columns datatype should be varchar and  Collation - utf8- utf8-bin
3. And now Apply changes. Ok







This above image setting for table.





This image for setting column . (utf-8-to-column.jpg)



This image , finally data inside the table. (data-in-table.jpg)


Or by using  query

column_name varchar(50) character set utf8 collate utf8_bin ----set for individual column
CHARSET=utf8 ---------Set on  table


Below one dummy query for better understanding-

ALTER TABLE `admin_kairali`.`t_report_language` CHANGE COLUMN `vchBeing` `vchBeing` VARCHAR(200) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL  , CHANGE COLUMN `vchScrtry` `vchScrtry` VARCHAR(200) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL  , CHANGE COLUMN `vchAccount` `vchAccount` VARCHAR(200) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL  , CHANGE COLUMN `vchReceiversign` `vchReceiversign` VARCHAR(4000) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL  ;


Now enjoy this read.

By Manoj.( مانوج بواسطة

19 June, 2012

John Yeary: When Do I Use CSS?

John Yeary: When Do I Use CSS?: Image via Wikipedia I have been looking at a number of articles on web technologies, and HTML . One of the things I noticed on a lot of the ...

18 June, 2012

SDLC:- Waterfall Model ( A Leaner Apporach for Designing )

As per our prior knowledge , Software development Life Cycle (SDLC) is the backbone of software development.Its part of systems engineering, information systems and software engineering, is a process of creating or altering information systems, and the models and methodologies that people use to develop these systems , means the every process involves with software development must follow SDLC for every organization.


On the other hand PCL,for project management defined both with a project life cycle (PLC) and an SDLC. According to Taylor (2004) "the project life cycle encompasses all the activities of the project, while the systems development life cycle focuses on realizing the product requirements"

As per my view SDLC is the best fundamental for software development.
There may be so many methodologies are there, but out of all there are finger count methodologies like Prototype Approach, Waterfall Approach,etc. The waterfall apporach is a linear approach. This approach or model has many advantages & Disadvantages, but it is quite popular & acceptable.The initial startup name of this model was Process Model and it has been accepted by many software engineering firms & authors. It ensure the software development process with different phases :-

1. Conception
2. Initiation
3. Analysis
4. Design
5. Coding
6. Testing
7. Implementation and Maintenance.
These all stages/phases are the vital part of this model. And these stages are the key concept of the entire software development.
Conception:-
The word conception , is self meaning word. An idea for create a project/application.
Initiation:-
To implement your ideas or to initialize your Ideas/Conception for start up.
Analysis:-
To analysis the data/requirements for the project/application.
Design:-
To build the concrete of the above points to make an application/project.
Codeing:-
Applying your construction code/logic for physical structure.
Testing:-
Test the application/project for make it accurate or bug free.( ie. unit test,inte. test)
Maintenance:-
To implement  the final product and keep maintenance for that product.Its a long term process .


There are so many development process we are following now-a-days. Because, we need fast & quick delivery, so that we a accepting so many techniques like AGILE,xp,SCRUM etc. Many authors argue on this waterfall model due to lack of fastness or other few disadvantages.
But still its the parent of all design & development models are used now-a-days. For more about Agile  read other posts.


By Manoj