<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3616017652746096084</atom:id><lastBuildDate>Sat, 31 Aug 2024 10:59:30 +0000</lastBuildDate><category>HTML</category><category>JavaScript</category><category>Regex</category><title>passion4java Blogs : New Post</title><description></description><link>http://passion4java.blogspot.com/</link><managingEditor>noreply@blogger.com (Mohammed Yousuff)</managingEditor><generator>Blogger</generator><openSearch:totalResults>33</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-7593816913605449428</guid><pubDate>Fri, 24 Feb 2023 17:02:00 +0000</pubDate><atom:updated>2023-02-24T22:32:28.866+05:30</atom:updated><title>Google Firebase</title><description>Hello, in todays world Rapid Software Development is the way to build a quick software for Dynamic Business Needs. I hope the near future people with all the skills will have a coding as one of a primary skills that they should be used to build a business which will help in there sales.

I am in this blog will help uses to start coding with less code using Firebase and Android as a front end. We will learn all the components available in Firebase in coming days ..

as i am posting this after a long time, do comment on this post by saying Hi which will help to encorage . Thanks in advance</description><link>http://passion4java.blogspot.com/2023/02/google-firebase.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-4161234893345566664</guid><pubDate>Thu, 09 Sep 2010 15:06:00 +0000</pubDate><atom:updated>2010-09-09T20:36:43.959+05:30</atom:updated><title>Bored Of Logging : Here's An Easy Way</title><description>&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
Most of the developers ignore logging mainly because they
have to type the class name and method name whenever they log. This really
irritates the developer while they coding.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
For Example:&lt;/div&gt;
&lt;pre class="brush:java"&gt;Private String CLASS_NAME =”JunkClass”;
Private String METHOD_NAME=”junkMethod()”;
Logger.info(CLASS_NAME,METHOD_NAME,”Simple Logging”);
&lt;/pre&gt;
&lt;div class="MsoNormal"&gt;
Consider the above line, we have to type every time when we
do a logging, this may seem simple but while you most concentration goes
towards the core logic, this is a real overhead and makes developer to just
ignore the logs.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
When a thing goes wrongs in production, we may think that we
should have done more logging. This is a cycle process which always happen in
the developers world ;)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
I was trying to look some options in Eclipse, which may
eliminate this REAL overhead which we never may notice.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Using Eclipse Code Template, you can create a template as
below which automatically populates the Class Name &amp;amp; Method name for you.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Creating code Template:&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Windows &lt;span style="font-family: Wingdings;"&gt;à&lt;/span&gt;Preference
&lt;span style="font-family: Wingdings;"&gt;à&lt;/span&gt; Java &lt;span style="font-family: Wingdings;"&gt;à&lt;/span&gt;Editor &lt;span style="font-family: Wingdings;"&gt;à&lt;/span&gt;Template&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://dl.dropbox.com/u/2573367/passion4java/Blogs/Eclipse_Code_template.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="157" src="http://dl.dropbox.com/u/2573367/passion4java/Blogs/Eclipse_Code_template.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt; line-height: 115%;"&gt;Logger.info(${enclosing_type}.&lt;/span&gt;&lt;b&gt;&lt;span style="color: #7f0055; font-family: 'Courier New'; font-size: 10pt; line-height: 115%;"&gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt; line-height: 115%;"&gt;,
&lt;/span&gt;&lt;span style="color: #2a00ff; font-family: 'Courier New'; font-size: 10pt; line-height: 115%;"&gt;"${enclosing_method}"&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt; line-height: 115%;"&gt;, &lt;/span&gt;&lt;span style="color: #2a00ff; font-family: 'Courier New'; font-size: 10pt; line-height: 115%;"&gt;""&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt; line-height: 115%;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Name: _Logs_info : type this word in your eclipse and
eclipse will automatically populates the method and class name automatically. &lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;For Example&lt;/b&gt; if you
are inside class called ServeMe and inside method getServiceName().You template
will generate the code as below&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
&lt;pre class="brush:java"&gt;
Logger.info(ServeMe.class,”getServiceName()”,””);
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;
What you need to do is just type text which you need to log
, that’s it.&lt;br /&gt;
&lt;br /&gt;
If you thought this may help in your daily life, just leave your
comments.&lt;/div&gt;</description><link>http://passion4java.blogspot.com/2010/09/bored-of-logging-heres-easy-way.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-1125865987601119542</guid><pubDate>Wed, 01 Sep 2010 19:01:00 +0000</pubDate><atom:updated>2010-09-02T00:31:22.175+05:30</atom:updated><title>How to use JMS for Synchronous Communication</title><description>&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
Java Messaging Service are used mostly for the asynchronous
communication, however JMS can also used for synchronous communication. It
provides advantage of decoupling the client and service totally.&lt;br /&gt;
Below example explains how to send a request from client
(i.e J2SE App) to a MDB bean. Once the MDB receives the message it get processed and sends the response
back to the Client (J2SE) application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="text-indent: -0.25in;"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;Look up the connection factory object from the initial content.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&lt;/span&gt;From the connection factory, session object are created.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&lt;/span&gt;After creating the session, requestQueue name should be looked up from the initial context.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;From the session object, we can create a TextMessage .&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&lt;/span&gt;Before sending the message Object, to the Queue below are few properties which need to set to the message object.&lt;/div&gt;
&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in;"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;b&gt;setJMSReplyTo:&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This is one the property which tells the consumer (here is our MDB) to which queue the response message should be sent. It accepts queue object as an arguments&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt; line-height: 14px;"&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;b&gt;setJMSCorrelationID:&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; As the responses are sending to a queue, it can be consumed by any consumer. However the response message should only delivered to the client which initiated the request.&lt;/div&gt;
&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Messages are uniquely identified by Correlation ID, which are used by Message Selectors to consumer only the message which matches this ID.&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Client:&lt;/b&gt;&lt;/div&gt;
&lt;pre class="brush:java"&gt;package com.passion4java.requestreply;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;

public class Client {

 static int counter =0;
 public boolean responseReceived = false;
 public String response = "";

 public static void main(String[] args) throws Exception {
   new Client().send2Queue();
 }

 public void send2Queue() throws Exception{

  //Setting JNDI values, here JBOSS JNDI values
  System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  System.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
  System.setProperty("java.naming.provider.url", "jnp://localhost:1099");
        InitialContext ctx = new InitialContext();

        String requestQueueName ="jms/requestQueue";
  String replyQueueName ="jms/replyQueue";
  String connectionFactoryName = "jms/requestReplyQCF";

  //Sending Message MDB
  Connection connection = null;
  Session session = null;
  Destination destination = null;
  MessageProducer messageProducer = null;

  ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup(connectionFactoryName);
  connection = connectionFactory.createConnection();
  session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
  destination =(Destination) ctx.lookup(requestQueueName);
  messageProducer = session.createProducer(destination);
  connection.start();
  this.sendMessage(session, ctx, messageProducer, replyQueueName, " FIRST MDB");

  messageProducer.close();
  session.close();
  connection.close();
 }


 public void sendMessage(Session session,InitialContext ctx,MessageProducer messageProducer,String replyQueueName,
   String requestText) throws RuntimeException {
  try {
   //Creating Unique CorrelationID
   UUIDGenerator uuid = UUIDGenerator.getInstance();
   UUID u = uuid.generateRandomBasedUUID();

   TextMessage message = session.createTextMessage(requestText);
   String correlationId = u.toString();
   //Create Reply To Queue

   Destination replyQueue = (Destination) ctx.lookup(replyQueueName);
   message.setJMSReplyTo(replyQueue);
   message.setJMSCorrelationID(correlationId);
   String messgeSelector = "JMSCorrelationID = '" + correlationId + "'";

   MessageConsumer replyConsumer = session.createConsumer(replyQueue,messgeSelector);

   messageProducer.send(message, javax.jms.DeliveryMode.PERSISTENT,   javax.jms.Message.DEFAULT_PRIORITY, 1800000);
   System.out.println("++++++++++++++++++++++++++++++++++++++++++");
   System.out.println("Message sent to Bean"+ requestText);
   System.out.println("messgeSelector name is : "+messgeSelector.toString());
   System.out.println("++++++++++++++++++++++++++++++++++++++++++");

   Message replayMessage = replyConsumer.receive();

   TextMessage textMessage = (TextMessage) replayMessage;
   String replayText = textMessage.getText();

   System.out.println("Request Messge --&amp;gt;"+ requestText);
   System.out.println("Response Message --&amp;gt;"+ replayText);
  } catch (JMSException je) {
   throw new RuntimeException(je);
  } catch (NamingException ne) {
   throw new RuntimeException(ne);
  }
 }
}


&lt;/pre&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo1; text-indent: -.25in;"&gt;
1&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Server:&lt;/b&gt;&lt;/div&gt;
&lt;pre class="brush:java"&gt;package com.passion4java.requestreply;
import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class ServerMDB implements MessageListener, MessageDrivenBean {
  private Session session;
  Context ctx;

  public ServerMDB() {
       try {
    ctx = new InitialContext();
   } catch (NamingException e) {
    throw new RuntimeException(e);
   }
  }

  public void onMessage(Message message) {
   String text = null;
   Connection connection = null;
   try {
    if (message instanceof TextMessage) {
     TextMessage textMessage = (TextMessage) message;
     text = textMessage.getText();
     System.out.println("****************************************************");
     System.out.println("Received Message --&amp;gt;"+text);
     System.out.println("****************************************************");
     //Send the reply
     Destination replyDestination = message.getJMSReplyTo();
     String correlationID = message.getJMSCorrelationID();
     //ID which got from the client Message
     System.out.println("input correlationID"+ correlationID);

     ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("jms/requestReplyQCF");
     connection = connectionFactory.createConnection();
     session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
     MessageProducer replyProducer = session.createProducer(replyDestination);
     TextMessage replyMessage = session.createTextMessage();

     replyMessage.setText("Hi i am a Server MDB. Thanks for using request/reply");
     replyMessage.setJMSCorrelationID(correlationID);
     replyProducer.send(replyMessage);

     System.out.println("****************************************************");
     System.out.println("Sent reply");
     System.out.println("\tTime:       " + System.currentTimeMillis() + " ms");
     System.out.println("\tMessage ID: " + replyMessage.getJMSMessageID());
     System.out.println("\tCorrel. ID: " + replyMessage.getJMSCorrelationID());
     System.out.println("\tReply to:   " + replyMessage.getJMSReplyTo());
     System.out.println("\tContents:   " + replyMessage.getText());
     System.out.println("****************************************************");

    } else {
           System.err.println("Expected a Text Message");
          }
          connection.close();
          } catch (Throwable t) {
               t.printStackTrace();
          }finally{

          }
  }

  public void ejbRemove() throws EJBException {
   // TODO Auto-generated method stub

  }

  public void setMessageDrivenContext(MessageDrivenContext arg0)
    throws EJBException {
   // TODO Auto-generated method stub

  }

     public void ejbCreate()
     {
     }
 }&lt;/pre&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo2; text-indent: -.25in;"&gt;
1.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Once the messages are sent, it should be
received by the consumer.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&lt;/span&gt;Once the consumer receives the message, it do
the necessary processing.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;In our example, we are just appending text to
the input message.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;Once the server done with the processing, it
times to send the request back to the same client.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;The server will get the response quest object
from the input messages itself by calling the getJMSReplyTo().&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;Once it gets the response queue, it creates a
messege.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;"&gt;
7.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;After creating the message, the server should
set the correlation ID to the response message. It should be same as request message
correlation ID.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;"&gt;
8.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;This is because, client uses Message Selector
based on the &amp;nbsp;message correlation ID and
it listens to the queue (where the server should&amp;nbsp; send the response).&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle"&gt;
&lt;b&gt;Back to the Client:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.25in;"&gt;
1.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Once the Message are sent from server to the
reply queue&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.25in;"&gt;
2.&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Client will listen to that queue with the unique
Message Selector ID, as the client and server Message Selector are same the
message which sent by the sever should be received by the same client.&lt;/div&gt;</description><link>http://passion4java.blogspot.com/2010/09/how-to-use-jms-for-synchronous.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-4600565327703714216</guid><pubDate>Thu, 24 Jun 2010 09:28:00 +0000</pubDate><atom:updated>2010-06-24T15:47:22.095+05:30</atom:updated><title>Google AppEngine – Hello World Example</title><description>&lt;span xmlns=""&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;The best thing about Google AppEngine is you can run your java web-application in Google infrastructure for FREE of cost (up to certain user hits).I was really excited to know this, because it's really a great opportunity to deliver lots of small web utility at free of cost.&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span xmlns=""&gt;Let's get started:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span xmlns=""&gt;Installing Eclipse AppEngine plugin:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Google provided Eclipse plugin for developing &amp;amp; deploying AppEngine application easily. Based on the Eclipse version we need to select different update site URL, in our example I am using Eclipse 3.5 (Galileo) so i am using update site URL&amp;nbsp; as &lt;a href="http://dl.google.com/eclipse/plugin/3.5"&gt;http://dl.google.com/eclipse/plugin/3.5&lt;/a&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;b&gt;Steps 01:&lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;In Eclipse, select Help menu and click "Install new Software" option as below.&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwrpGxcQMENTjjMGkfTwj11TXaX_VsCPbKUS-kSTD7sPw3nkohnDBQYsbpRw9nSCBYCIKk-to36skBPeWCwUSyHvwmTZclVs2OR0ORBfg5_FkKTNhRTpMypJoE4v1pdAP_GMDDQKsR7got/s1600/GoogleAppEngine-1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwrpGxcQMENTjjMGkfTwj11TXaX_VsCPbKUS-kSTD7sPw3nkohnDBQYsbpRw9nSCBYCIKk-to36skBPeWCwUSyHvwmTZclVs2OR0ORBfg5_FkKTNhRTpMypJoE4v1pdAP_GMDDQKsR7got/s320/GoogleAppEngine-1.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span xmlns=""&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;b&gt;Step 02:&lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Once the Wizard opens, click Add button. Below pop-up box should be displayed where you have to enter the update URL (based on the Eclipse version) and a unique name. Then click ok.&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimrPjh4ArRgzjzwZJl0oA62kAMSGE_9eIAT-T2GgtjiV794m7yPhhTsyPAgCoHzs0dbuQNCuh16XFH71raT8mnsWKTOBCPY8S1NQduDFWhlUzZ9N8W31XECsMoeip5uKXz0_4c43Y2qvSe/s1600/GoogleAppEngine-2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimrPjh4ArRgzjzwZJl0oA62kAMSGE_9eIAT-T2GgtjiV794m7yPhhTsyPAgCoHzs0dbuQNCuh16XFH71raT8mnsWKTOBCPY8S1NQduDFWhlUzZ9N8W31XECsMoeip5uKXz0_4c43Y2qvSe/s320/GoogleAppEngine-2.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span xmlns=""&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;b&gt;Step 03:&lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;span xmlns=""&gt;Below windows screen should be displayed, where SDK and plugin files are displayed. Check both check boxs and click Next.&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOm6WKhsOBBgsiePmQxBKgxJNge_EHJW2LH7P3sCOj4E_qOckh_9JS0f76FvOxxe1aeKdwoPqsjgBbVou9WKuqkpuAl_fS7Xke7EgFc-uzfrE2DBqsoSrkzmTHH1haZoQrlAJmB-s7PHlv/s1600/GoogleAppEngine-3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOm6WKhsOBBgsiePmQxBKgxJNge_EHJW2LH7P3sCOj4E_qOckh_9JS0f76FvOxxe1aeKdwoPqsjgBbVou9WKuqkpuAl_fS7Xke7EgFc-uzfrE2DBqsoSrkzmTHH1haZoQrlAJmB-s7PHlv/s320/GoogleAppEngine-3.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span xmlns=""&gt;Now Eclipse connect to the server and downloads the files, once the files are downloaded it displays license agreement page, once you have agreed to that, it starts installing the files and request you to &lt;/span&gt;&lt;span xmlns=""&gt;restart the &lt;/span&gt;&lt;span xmlns=""&gt;eclipse .After restarting&amp;nbsp; the eclipse, you should see below new icons in your eclipse top left corner.&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiegNhQTxsUhVOHw17agWIudakfml6G_q6emp4bv3b6fx6yE0XbYRqSulYj7Rh9fGZcffJi8KgCPsgJs3Cn2EEL7eKZMKH3Fg-NfVERIBQFuVkK5nSJNxefJMsCCnfYU0g6hmhKsCPJ76hw/s1600/GoogleAppEngine-4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="63" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiegNhQTxsUhVOHw17agWIudakfml6G_q6emp4bv3b6fx6yE0XbYRqSulYj7Rh9fGZcffJi8KgCPsgJs3Cn2EEL7eKZMKH3Fg-NfVERIBQFuVkK5nSJNxefJMsCCnfYU0g6hmhKsCPJ76hw/s200/GoogleAppEngine-4.JPG" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;span xmlns=""&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/div&gt;
&lt;span xmlns=""&gt;&lt;b&gt;Creating Application:&lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Click on google icon, which will open below application creation wizard.&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkJSwyiby9X5gqcWXOdk4LzjRX1ZNmB4P-O-Yet4HBR5TiQ2HBzvpQclevT68tvi6MVATc3SCpgskTyddSbJFvJCasi8gjgBPlEr1Kow4huMS50AmDZ36-eW6FltETQV0RHBytaJo5ahdN/s1600/GoogleAppEngine-5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkJSwyiby9X5gqcWXOdk4LzjRX1ZNmB4P-O-Yet4HBR5TiQ2HBzvpQclevT68tvi6MVATc3SCpgskTyddSbJFvJCasi8gjgBPlEr1Kow4huMS50AmDZ36-eW6FltETQV0RHBytaJo5ahdN/s320/GoogleAppEngine-5.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span xmlns=""&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;span style="text-decoration: underline;"&gt;Project Name:&lt;/span&gt;&amp;nbsp; &lt;span style="font-family: Times New Roman;"&gt;N&lt;/span&gt;ame of the project.&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;span style="text-decoration: underline;"&gt;Package Name:&lt;/span&gt; you have to specify the default package name, based on this your files are created under the given packages.&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Apart from that, it also supports GWT supports, currently we can ignore the GWT support option &lt;span style="font-family: Times New Roman;"&gt;and we&lt;/span&gt; should select only AppEngine Support.Click Finish.&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;b&gt;Default Project:&lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Once you click finish, plugin will create a default project skeleton, where you will have directory structure which is required by google &lt;span style="font-family: Times New Roman;"&gt;appengine&lt;/span&gt;."war" is the deployment folder, where all your dynamic files and static files should be placed. &lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJpopWXax6pQu9GGEVNT5KsYmMLa9YCfV5sFt6up_qDTvV3IhfTFjpA0nsRJFaoA3EIpzpIYyrOFSGAu30OL80mEzFRLAEV8hIQ2kUn9pujaMc9m2jsS3RvGC-JbfePo1GtK4tNCDlUzJh/s1600/GoogleAppEngine-6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJpopWXax6pQu9GGEVNT5KsYmMLa9YCfV5sFt6up_qDTvV3IhfTFjpA0nsRJFaoA3EIpzpIYyrOFSGAu30OL80mEzFRLAEV8hIQ2kUn9pujaMc9m2jsS3RvGC-JbfePo1GtK4tNCDlUzJh/s320/GoogleAppEngine-6.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span xmlns=""&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;b&gt;Debugging the Application:&lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Right&lt;span style="font-family: Times New Roman;"&gt; click &lt;/span&gt;the project, select "dubug as" and select Web Application &lt;span style="font-family: Times New Roman;"&gt;option&lt;/span&gt;.Now the code should compiles and then eclipse starts the server. You can view the application using URL &lt;span style="color: red; font-family: Courier New; font-size: 10pt;"&gt;http://localhost:8888/&amp;lt;application-name&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF5z1eWKivfyVxsgUlWBM4n67zr62D0hwXhnumuiZcl5jQ-wS_Fc2Is-iTTSIxMRf84ERNIwKEPfg3SYd41wfglLa_10vz9X5QZhS42btunYDNUt4ZYG_XtQKIUqgTsmC2c0qPhHcBLe4_/s1600/GoogleAppEngine-7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF5z1eWKivfyVxsgUlWBM4n67zr62D0hwXhnumuiZcl5jQ-wS_Fc2Is-iTTSIxMRf84ERNIwKEPfg3SYd41wfglLa_10vz9X5QZhS42btunYDNUt4ZYG_XtQKIUqgTsmC2c0qPhHcBLe4_/s320/GoogleAppEngine-7.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span xmlns=""&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;b&gt;Deploy Application:&lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Once you done with the debugging, it's time to deploy the application. Select icon and eclipse pops-up below dialog box.&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZXwUWIXBKL3yi4e-hJZ_0DSfDEEByh29tAyfhQRfKbZGiVcN2eEqkdSWTkdDzYGh9S2bGweeKoNB-X6zHdc-NspnDBAGpt7jg59UOtb7VdJx5XMeP4du6pj1vkj-RHqjGBATKkdh-sDWQ/s1600/GoogleAppEngine-8.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZXwUWIXBKL3yi4e-hJZ_0DSfDEEByh29tAyfhQRfKbZGiVcN2eEqkdSWTkdDzYGh9S2bGweeKoNB-X6zHdc-NspnDBAGpt7jg59UOtb7VdJx5XMeP4du6pj1vkj-RHqjGBATKkdh-sDWQ/s320/GoogleAppEngine-8.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span xmlns=""&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Click "App Engine project Settings" option, which open the windows where the application ID should be entered.    If you are creating first time then click "My application" option which pop-up the browser and lands in creation of application Id.&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVRbydsI4BWEc5gxgu7FeC-d9Q1sXuaiiicr-fHZ05QEpGPZ6aXkApa_IPTn4YNW1cm8clLXs5IgqjX-1QVuF0KOGO9ZybjxqpTtJE8-UYncZO3sCU9wnqWMwJcn6rVBDL9VKpNElxe5qS/s1600/GoogleAppEngine-9.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVRbydsI4BWEc5gxgu7FeC-d9Q1sXuaiiicr-fHZ05QEpGPZ6aXkApa_IPTn4YNW1cm8clLXs5IgqjX-1QVuF0KOGO9ZybjxqpTtJE8-UYncZO3sCU9wnqWMwJcn6rVBDL9VKpNElxe5qS/s320/GoogleAppEngine-9.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Click "OK", now you will be back to the previous screen, now enter your password. Once you enter the password the Google AppEngine will connect to the server and the files are deployed. &lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Once the Eclipse finishes the deployment, now you can access the Hello world example in the below URL &amp;lt;Application_ID&amp;gt;.appspot.com/&amp;lt;project_name&amp;gt; example: &lt;span style="font-family: Times New Roman;"&gt;http://its-passion4java.appspot.com/passion4java&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;span style="font-family: Times New Roman;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;b&gt;That's it, now the hello world application is live in Google infrastructure.Please post your comments, if you think some thing can be added ;)... &lt;/b&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;/span&gt;</description><link>http://passion4java.blogspot.com/2010/06/google-appengine-hello-world-example.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwrpGxcQMENTjjMGkfTwj11TXaX_VsCPbKUS-kSTD7sPw3nkohnDBQYsbpRw9nSCBYCIKk-to36skBPeWCwUSyHvwmTZclVs2OR0ORBfg5_FkKTNhRTpMypJoE4v1pdAP_GMDDQKsR7got/s72-c/GoogleAppEngine-1.JPG" width="72"/><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-7685595466193468393</guid><pubDate>Sat, 19 Dec 2009 11:04:00 +0000</pubDate><atom:updated>2009-12-19T16:55:55.384+05:30</atom:updated><title>Things to be remembered before including a file in your JSP page.</title><description>&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Their are 3 ways in J2ee [as for as i know ;)] from which you can include
a file inisde your JSP. Let see what is the pros cons of each one.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-text-decorations-in-effect: underline; border-collapse: collapse; font-family: Verdana, sans-serif; font-size: small; white-space: pre;"&gt;&lt;b&gt;&amp;lt;@inlcude file="someJunkIncludeFile.jsp"&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;As include is a page directive, you &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;CANNOT &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;pass
 dynamic values (by using scriplets or EL expressions)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;It copies all the text which are in the included file (say
 someJunkIncludeFile.jsp) to the parent page.This happens every time
 when your parent page is getting recompiled, so make sure that if you
 have more include in a parent page, and the parent page will be
 recompiled often, then this may lead you a &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;performance
 overhead&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt; :(&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;In advance containers like Tomcat 6, the container will
 automatically recompile your parent jsp, if any of your child pages or
 included pages are updated &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
 &lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;
  In XML-based Jsp tags, you can specify the &amp;lt;@include/&amp;gt; as &lt;jsp:directive.include file="someJunkIncludeFile.jsp"&gt;&lt;/jsp:directive.include&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-family: Verdana, sans-serif; font-size: small;"&gt;&lt;b&gt;&amp;lt;&lt;/b&gt;&lt;span style="border-collapse: collapse; white-space: pre;"&gt;&lt;b&gt;jsp:include page="someJunkIncludeFile.jsp"/&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;JSP Action include can allow the dynamic values (by using
 scriplets or EL expressions) as a argument.(Thats why they call it as
 jsp Action include)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;You can pass dynamic argument values to the include JSP page
 using param attribute.Below is the example which will pass values to
 the child page.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&lt;jsp:include page="someJunkinculdeFile.jsp"&gt;
    &lt;jsp:param name="test" value="i am here"&gt;
&lt;/jsp:param&gt;&lt;/jsp:include&gt;
&lt;/pre&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;In your child page you can use the value test in the request
 scope by accessing.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;pre class="brush:java"&gt;&amp;lt; % =request.getParameter("test") % &amp;gt;&lt;/pre&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;You can't pass any input arguments in query string to the
 child page, when you are including from the parent page&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&lt;jsp:include page="someJunkinculdeFile.jsp?test=iamhere&amp;amp;isgood=true"&gt;&lt;/jsp:include&gt;
&lt;/pre&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;In above code test parameter can't be accessed from the child
 page, as they passed as a input query.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="border-collapse: collapse; font-family: Verdana, sans-serif; font-size: small; font-weight: bold; white-space: pre;"&gt;JSTL &amp;lt; c:import url="someJunkIncludeFile.jsp"/ &amp;gt;&lt;/span&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: small;"&gt;c:import is 99.99% similar to jsp:include, the only difference i can feel is it can access the resources which are outside your application&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: small;"&gt;in the url attribute (name sugest) we need to specify the entire URL of the resource. as below&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class="brush:xml"&gt;&lt;c:import url="www.passion4java.com/getMe.html"&gt;&lt;/c:import&gt;&lt;/pre&gt;</description><link>http://passion4java.blogspot.com/2009/12/things-to-remember-before-including.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-4037936447015842492</guid><pubDate>Wed, 16 Dec 2009 10:47:00 +0000</pubDate><atom:updated>2009-12-16T16:18:54.672+05:30</atom:updated><title>Why Tomcat Container should do this.</title><description>I was trying an example with @include and &lt;jsp:include&gt;, in Tomcat 6. As we know if you use @include all the content in the child page (my_include.jsp), will be copied to your parent page during translation time, and any changes happens to the child will be reflected only when the parent page get recompiled (due to any changes happens in parent page).

I was expecting the same and trying a simple example as below.&amp;nbsp;&lt;/jsp:include&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background-color: #cccccc;"&gt;
&lt;b&gt;&lt;jsp:include&gt;File: parent.jsp
&lt;/jsp:include&gt;&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;pre class="brush:java"&gt; &amp;lt; html &amp;gt;
 &amp;lt; body&amp;gt;
  I am in parent&amp;lt; %@include file="child.jsp" %&amp;gt;&amp;lt; /br&amp;gt;
   &amp;lt; /body&amp;gt;
 &amp;lt; /html &amp;gt;
&lt;/pre&gt;
&lt;div style="background-color: #cccccc;"&gt;
&lt;b&gt;File: child.jsp
&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;pre class="brush:java"&gt; I am in Included page...
&lt;/pre&gt;
&lt;br /&gt;
So when we hit parent.jsp, all the content which is in child.jsp should be copied to page.jsp and it will be compiled. After compiling parent.jsp, if any changes happen in child.jsp will not be displayed until when the parent.jsp is getting recompiled.&lt;br /&gt;
&lt;br /&gt;
When I tried the same, but I was getting a different output, after compiling my parent.jsp and if I make any changes to my child.jsp Tomcat 6 recompiles my parent.jsp again and I was getting the updated changes in child.jsp in the output.&lt;br /&gt;
&lt;br /&gt;
I was searching this topic and found that some of the advance container is friendly and they check if any @included pages are getting updated when a request comes to main (parent.jsp) file. If that so then they recompiling the parent page again. Finally it really important that this scenario was NOT
GUARANTEED BY THE SPEC!&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background-color: #cccccc;"&gt;
&lt;b&gt;Why they do?&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
* If they containers are doing this (container may thing they are friendly with us), then what’s the difference between @include and &lt;jsp:include&gt; in terms of getting the updated content from the child.&amp;nbsp;&lt;/jsp:include&gt;&lt;br /&gt;
&lt;jsp:include&gt;* Doing this may not bring down the performance of the parent page, if the parent page has lots of included file. So any changes in any of the included file, the parent jsp should compile again by coping all the content from all the included jsp files.&lt;/jsp:include&gt;&lt;br /&gt;
&lt;jsp:include&gt;
* And finally this function is not portable, because this was &lt;span style="font-size: small;"&gt;&lt;b&gt;NOT GUARANTEED BY THE SPEC!&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/jsp:include&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;jsp:include&gt;Any thoughts? Thank You

&lt;/jsp:include&gt;&lt;br /&gt;</description><link>http://passion4java.blogspot.com/2009/12/why-tomcat-container-should-do-this.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-7386290636829504133</guid><pubDate>Wed, 16 Dec 2009 08:03:00 +0000</pubDate><atom:updated>2009-12-16T13:34:02.336+05:30</atom:updated><title>Thing you should know about jsp:useBean Tag</title><description>* When you are using a class in the use bean tag and the
   class was not found in the given scope say "request", then
   use:bean tag will NOT throw any exceptions. Insted it will create the
   class and access the value in it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: xml"&gt;    &lt;jsp:usebean class="passion.men" id="person" scope="request"&gt;
   &lt;/jsp:usebean&gt;&lt;/pre&gt;
* When you want to set a property to a bean, only if the bean is empty. Then your set:property tag shoud be inside the use:bean body tag as below.

   &lt;br /&gt;
&lt;pre class="brush: xml"&gt;    &lt;jsp:usebean class="passion.men" id="person" scope="page"&gt;
    &lt;jsp:setproperty name="person" property="name" value="yousuff"&gt;
    &lt;/jsp:setproperty&gt;&lt;/jsp:usebean&gt;
   &lt;/pre&gt;
So name property will be set only if the men object was not
   found the page scope, else the setProperty will not be executed.&lt;br /&gt;
&lt;br /&gt;
* You cannot use any abstact Class as your class attribute in
   your use:bean tag.And the class should follow the Bean Law ;)&lt;br /&gt;
&lt;br /&gt;
* When you want use Reference type to a object in a use:bean Tag, type attribute saves you.below is the example.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: xml"&gt;   &lt;jsp:usebean class="passion.Employee" id="person" scope="page" type="passion.Person"&gt;
   &lt;/jsp:usebean&gt;&lt;/pre&gt;
Person class which we declared in type attribute can be abstact and should follow the inhertance relasionship with the class attribute. Else thing will blow up ;)
   &lt;br /&gt;
* You can use only type attribute in use:bean without your class attribute ,ONLY IF a object is already avaiable in the scope with the given use:bean id.
   &lt;br /&gt;
&lt;pre class="brush: xml"&gt;   &lt;jsp:usebean id="testvariable" scope="page" type="passion.absReference"&gt;
   &lt;/jsp:usebean&gt;&lt;/pre&gt;
if their no attributes aviable in the page scope with the vaue "testvariable", then thing will blow up ;)
   
   &lt;br /&gt;
&lt;br /&gt;
* You can easy map the HTML form elements value, to the jsp:setProperty tag by specifying the param attribute.
   And you can start forgetting request.getParamenter() here after.
   
   &lt;br /&gt;
&lt;pre class="brush: xml"&gt;     
    name: &lt;input name="firstName" type="text" /&gt;
     
    &lt;jsp:usebean class="passion.Employee" id="person" type="passion.Person"&gt;
    &lt;jsp:setproperty name="person" param="firstName" property="name"&gt;
    &lt;/jsp:setproperty&gt;&lt;/jsp:usebean&gt;   
   &lt;/pre&gt;
* You can easy set all the form HTML tag values to your bean class easly by setting param="*", it will set all the form HTML elemnts values to your bean property.
   &lt;br /&gt;
&lt;pre class="brush: xml"&gt;    &lt;jsp:usebean class="passion.Employee" id="person" type="passion.Person"&gt;
    &lt;jsp:setproperty name="person" param="*"&gt;
    &lt;/jsp:setproperty&gt;&lt;/jsp:usebean&gt;   
   &lt;/pre&gt;
But with one CONDITION, your name in the HTML form element and the property name in the bean should match.&lt;br /&gt;
&amp;nbsp;* useBean tag, is used mostly to print a string value or to print the primitive types. When you want to access (or play) with a Object inside the bean. 
   Then you need help from EL expression guy.&lt;br /&gt;
&lt;br /&gt;
* We will discuss more about EL Tags in upcoming post ;). Thats it for now ... &lt;br /&gt;</description><link>http://passion4java.blogspot.com/2009/12/thing-you-should-know-about-tag.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-7849201932399716725</guid><pubDate>Tue, 15 Dec 2009 19:24:00 +0000</pubDate><atom:updated>2009-12-16T00:57:20.567+05:30</atom:updated><title>Say Hello to EL Functions</title><description>EL functions allows you to call a java function from your JSP pages
with out using any scripltes(in your JSP).It really important to have
a scriplets free JSP pages, which make developer and designer life
easy.Below is a simple example of using EL function.
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Simple Java Class with Static Method:&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;
* Before calling a method from your JSP page, the method should be
&lt;strong&gt;public &lt;/strong&gt;and
&lt;strong&gt;static.&lt;br&gt;* &lt;/strong&gt;Below is the code where we defined
a class called
&lt;strong&gt; SimpleELFunctions &lt;/strong&gt;and static method called
&lt;strong&gt; sayHello&lt;br&gt;

&lt;pre class="brush: java"&gt;
package com.passion4java.el.functions;
public class SimpleELFunctions {

 public static String sayHello(String test){
  return "Say HELLO Hello EL Function";
 }
}
&lt;/pre&gt;

&lt;br&gt;TLD files with function tags&lt;br&gt;
 &lt;br&gt;*&lt;/strong&gt; below is a simple tld where we have to defined the Class
name in
&lt;strong&gt;function-class&lt;/strong&gt; tag and&amp;nbsp; the method signature in
&lt;strong&gt;function-signature&lt;/strong&gt; tag.
&lt;br&gt;
&lt;pre class="brush: xml"&gt;
&lt;taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"&gt;
 &lt;tlib-version&gt;1.0&lt;/tlib-version&gt;
 &lt;uri&gt;elfunctions&lt;/uri&gt;
 &lt;function&gt;
  &lt;name&gt;sayHello&lt;/name&gt;
  &lt;function-class&gt;com.passion4java.el.functions.SimpleELFunctions&lt;/function-class&gt;
  &lt;function-signature&gt;java.lang.String sayHello(java.lang.String)&lt;/function-signature&gt;
 &lt;/function&gt;
&lt;/taglib&gt;
&lt;/pre&gt;
&lt;br&gt;
&lt;strong&gt;JSP Page&lt;br&gt;
 &lt;br&gt;* &lt;/strong&gt;add your tld file uri to
&lt;strong&gt;@taglib&lt;/strong&gt; directive and give the prefix name to it. in
our example its
&lt;strong&gt;p4j&lt;br&gt;* &lt;/strong&gt;When you are calling EL function&amp;nbsp;
first&amp;nbsp; we have give the prefix name p4j and a :(colon)
&lt;br&gt;
* then call the name which&amp;nbsp; is defined in the tld file
under&amp;nbsp; name tag ending with a () (open and close bracket)
&lt;br&gt;

&lt;pre class="brush: xml"&gt;
&lt;%@ taglib prefix="p4j" uri="elfunctions" %&gt;
&lt; html &gt;
  &lt; head &gt;
    
    &lt; title &gt;Say Hello&lt; /title &gt;
  &lt; /head &gt;
  &lt; body &gt;
    ${p4j:sayHello("test")}
  &lt; /body &gt;
&lt; /html &gt;
&lt;/pre&gt;

&lt;br&gt;
&lt;br&gt;
Thats it.. ;)</description><link>http://passion4java.blogspot.com/2009/12/say-hello-to-el-functions.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-5335966464481538267</guid><pubDate>Fri, 11 Dec 2009 07:48:00 +0000</pubDate><atom:updated>2009-12-11T13:32:41.416+05:30</atom:updated><title>Securing Your Application Using WEB.XML</title><description>&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;When it comes to security we always thing about EJB and other Java security related APIs. But web.xml itself provides you BASIC security control over you web application. If your application is not using any EJB and you need a security control, then web.xml is there to help you ;).&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;b&gt;Below is the sample web.xml which does the following things.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;pre class="brush: java" style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;web-app version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee 
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
  &lt;servlet&gt;
    &lt;description&gt;This is the description of my J2EE component&lt;/description&gt;
    &lt;display-name&gt;This is the display name of my J2EE component&lt;/display-name&gt;
    &lt;servlet-name&gt;SimpleServlet&lt;/servlet-name&gt;
    &lt;servlet-class&gt;SimpleServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;

  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;SimpleServlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/servlet/SimpleServlet&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;welcome-file-list&gt;
    &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  
  &lt;security-constraint&gt;
    &lt;web-resource-collection&gt;
      &lt;web-resource-name&gt;My First Auth&lt;/web-resource-name&gt;
      &lt;url-pattern&gt;/servlet/SimpleServlet&lt;/url-pattern&gt;
      &lt;http-method&gt;GET&lt;/http-method&gt;
    &lt;/web-resource-collection&gt;
  
  &lt;auth-constraint&gt;
   &lt;role-name&gt;Guest&lt;/role-name&gt;
  &lt;/auth-constraint&gt;    
  
    &lt;user-data-constraint&gt;
     &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
    &lt;/user-data-constraint&gt;
  &lt;/security-constraint&gt;
&lt;/web-app&gt;&lt;/span&gt;
&lt;/pre&gt;




&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;* We defined a Servlet called SimpleServlet&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;* As the SimpleServlet want to be protected i have to defined a security-constraint for that.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;* In security-constraint we have first defined web-resource-collection, where you have to defined name (which is MANDATORY, even thought you don't use it any where ;))&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;* web-resource-name can be any valid name.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;* In url-pattern tag you have defined which are the url-pattern should be protected, you can given n number of url-pattern.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;* Once you are done with that, then comes is in what all the request type you have to protect, say I want to protect the data only if the request is GET (that what i defined), you can protect for all the 5 request type.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
* Then comes auth-constraint, where you have defined all the roles which have this permissions. You can define roles in tomcat, by changing the &lt;tomcat_home&gt;/conf/tomcat-users.xml.&lt;br /&gt;
* Here is the sample code in &lt;tomcat_home&gt;/conf/tomcat-users.xml
&lt;br/&gt;

&lt;pre class="brush: xml"&gt;
&lt;tomcat-users&gt;
&lt;user name="tomcat" password="tomcat" roles="tomcat" /&gt;
&lt;user name="role1" password="tomcat" roles="role1" /&gt;
&lt;user name="both" password="tomcat" roles="tomcat,role1" /&gt;
&lt;/tomcat-users&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div style="font-family: Verdana,sans-serif;"&gt;
&lt;span style="font-size: small;"&gt;* We have defined the roles in the Guest level, so we don't need any changes in tomcat-users.xml file&lt;br /&gt;* Then finally comes user-data-constraint tag, where you have to defined how your request and response data should be traveled between you (client) and the server.&lt;br /&gt;* When you give CONFIDENTIAL in transport-guarantee tag, the server will make sure the data transferred between you and the server should not be sniffed by other parties. It uses HTTPS protocol to start the request.&lt;br /&gt;&lt;i&gt;&lt;b&gt;How it works:&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;* When you hit the server with www.passion4java.com/simple/servlet/SimpleServlet, it first checks whether the URL request any security check&lt;br /&gt;* By checking the url-pattern inside the web-resource-collection, it finds out.&lt;br /&gt;* it also check the request type in our case we are using GET and it matches.&lt;br /&gt;* Then roles comes, if some roles are defined then it sends back the request to client and again and pops you for the username and password.&lt;br /&gt;* They are 4 different type how you can transfer you username and password to server, which also defined in web.xml (in our web.xml we have not defined that, so going deeper in that)&lt;br /&gt;* Once you got you credentials back from the client, it will check with tomcat-users.xml if it matches or not (for Tomcat server only).&lt;br /&gt;* Then it will make sure which transport method need to be used based on transport-guarantee Tag. it may be HTTP or HTTPS.&lt;br /&gt;&lt;b&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;i&gt;Area which i am not clear:&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;* I not clear how can we configure the role check using database in other servers like weblogic?&lt;br /&gt;* I know that our web.xml redirect us with HTTPS if we have transport-guarantee as CONFIDENTIAL. But not sure how can i setup the HTTPS protocol, so that I can send the data securely.&lt;br /&gt;I just thought of sharing how the security can be configured using you web.xml, if you guys any thoughts, DOUBTS&amp;nbsp; or any corrections. Please let me know.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Thank you ;)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</description><link>http://passion4java.blogspot.com/2009/12/securing-your-application-using-webxml.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-2375970107705481989</guid><pubDate>Tue, 08 Dec 2009 18:58:00 +0000</pubDate><atom:updated>2009-12-11T11:19:15.170+05:30</atom:updated><title>Things to remember in Servlet URL Mapping</title><description>&lt;br /&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: small;"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: medium;"&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;span style="color: black; font-family: 'Times New Roman';"&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: 'Times New Roman';"&gt;&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;Most of the time when we work, we always uses any web MVC framework
like struts. And we start forgetting the advantages which are in the web.xml by
default.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;I just thought sharing about servlet url mapping in web.xml. You
may thing this is a very basic in j2ee. That right, however they are some
important points which should be remembered ;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;u&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;SUFIX Wins&lt;/span&gt;&lt;/u&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;When we map the URL for servlet, always suffix wildcard string will
be taken as the first priority than prefix wildcard.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;URL : &lt;a href="http://www.passion4java.com/servlet/SampleServlet.mama"&gt;www.passion4java.com/servlet/SampleServlet.mama&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For above URL two
pattern matches in the below weeb.xml file,even SampleServlet matches the long
string.Only the SampleServlet2 should get executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; So the bottom line is suffix
always wins first ;)&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;u&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;Wildcard only before or after /&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;When you want to apply wildcard (*), it will work only after or
before the / in the url mapping.&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt; &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-mapping&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-name&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;SampleServlet&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-name&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;url-pattern&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;/&lt;u&gt;servlet&lt;/u&gt;/SampleServlet*&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;url-pattern&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-mapping&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;The above code will not get matched if we have URL like this &lt;a href="http://www.passion4java.com/servlet/SampleServlet1"&gt;www.passion4java.com/servlet/SampleServlet1&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;u&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;Wildcard at the start or end&lt;/span&gt;&lt;/u&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;You can apply wildcard only at the start or the end, if you try to
apply the wildcard in between the url like below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-mapping&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-name&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;SampleServlet&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-name&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;url-pattern&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;/&lt;u&gt;servlet&lt;/u&gt;/SampleServlet/*/test&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;url-pattern&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;/span&gt;&lt;span style="color: #3f7f7f; font-family: 'Courier New'; font-size: 10pt;"&gt;servlet-mapping&lt;/span&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;And trying to call with the URL: &lt;a href="http://www.passion4java.com/servlet/SampleServlet1/wildcardhere/test"&gt;www.passion4java.com/servlet/SampleServlet1/wildcardhere/test&lt;/a&gt;
, the mapping will not be picked.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;u&gt;&lt;span style="color: teal; font-family: 'Courier New'; font-size: 10pt;"&gt;Sample Web.xml&lt;/span&gt;&lt;/u&gt;&lt;br /&gt;
&lt;/div&gt;


&lt;pre class="brush: xml"&gt;
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;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"&gt;
  &lt;servlet&gt;
    &lt;servlet-name&gt;SampleServlet&lt;/servlet-name&gt;
    &lt;servlet-class&gt;com.passion4java.servlet.SampleServlet&lt;/servlet-class&gt;
    &lt;init-param&gt;
    	&lt;param-name&gt;name&lt;/param-name&gt;
    	&lt;param-value&gt;This is a SampleServlet&lt;/param-value&gt;
    &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet&gt;
    &lt;servlet-name&gt;SampleServlet2&lt;/servlet-name&gt;
    &lt;servlet-class&gt;com.passion4java.servlet.SampleServlet&lt;/servlet-class&gt;
    &lt;init-param&gt;
    	&lt;param-name&gt;name&lt;/param-name&gt;
    	&lt;param-value&gt;This is a SampleServlet 2&lt;/param-value&gt;
    &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;SampleServlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/servlet/SampleServlet/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;SampleServlet2&lt;/servlet-name&gt;
    &lt;url-pattern&gt;*.mama&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
&lt;/web-app&gt;
&lt;/pre&gt;
</description><link>http://passion4java.blogspot.com/2009/12/things-to-remember-in-servlet-url.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-853530422763582886</guid><pubDate>Thu, 19 Nov 2009 11:44:00 +0000</pubDate><atom:updated>2009-12-11T11:19:07.361+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">HTML</category><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><title>Excellent Code Display Tool for Technical Bloggers.</title><description>&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;In my previous post, my code are displayed in ugly format. So that user will not read that post. I was really searching on net to find a Javascript which may help &amp;nbsp;me in displaying my code cleaner.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;I came to know a&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter" id="q4br" title="SyntaxHighlighter"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;SyntaxHighlighter&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;which displayes your code exaclty what i was expecting. Thanks a lot for&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;SyntaxHighlighter :).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Below is the Step how you can integrate the &amp;nbsp;SyntaxHighlighter in your Blog/ Web Site.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;For people who uses the Hosted Application like blogger.com, can use the online hosted javascript files from SyntaxHighlighter.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: blue;"&gt;&lt;strong&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Step 01:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;* &lt;/span&gt;&lt;/span&gt;&lt;a href="http://alexgorbatchev.com/downloads/grab.php?name=sh" id="rwhn" title="Click Here"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Click Here&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt; to download the&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;SyntaxHighlighter javascript code.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;* For the people who uses blogspot and WordPress can wait :) (we can direcly use the code from their server)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: black;"&gt;&lt;strong&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;STEP 02:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;* Place the below code above &amp;lt;head&amp;gt; HTML tag of your HTML page.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;* For&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;blogspot and WordPress users&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;it will be &amp;nbsp;templete.xml file or the HTML column of the layout page.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class="brush: js"&gt;&lt;script src="scripts/shCore.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushBash.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushCpp.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushCSharp.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushCss.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushDelphi.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushDiff.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushGroovy.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushJava.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushJScript.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushPhp.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushPlain.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushPython.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushRuby.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushScala.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushSql.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushVb.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script src="scripts/shBrushXml.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;link href="styles/shCore.css" rel="stylesheet" type="text/css"&gt;&lt;/link&gt;
&lt;link href="styles/shThemeDefault.css" rel="stylesheet" type="text/css"&gt;&lt;/link&gt;
&lt;script type="text/javascript"&gt;
SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
SyntaxHighlighter.all();
&lt;/script&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333;"&gt;&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Disable the language (here its computer language) which you may not use. For me i am java developer, i will not post code which are from VB, so &amp;nbsp;i am commented that. This disabling will give you performance in page load.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;For the people who want to use online version should pre fix "http://alexgorbatchev.com/pub/sh/2.1.364/" in all your src attributes.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: black;"&gt;&lt;strong&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;STEP 03:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Add your code inside the pre tag,and you have to define the class based on your code language.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;pre class="brush: java"&gt;public class AntHelloWorld {
 public static void main(String[] args) {
  System.out.println("This Project was build using Ant");
 }
}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;As the above code is a java, so we are using class="&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;brush: java&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333;"&gt;&lt;span style="font-family: Verdana, sans-serif;"&gt;&lt;span style="font-size: small;"&gt;", this decides which syntax coloring need to be used.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
</description><link>http://passion4java.blogspot.com/2009/11/excellent-code-display-tool-for.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-701098980675762323</guid><pubDate>Tue, 17 Nov 2009 20:12:00 +0000</pubDate><atom:updated>2009-11-19T14:23:00.611+05:30</atom:updated><title>A Strange behavior about Java Resource Bundle</title><description>&lt;br /&gt;
I am working in a project where I have to load two different property files (for example parent.properties &amp;amp; child.properties ) which are totally have different base name and it should also have inheritance relationship between this two bundle. So that if any keys are not found in child.properties it should get from parent.properties.&lt;br /&gt;
When I was analyzing the resource bundle code, I came to know there is method setParent(), this method is used to set which is your parent bundle (something like java super class). For example if we use bundle name called "child_en.properties" the my parent bundle should be "child.properties".&lt;br /&gt;
As this method was protected method in ResourceBundle Class, so to use this class I have sub classed my own ResourceBundle class and overridden the setParent Method like below.&lt;br/&gt;

&lt;pre class="brush: html"&gt;
public class P4JResourceBundle extends ResourceBundle {
protected void setParent(ResourceBundle parent) {
super.setParent(parent);
}
public void letsChangeParent(String parent){
this.setParent(ResourceBundle.getBundle(parent));
}
public Enumeration getKeys() {
return null;
}
protected Object handleGetObject(String key) {
return null;
}&lt;/pre&gt;

So after changing the class I have executed with the below method, excepts that it should pick the key from parent.properties file if the key is not present in child.properties file.

&lt;pre class="brush: html"&gt;
public class ResourceBundleExample {
public static void main(String[] args) {
P4JResourceBundle myBundle = new P4JResourceBundle();
myBundle.letsChangeParent("com.passion4java.resourcebundle.parent");
ResourceBundle bundle = myBundle.getBundle("com.passion4java.resourcebundle.child");
System.out.println(bundle.getString("i_am_not_in_child_file"));
}
}
&lt;/pre&gt;

&lt;span style="font-size: 9pt;"&gt;&lt;span style="font-family: 'Courier New';"&gt;As usual &lt;/span&gt;&lt;span style="font-family: Wingdings;"&gt;J&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt; there is an error thrown saying the key was missing.&lt;span style="font-family: 'Times New Roman'; font-size: medium;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;

&lt;pre class="brush: html"&gt;
Exception in thread "main" java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key i_am_not_in_child_file
at java.util.ResourceBundle.getObject(Unknown Source)
at java.util.ResourceBundle.getString(Unknown Source)
at com.passion4java.resourcebundle.ResourceBundleExample.main(ResourceBundleExample.java:11)
&lt;/pre&gt;


&lt;span style="font-family: 'Courier New'; font-size: 9pt; text-decoration: underline;"&gt;&lt;strong&gt;So what's wrong?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
I tried to debug the code in the resource bundle class and below code surprised me.&lt;br /&gt;

&lt;pre class="brush: html"&gt;
public static final ResourceBundle   getBundle(String   baseName,Locale   locale){
       return getBundleImpl(baseName, locale, getLoader());
}
private static ResourceBundle   getBundleImpl(String   baseName, Locale   locale,
                                            ClassLoader   loader){
         if (baseName == null) {
             throw new NullPointerException  ();
         }

 String   bundleName = baseName;
         String   localeSuffix = locale.toString();
         if (localeSuffix.length() &amp;gt; 0) {
             bundleName += "_" + localeSuffix;
         } else if (locale.getVariant().length() &amp;gt; 0) {
 //new Locale("", "", "VARIANT").toString == ""
 bundleName += "___" + locale.getVariant();
         }
 Locale   defaultLocale = Locale.getDefault();
          Object   lookup = findBundleInCache(loader, bundleName, defaultLocale);
         if (lookup == NOT_FOUND) {
             throwMissingResourceException(baseName, locale);
         } else if (lookup != null) {
             return (ResourceBundle  )lookup;
         }
Object   parent = NOT_FOUND; // **********THIS_LINE_OF_CODE**********
try {
             //locate the root bundle and work toward the desired child
 Object   root = findBundle(loader, baseName, defaultLocale, baseName, null);
             if (root == null) {
                 putBundleInCache(loader, baseName, defaultLocale, NOT_FOUND);
                 root = NOT_FOUND;
             }
…cont
&lt;/pre&gt;

As I was setting the value in setParent() of resource bundle to change the parent resource bundle, but when the bundle are created using ResourceBundle.getInstance(), internally it calls getBundleImpl() which set the parent as "NOT_FOUND" direcly.&lt;br /&gt;
I was really confused why the code was setting directly rather than using values from the setter method????&lt;br /&gt;
As user of this class this implementation really stops customization which users expects.&lt;br /&gt;
Please feel free to comment. &lt;br /&gt;
&lt;br /&gt;</description><link>http://passion4java.blogspot.com/2009/11/strange-behavior-about-java-resource.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>12</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-6639835598170129473</guid><pubDate>Sun, 15 Nov 2009 20:10:00 +0000</pubDate><atom:updated>2009-11-16T01:40:18.440+05:30</atom:updated><title>Right usage of Annotations in Java.</title><description>&lt;span xmlns=''&gt;&lt;p&gt;When I was reading the annotation in java, I can't really feel where it can be used. Most of them (like me &lt;span style='font-family:Wingdings'&gt;J&lt;/span&gt;) think that Annotations are mostly used my IDE like Eclipse and other tools.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In one of my old projects they are using annotations for decision making purposes like permissions, I was not so convinced that is this is right use?. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;But today I was learning Xdoclet  (a code generation tool),where they use lots of javadocs kind of stuff to give the meta information's to Xdoclet tools. There we are &lt;span style='font-family:Wingdings'&gt;J&lt;/span&gt;… &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;*    @version 0.5&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;*    @web.servlet name="SimpleServlet"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;*             display-name="Simple Servlet"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;*             load-on-startup=" l"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;*    @web-servlet-init-param name="table" value="production"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;*    @web-servlet-init-param name="account" value="accounts"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;In above code we are using lots of javadocs comments which are given inputs to Xdoclets, if they are using javadocs like comments it may not force you compile level syntax check.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If we are using Annotations, then we can achieve the compile check. In EJB3 they are using the Annotations for code generations for home interface and other classes.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As of I feel that the only usages of Annotations was it should be used when we do a code generations. I may not sure using Annotations for permission check for API classes is the right decisions?&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Please feel free to add comments to this topic. Thank you.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;</description><link>http://passion4java.blogspot.com/2009/11/right-usage-of-annotations-in-java.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-5502748689373565356</guid><pubDate>Thu, 12 Nov 2009 13:48:00 +0000</pubDate><atom:updated>2009-11-12T19:19:52.916+05:30</atom:updated><title>Add Sexy Bookmarks to Blogspot</title><description>&lt;br /&gt;
&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: Verdana;"&gt;I was searching for adding the Sexy Bookmarks to configure in blogspot.com, after long search I was finally configured using below URL. It has two versions of Sexy Bookmarks...&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: Verdana;"&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Wingdings; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.cssreflex.com/wp-content/uploads/2009/08/sexy-bookmarks-for-blogger.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="75" src="http://www.cssreflex.com/wp-content/uploads/2009/08/sexy-bookmarks-for-blogger.PNG" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style="font-family: Wingdings; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Wingdings; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 12pt;"&gt;&lt;a href="http://www.cssreflex.com/2009/08/sexybookmarks-v2-for-blogger.html"&gt;SexyBookmarks v2 For Blogger&lt;/a&gt;&lt;/span&gt;&lt;span style="color: #4b4b4b; font-family: Verdana; font-size: 12pt;"&gt;&lt;strong&gt;&lt;br /&gt;     &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.cssreflex.com/wp-content/uploads/2009/03/screenshot-1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="82" src="http://www.cssreflex.com/wp-content/uploads/2009/03/screenshot-1.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 12pt;"&gt;&lt;a href="http://www.cssreflex.com/2009/03/add-sexy-bookmarks-to-blogger.html"&gt;Add Sexy Bookmarks to Blogger&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 13px;"&gt;&lt;span style="font-family: Verdana;"&gt;Configure which you like&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: Wingdings;"&gt;J&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</description><link>http://passion4java.blogspot.com/2009/11/add-sexy-bookmarks-to-blogspot.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-870355259870003079</guid><pubDate>Wed, 11 Nov 2009 13:31:00 +0000</pubDate><atom:updated>2009-11-12T14:57:17.777+05:30</atom:updated><title>Something Fishy about JSTL Tags</title><description>&lt;span style="color: teal; font-family: Verdana; font-size: 10pt;"&gt;I was using "&lt;a href="http://tomcat.apache.org/taglibs/standard/"&gt;Apache Standard Taglib&lt;/a&gt; Standard 1.1" for setting different resource bundle based on the user. I also added default resource bundle name in web.xml as below.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;context-param&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: teal;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;param-name&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;javax.servlet.jsp.jstl.fmt.localizationContext&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;param-name&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;param-value&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;com.passion4java.Localization&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;param-value&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: teal;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;context-param&lt;/span&gt;&lt;span style="color: teal;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: teal; font-family: Verdana; font-size: 10pt;"&gt;I was using setBundle tag in my code so that it will set different bundle based on the user.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;fmt:setBundle  &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;basename&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"&lt;span style="color: #bf5f3f;"&gt;&amp;lt;%=&lt;/span&gt;&lt;span style="color: black;"&gt;partnerLevelBrandName&lt;/span&gt;&lt;span style="color: #bf5f3f;"&gt;%&amp;gt;&lt;/span&gt;"&lt;span style="color: black;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: #7f007f;"&gt;scope&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: #2a00ff;"&gt;"session"&lt;/span&gt;&lt;span style="color: teal;"&gt;/&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: #3f7f7f;"&gt;I tried to set the scope in the setBundle tag, but in &lt;/span&gt;&lt;span style="color: teal;"&gt;"&lt;a href="http://tomcat.apache.org/taglibs/standard/"&gt;Apache Standard Taglib&lt;/a&gt; Standard 1.1" it was throwing an exception saying that &lt;strong&gt;var argument need to be used when you are using the scope variable …&lt;br /&gt;
&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt; text-decoration: underline;"&gt;&lt;strong&gt;&lt;span style="color: red;"&gt;Error:&amp;nbsp;&lt;/span&gt;&lt;span style="-webkit-text-decorations-in-effect: none;"&gt;&lt;span style="color: red;"&gt;passiontemplate1.jsp:31:1: The page failed validation from validator: "Illegal scope attribute without var in "fmt:setBundle" tag.".&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #3f7f7f; font-family: Verdana; font-size: 10pt;"&gt;Then  I was running the code without scope variable, but  the setBundle was not overriding the default build name (which is specified in the web.xml)&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: teal;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #3f7f7f;"&gt;fmt:setBundle  &lt;/span&gt;&lt;span style="color: #7f007f;"&gt;basename&lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;"&lt;span style="color: #bf5f3f;"&gt;&amp;lt;%=&lt;/span&gt;&lt;span style="color: black;"&gt;passionLevelBrandName&lt;/span&gt;&lt;span style="color: #bf5f3f;"&gt;%&amp;gt;&lt;/span&gt;" /&amp;gt;&lt;span style="color: black;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #3f7f7f; font-family: Verdana; font-size: 10pt;"&gt;When I was debugging the code of the JSTL Message Tag (org.apache.taglibs.standard.tag.rt.fmt.MessageTag), they are getting the bundle name from the pageContext .Below is the code which searches the bundle name.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="font-size: 13px; text-decoration: underline;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt; text-decoration: underline;"&gt;&lt;span style="color: black;"&gt;Code Snipped from javax.servlet.jsp.jstl.core.&lt;/span&gt;&lt;span style="color: blue;"&gt;Config&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: small;"&gt;&lt;span style="font-size: 12px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;    public static &lt;/span&gt;&lt;span style="color: blue;"&gt;Object&lt;/span&gt;&lt;span style="color: black;"&gt; find&lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;PageContext&lt;/span&gt;&lt;span style="color: black;"&gt; pc, &lt;/span&gt;&lt;span style="color: blue;"&gt;String&lt;/span&gt;&lt;span style="color: black;"&gt; name&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue;"&gt;Object&lt;/span&gt;&lt;span style="color: black;"&gt; ret = &lt;em&gt;get&lt;/em&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;pc, name, &lt;/span&gt;&lt;span style="color: blue;"&gt;PageContext&lt;/span&gt;&lt;span style="color: black;"&gt;.&lt;/span&gt;&lt;span style="color: #408080;"&gt;PAGE_SCOPE&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;ret == null&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    ret = &lt;em&gt;get&lt;/em&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;pc, name, &lt;/span&gt;&lt;span style="color: blue;"&gt;PageContext&lt;/span&gt;&lt;span style="color: black;"&gt;.&lt;/span&gt;&lt;span style="color: #408080;"&gt;REQUEST_SCOPE&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    if &lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;ret == null&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;pc.getSession&lt;/span&gt;&lt;span style="color: red;"&gt;()&lt;/span&gt;&lt;span style="color: black;"&gt; != null&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &lt;/span&gt;&lt;span style="color: #0a246a;"&gt;// check session only if a session is present&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    ret = &lt;em&gt;get&lt;/em&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;pc, name, &lt;/span&gt;&lt;span style="color: blue;"&gt;PageContext&lt;/span&gt;&lt;span style="color: black;"&gt;.&lt;/span&gt;&lt;span style="color: #408080;"&gt;SESSION_SCOPE&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if &lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;ret == null&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    ret = &lt;em&gt;get&lt;/em&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;pc, name, &lt;/span&gt;&lt;span style="color: blue;"&gt;PageContext&lt;/span&gt;&lt;span style="color: black;"&gt;.&lt;/span&gt;&lt;span style="color: #408080;"&gt;APPLICATION_SCOPE&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    if &lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;ret == null&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ret = pc.getServletContext&lt;/span&gt;&lt;span style="color: red;"&gt;()&lt;/span&gt;&lt;span style="color: black;"&gt;.getInitParameter&lt;/span&gt;&lt;span style="color: red;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;name&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &lt;/span&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    &lt;/span&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;}&lt;span style="color: black; font-family: 'Times New Roman'; font-size: medium;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: red;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; ret;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New'; font-size: 9pt;"&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #3f7f7f; font-family: Verdana; font-size: 10pt; text-decoration: underline;"&gt;&lt;strong&gt;I have two questions which are running in my mind.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style="margin-left: 54pt;"&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: red;"&gt;Why fmt:setBundle  tag was not allowing to set the scope variable only?&lt;br /&gt;
&lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: red;"&gt;As we defined the default resource bundle name in web.xml (which is application level), why the code was setting the bundle name in the pageContext?(it should set in the application scope).&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="color: red;"&gt;&lt;span style="color: black; font-family: 'Times New Roman';"&gt;&lt;span style="font-family: Verdana;"&gt;&lt;span style="color: red;"&gt;And finally why they are started to search from pageContext &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Wingdings;"&gt;&lt;span style="color: red;"&gt;à&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Verdana;"&gt;&lt;span style="color: red;"&gt; Application (I think it has to be reversed)?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="color: #3f7f7f; font-family: Verdana; font-size: 10pt;"&gt;Please let me know if you have any thoughts on this?&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;</description><link>http://passion4java.blogspot.com/2009/11/something-fishy-about-jstl-tags.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-9207186020782155743</guid><pubDate>Fri, 06 Nov 2009 12:34:00 +0000</pubDate><atom:updated>2009-11-06T18:07:44.942+05:30</atom:updated><title>Google created Easy tools for developing JavaScript code.</title><description>&lt;span style="color: #333333; font-size: 10pt;"&gt;&lt;strong&gt;&lt;span style="font-family: Arial;"&gt;Google has came up with 3 Tools which will really bring down you most of the JavaScript development efforts. They collectively called as &lt;a href="http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html"&gt;"&lt;/a&gt;&lt;/span&gt;Closure Tools&lt;span style="font-family: Arial;"&gt;".&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: #73afdf; font-family: Arial; font-size: 16pt;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial; font-size: 10pt; text-decoration: underline;"&gt;&lt;strong&gt;Closure Compiler:&lt;br /&gt;
&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial; font-size: 10pt;"&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;This tool will check your code and increases the performance of the code by removing unnecessary lines. It will also alert you with some common error pitfalls in java scripts.&lt;br /&gt;
&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial; font-size: 10pt;"&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Google has created application &lt;a href="http://www.blogger.com/goog_1257510946476"&gt;(&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;&lt;a href="http://www.blogger.com/goog_1257510946476"&gt;http://closure-compiler.appspot.com/home&lt;/a&gt;&lt;span style="color: #333333; font-family: Arial; font-size: 10pt;"&gt;&lt;strong&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from which you can check you code. Just copy your code and past it and click the compile button.&lt;br /&gt;
&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href="http://closure-compiler.appspot.com/home"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial; font-size: 10pt; text-decoration: underline;"&gt;&lt;strong&gt;Closure Library:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-size: 10pt;"&gt;&lt;strong&gt;&lt;span style="font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;It's a JavaScript Library from which you get most of the cross browser JavaScript API code. There are lots of JavaScript API in the internet,but most of them are not supported by more than 2 browsers and gives lot surprises (bugs) during integrations, but here it was supported by all the browsers and it form Google &lt;/span&gt;&lt;span style="font-family: Wingdings;"&gt;J&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial; font-size: 10pt; text-decoration: underline;"&gt;&lt;strong&gt;Closure Templates&lt;/strong&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;b&gt;This is similar to a template engine, which will have &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Helvetica;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;b&gt;reusable HTML and UI elements. For example you can have a check box which customized with &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333; font-family: Arial; font-size: 10pt;"&gt;&lt;strong&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Closure Templates and it can been used in your entire page.&lt;/span&gt;&lt;br /&gt;
&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Arial;"&gt;&lt;span style="color: #333333; font-size: 10pt;"&gt;&lt;strong&gt;For more info Check out &lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;a href="http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;a href="http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html"&gt;&lt;span style="color: #73afdf; font-size: 12pt;"&gt;Introducing Closure Tools&lt;span style="text-decoration: underline;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333; font-size: 10pt;"&gt;&lt;strong&gt;&lt;br /&gt;
&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial; font-size: 10pt;"&gt;&lt;strong&gt;I am also planning to come up with simple example on this topic in future…&lt;br /&gt;
&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: black; font-family: Helvetica;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;a href="http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html"&gt;&lt;/a&gt;</description><link>http://passion4java.blogspot.com/2009/11/google-created-easy-tools-for.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-1381976321793802237</guid><pubDate>Thu, 05 Nov 2009 08:28:00 +0000</pubDate><atom:updated>2009-11-05T14:28:27.651+05:30</atom:updated><title>How to Post your Blog using RSS Feed?</title><description>Here are the steps to Post your Blog using RSS Feed.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;go blogspot.com and configure the email address by giving a "&lt;span style="color: #888888; font-family: Arial; font-size: 10pt;"&gt;secretWords&lt;/span&gt;" and select the "&lt;span style="color: #333333; font-family: 'Trebuchet MS'; font-size: 9pt;"&gt;Publish emails immediately&lt;/span&gt;" option and the save the settings.&lt;br /&gt;
&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Go the blogspot.com -&amp;gt; Login -&amp;gt; Settings -&amp;gt; &lt;a href="http://www.blogger.com/blog-options-email.g?blogID=3616017652746096084"&gt;Email &amp;amp; Mobile&lt;/a&gt; -&amp;gt; Email Posting Address&lt;/li&gt;
&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.getdropbox.com/u/2573367/passion4java/archive/rss2blog_01.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="115" src="http://dl.getdropbox.com/u/2573367/passion4java/archive/rss2blog_01.JPG" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div&gt;After adding the "secretWords" your email id will look like java2usuf.&lt;a href="mailto:secretWords@blogspot.com"&gt;secretWords@blogspot.com&lt;/a&gt;.  The reason for ""secretWords"" is that it only known by you.&lt;br /&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Once you have your email id and settings has been enabled login to  &lt;a href="http://www.feedmyinbox.com/"&gt;&lt;strong&gt;www.feedmyinbox.com&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;br /&gt;
&lt;/strong&gt;where you can configure your email and the RSS feeds link. &lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;So that if RSS feeds gets updated the tool will start sending email to the given address.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.getdropbox.com/u/2573367/passion4java/archive/rss2blog_02.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="289" src="http://dl.getdropbox.com/u/2573367/passion4java/archive/rss2blog_02.JPG" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><link>http://passion4java.blogspot.com/2009/11/how-to-post-your-blog-using-rss-feed.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-6879037732548480458</guid><pubDate>Wed, 04 Nov 2009 11:26:00 +0000</pubDate><atom:updated>2009-11-04T16:56:54.119+05:30</atom:updated><title>Casting an object if the object is NULL?</title><description>&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;If you are casting an object which is null, then java will not throw any exceptions. What does is, it will simply assign the null to the casted reference type variable.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Courier New; font-size:10pt'&gt;Object obj = null;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Courier New; font-size:10pt'&gt;String a = (String) obj;&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;In above example "a" will be assigned as NULL.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:black'&gt;ava.util.ArrayList al = session.get("xyzObject");&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:black'&gt;Object o = &lt;/span&gt;&lt;span style='color:red'&gt;(&lt;/span&gt;&lt;span style='color:black'&gt;Object&lt;/span&gt;&lt;span style='color:red'&gt;)&lt;/span&gt;&lt;span style='color:black'&gt; al;&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:black'&gt;String a = &lt;/span&gt;&lt;span style='color:red'&gt;(&lt;/span&gt;&lt;span style='color:black'&gt;String&lt;/span&gt;&lt;span style='color:red'&gt;)&lt;/span&gt;&lt;span style='color:black'&gt; o;&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:black'&gt;System.out.println&lt;/span&gt;&lt;span style='color:red'&gt;(&lt;/span&gt;&lt;span style='color:black'&gt;a&lt;/span&gt;&lt;span style='color:red'&gt;)&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Courier New; font-size:10pt'&gt;If session.get("xyzObject") != NULL:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='color:black; font-family:Courier New'&gt;    &lt;/span&gt;&lt;span style='font-family:Verdana'&gt;If we are getting an arraylist object from session then the above code will throw Class Cast Exception.&lt;/span&gt;&lt;span style='color:black; font-family:Courier New'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Courier New; font-size:10pt'&gt;If session.get("xyzObject") == NULL:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='color:black; font-family:Courier New'&gt;    &lt;/span&gt;&lt;span style='font-family:Verdana'&gt;If we are getting a null value from session then the above code will not throw any exceptions. The reasons because null can be cast to any object references.&lt;/span&gt;&lt;span style='color:black; font-family:Courier New'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Arial; font-size:13pt; text-decoration:underline'&gt;&lt;em&gt;What's a big thing in it:&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Arial; font-size:13pt'&gt;    &lt;/span&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;The main thing is if we are sending null to an object reference most of time, and some time if we are start sending a value in it, it may break the code...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Hope this post may give some thoughts. Please leave your comments if any.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;</description><link>http://passion4java.blogspot.com/2009/11/casting-object-if-object-is-null.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-1129758991770644855</guid><pubDate>Mon, 26 Oct 2009 13:12:00 +0000</pubDate><atom:updated>2009-10-26T18:47:51.507+05:30</atom:updated><title>Bye Bye GeoCities …</title><description>&lt;h3&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-weight: normal;"&gt;Today is the last day for GeoCities&amp;nbsp;in the internet world. From tomorrow the GeoCities Websites are nowhere.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-weight: normal;"&gt;It really somehow hurts me because, I was started to learn web pages only from geocities. Which had given me inspiration towards web pages development…?&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dl.getdropbox.com/u/2573367/passion4java/archive/geocities_Close.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://dl.getdropbox.com/u/2573367/passion4java/archive/geocities_Close.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h3&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-size: 19px;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-weight: normal;"&gt;Any Finally thanks GeoCities&amp;nbsp; for all your help. Hope Yahoo may come up with something new &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Wingdings;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;</description><link>http://passion4java.blogspot.com/2009/10/bye-bye-geocities.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-5146842569271661341</guid><pubDate>Mon, 26 Oct 2009 12:16:00 +0000</pubDate><atom:updated>2009-10-26T17:51:55.308+05:30</atom:updated><title>Where your compiled JSP files stored in WEBLOGIC?</title><description>I know where the compiled files are stored in Tomcat (which is under work folder), but when it comes to weblogic I was really searching where the compiled JSP classes are stored.After doing some google, then I found the path. &lt;br /&gt;
&lt;span style="text-decoration: underline;"&gt;Work Folder of WEBLOGIC:&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;\bea\user_projects\domains\&amp;lt;YOUR_DOMAIN_NAME&amp;gt;\servers\&amp;lt;APP_SERVER_NAME&amp;gt;\tmp\_WL_user\&amp;lt;APPLICATION_WAR&amp;gt;&lt;br /&gt;
&lt;/span&gt;</description><link>http://passion4java.blogspot.com/2009/10/where-your-compiled-jsp-files-stored-in.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-2927123133384109843</guid><pubDate>Thu, 22 Oct 2009 09:13:00 +0000</pubDate><atom:updated>2009-10-22T14:43:59.593+05:30</atom:updated><title>5 Things you should know about String Constant Pool.</title><description>&lt;span xmlns=''&gt;&lt;ul&gt;&lt;li&gt;When a Class was compiled the String literals are noted in a special way by the compiler.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Once the Class get loaded, all the String literals which are inside the class are placed inside the String Constant Pool. So once the Class got initialized all the String literals are ready for use.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;String Constant Pool is &lt;strong&gt;Constant Table&lt;/strong&gt; which will hold all the String Literal Objects which lives on the heap. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;Most of people think String Constant Pool is where the String Literal Object are Stored, but that's not true.&lt;strong&gt;"All the Objects are Stored one and only in HEAP"&lt;/strong&gt;&lt;br /&gt;				&lt;/li&gt;&lt;li&gt;During Garbage Collections, the values which are String Literals are not Garbage Collected. The reason is GC only collects the objects which are not referred. But String Literals objects (in Heap) are referred by the String Constant Pool (Constant Table).&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;</description><link>http://passion4java.blogspot.com/2009/10/5-things-you-should-know-about-string.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-4075774237805294657</guid><pubDate>Wed, 21 Oct 2009 07:23:00 +0000</pubDate><atom:updated>2009-10-21T12:54:23.433+05:30</atom:updated><title>Eclipse Scrapbook Pages: A quick way to test you java code snippets.</title><description>&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='color:#335599; font-family:Verdana; font-size:10pt'&gt;Scrapbook Pages was the functionality which most of the eclipse users don't know. This is a simple and quick way to test any small code snippets before implementing it.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;&lt;span style='color:#335599'&gt;For example if you want to test how you can get year, month and date from calendar class. Then we have to write a test class with proper class name and main method in it… But it is an annoying process to just to test this small code. So in Scrap page you can just paste the code in the files as below and you can execute (Ctrl + U).&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;&lt;span style='color:#0070c0; text-decoration:underline'&gt;&lt;em&gt;Sample Code:&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    int year = 2009;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    int month = 0; // January&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    int date = 1;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    java.util.Calendar cal = java.util.Calendar.getInstance();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    cal.clear();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    cal.set(java.util.Calendar.YEAR, year);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    cal.set(java.util.Calendar.MONTH, month);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    cal.set(java.util.Calendar.DATE, date);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    java.sql.Date sqlDate = new java.sql.Date(cal.getTimeInMillis());&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    System.out.println(sqlDate);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;    System.out.println("Bye");&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='color:#335599; font-family:Verdana; font-size:10pt'&gt;You also select only the lines which you want to test, for example if I want to test only the last line "System.out.println("Bye"); Just select the line and execute …. You only see "Bye" in you console…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:#335599; font-family:Verdana; font-size:10pt'&gt;This is a Quick way to test your code Snipped and another important thing is you don't have any import statements and class name. So If you want to refer Calendar class you have to refer it with full package structure like this java.util.Calendar. By default it only finds the classes which are in java.util (as normally java does).&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;</description><link>http://passion4java.blogspot.com/2009/10/eclipse-scrapbook-pages-quick-way-to.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-3137946148078536299</guid><pubDate>Mon, 19 Oct 2009 10:13:00 +0000</pubDate><atom:updated>2009-10-19T16:42:48.872+05:30</atom:updated><title>ANT “Hello World” Example</title><description>&lt;span style="font-family: Verdana; font-size: small;"&gt;I thought sharing very basic ant build.xml file which will compile a single class and create a jar by adding manifest file to it. Let start explaining this step by step.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: Verdana; font-size: 10pt; text-decoration: underline;"&gt;&lt;b&gt;AntHelloWorld Java Class:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Create a java class with which will print hello world in the console.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #0070c0; font-family: Verdana; font-size: x-small;"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;package com.passion4java.helloworld.ant;&lt;br /&gt;
class AntHelloWorld {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public static void main(String[] args) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println("This Project was build using Ant");&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Create a build.xml file which will first clean and compile the java classes and then build the jar file.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: Verdana; font-size: 10pt; text-decoration: underline;"&gt;&lt;b&gt;Hello world build script:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-size: small;"&gt;&amp;lt;project&lt;/span&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt; name="AntHelloWorld" default="main-target" basedir="."&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt; &amp;lt;description&amp;gt;This is a simple build file to run this example file &amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="source.dir" value="src"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;property name="build.dir" value="build"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;property name="classes.dir" value="${build.dir}/classes"/&amp;gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;property name="main-class-name" value="com.passion4java.helloworld.ant.AntHelloWorld"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt; &amp;lt;target name="main-target" depends="clean,build" description="--&amp;gt; description"&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!-- creating a jar file--&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jar basedir="${classes.dir}" destfile="${ant.project.name}.jar"&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!-- adding the main class to the manifest file--&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;manifest&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;attribute name="Main-Class" value="${main-class-name}"/&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/manifest&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/jar&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;delete dir="${build.dir}"/&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt; &amp;lt;/target&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt; &amp;lt;target  name="clean"&amp;gt;&amp;lt;delete dir="${build.dir}"/&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;delete dir="${classes.dir}"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;delete file="${ant.project.name}.jar"&amp;gt;&amp;lt;/delete&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt; &amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!--target:build java classes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;--&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;target name="build"&amp;gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;mkdir dir="${build.dir}"/&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;mkdir dir="${classes.dir}"/&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;javac srcdir="${source.dir}" destdir="${classes.dir}"/&amp;gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: purple;"&gt;&lt;span style="font-family: Verdana; font-size: 8pt;"&gt;&lt;span style="color: red; font-size: small;"&gt;&amp;lt;/project&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-family: Verdana; font-size: small; text-decoration: underline;"&gt;&lt;b&gt;Execution:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: magenta;"&gt;Download the zip file which is attached and extract it. You will see the directory structure as below.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Wxy5K3145bJvNzuAPYCg9pp6eGlMMpomnDgKSkQr0NbTIxXwuN9PzMvc8Ia9iQatUiCEgaF9q_kXaepUvMu-UYbU07_O9CA_ViJXWIkES1Mv18IoyWOIV3jSaDSHxqHNtyE35TGJuCYN/s1600-h/Copy+of+Ant_example.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Wxy5K3145bJvNzuAPYCg9pp6eGlMMpomnDgKSkQr0NbTIxXwuN9PzMvc8Ia9iQatUiCEgaF9q_kXaepUvMu-UYbU07_O9CA_ViJXWIkES1Mv18IoyWOIV3jSaDSHxqHNtyE35TGJuCYN/s320/Copy+of+Ant_example.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: magenta;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;span style="font-size: small;"&gt;Go the folder where the build.xml was there and start execute the file by giving the ant build.xml from the command prompt.All the properties which we defined is relative so it should not have any path related issues&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: magenta;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: magenta;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;b&gt;How it Works:&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul style="color: magenta; margin-left: 54pt;"&gt;&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;We have created a project called AntHelloWorld and we have created 3 targets and 4 properties.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;The name of the Project can also referred by ${ant.project.name}&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;main-target is the default target which be executed when you are running build.xml file without specifying any targets.&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;Once the main-target get triggered, it will first finish all the depended targets which are defined in depends attribute  of the target tags.&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;In our main target they are 2 depended targets clean,build. So both clean and build should be execution first before main-target starts.&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;The order as in depended targets should matters, because as you have the target listed based on that only the ant which will pick which   one to execute first. In our case it should be &lt;span style="text-decoration: underline;"&gt;clean target&lt;/span&gt;.&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;Clean- target deletes the folder and jar if they are present. If no folder is there this will not throw any exceptions.&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;Build targets just compiles all the java classes in the source directory and it will place all the compiled classes in the destination directory&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-left: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&amp;lt;javac srcdir="${source.dir}" destdir="${classes.dir}"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;Then our main-target starts it calls the jar tags which pointing to the classes folder which was created by javac tag.&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;There is also a manifest tag which adds the manifest file to the jar file.&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;Main-Class attribute was added to the manifest file using the below tag &amp;lt;manifest&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;attribute name="Main-Class" value="${main-class-name}"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/manifest&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;Main-Class is nothing but the entry point class for this jar.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;ul style="color: magenta; margin-left: 54pt;"&gt;&lt;/ul&gt;&lt;div style="color: magenta;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana;"&gt;That's it, now we have a jar with a single class file and a manifest file inside in it &lt;/span&gt;&lt;span style="font-family: Wingdings;"&gt;:)&amp;nbsp; &lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; font-size: small;"&gt;&lt;a href="http://dl.getdropbox.com/u/2573367/passion4java/archive/AntHelloWorld.zip"&gt;Download ANT HelloWorld Zip File&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Wingdings;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://passion4java.blogspot.com/2009/10/hello-world-example-for-ant.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Wxy5K3145bJvNzuAPYCg9pp6eGlMMpomnDgKSkQr0NbTIxXwuN9PzMvc8Ia9iQatUiCEgaF9q_kXaepUvMu-UYbU07_O9CA_ViJXWIkES1Mv18IoyWOIV3jSaDSHxqHNtyE35TGJuCYN/s72-c/Copy+of+Ant_example.JPG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-5051755659267760404</guid><pubDate>Wed, 14 Oct 2009 12:46:00 +0000</pubDate><atom:updated>2009-10-14T18:16:48.281+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Regex</category><title>Grouping: A Cool function from Regular Expression</title><description>Most of them are very comfortable in find/replacing text in any Text editor. I will be really helpful if you have the exact phrase which you need to replace. Like In the below text if you want to replace word “passionsoft” to “Microsoft” you can easy do that with single find and replace command.&lt;br /&gt;
&lt;br /&gt;
How about if you want to add some text say “Yousuff” at the end of all the word which started with the string passion.&lt;br /&gt;
&lt;br /&gt;
Sample TEXT:&lt;br /&gt;
&lt;br /&gt;
passionsoft.blogspot.com was moved to passion4java.blogspot.com. passion4java.blogspot.com has lot of post related java language. This is all related to passion. Passion is what matters than success and failure. &lt;br /&gt;
&lt;br /&gt;
Here we can’t use direct find/replace, so how do that? I was solving this previously by going manually to all the word which has passion and start appending at the end.. Which I really HATE to do  i.e if we have a text called “passion4java,passionsoft,passion!@#”, all has different value but starts with the string “passion”… I should not loose the text which are after the word passion and it is different for every word… So go about this??&lt;br /&gt;
&lt;br /&gt;
I believing there should be some way where you can overcome this using regular expression, later I found the Grouping command using regular expression which will group the pattern and word which are inside the pattern can be reused&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Find text: passion([0-9A-Za-z]*)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjetSrPQzWTtzUliTwo8TXo6ryhU5my0tr2h0tWAL2K_oedf_lLjKxXTi7sdUIVmXPGYcSc2YXhEGeRZd7gy5JvILLJN7X3LSkYdgE2EyZj_ZZECYEtLQ4TUtbGDIOubnupx02Fya6BRwzf/s1600-h/find_Command.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img $r="true" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjetSrPQzWTtzUliTwo8TXo6ryhU5my0tr2h0tWAL2K_oedf_lLjKxXTi7sdUIVmXPGYcSc2YXhEGeRZd7gy5JvILLJN7X3LSkYdgE2EyZj_ZZECYEtLQ4TUtbGDIOubnupx02Fya6BRwzf/s400/find_Command.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace text passion$1#--Yousuff--#&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIeb-_gkAybb1w-Of8uQZ7ZsH8jTTeOqmzJcd83HJBffodelLF_EoQuP7S1PnMqFMW7wDky1KAUjicNiYUZnJXhoK5DTANU8Ev8Wor9b-razG_0UZMNqxcd3QDJGTeBxeP2LBiOddmDE77/s1600-h/Replace_Command.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img $r="true" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIeb-_gkAybb1w-Of8uQZ7ZsH8jTTeOqmzJcd83HJBffodelLF_EoQuP7S1PnMqFMW7wDky1KAUjicNiYUZnJXhoK5DTANU8Ev8Wor9b-razG_0UZMNqxcd3QDJGTeBxeP2LBiOddmDE77/s400/Replace_Command.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;It reduced most of my manual text changes , and I thought of share same with all..&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;Please leave your comments if you find anything interesting :)&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;br /&gt;
&lt;/div&gt;</description><link>http://passion4java.blogspot.com/2009/10/grouping-cool-function-from-regular.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjetSrPQzWTtzUliTwo8TXo6ryhU5my0tr2h0tWAL2K_oedf_lLjKxXTi7sdUIVmXPGYcSc2YXhEGeRZd7gy5JvILLJN7X3LSkYdgE2EyZj_ZZECYEtLQ4TUtbGDIOubnupx02Fya6BRwzf/s72-c/find_Command.JPG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3616017652746096084.post-6435291827268753923</guid><pubDate>Thu, 08 Oct 2009 12:30:00 +0000</pubDate><atom:updated>2009-10-12T12:39:49.019+05:30</atom:updated><title>Easy way to keep your Blog and Twitter up-to-date.</title><description>I was thinking how can I keep my blog and my twitter up-to-date, if I add any new post in my blog and I have to come back to twitter to do the same.&lt;br /&gt;This is a redundant work which I have to do. Today when I was searching in the net found a cool web application which will update your twitter accounts if any update is made in your blogs.&lt;br /&gt;The way it works is it takes your RSS feeds of your blog and understands the updates based on that it updates your twitter account.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://twitterfeed.com"&gt; twitterfeed&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then I added follow me on twitter in blog ;)&lt;br /&gt;Try if you like it :)</description><link>http://passion4java.blogspot.com/2009/10/easy-way-to-keep-your-blog-and-twitter.html</link><author>noreply@blogger.com (Mohammed Yousuff)</author><thr:total>2</thr:total></item></channel></rss>