Friday, February 11, 2011

Happy Journey to Thirupathi

I had a wonderful to Thirupathi on from December 23th to December 27th 2010 with my colleagues. We have started the journey on 23rd Dec 2010 evening at Kachiguda railway station Hyderabad @ 6.30 pm. We have directly reached to Kachiguda railway station from my office and we have cached the train on time. We have reached Thirupathi on next day morning almost @ 9.00 am. After successful completion of daily chores, we have started walking towards Thirulama seven hills from Alipiri. 

Photo taken at Alipiri while starting the walk towards Thirumala

We had lot of enjoyment while going from Alipiri to Thirumala and there is lot of places to see when we by steps which were 3500 and it’s a 14 km journey. We have completed the Darshan 10 pm in the evening and we reached the guest house and took rest.

In the early morning of the next day, we have started the journey to Kanchipuram, which also called as kanchi, which is in Tamilanadu and it was 4 hoours journey from Thirupathi. If I get a chance to say about Kanchi, I will say that “It’s a God’s Place”. We have visited Vishnu Kanchi, Shivha Kanchi and Kanchi Kamakshi temples on that day. The sculpture of the temples is superb and it’s very old. In the night 10 pm we have completed the darashans in Kanchi and We have started the journey to Vellore which also present in the Tamilanadu.

Photo taken an Vishnu Kanchi inside the temple

We have reached Vellore at 1 pm in the night, so we have taken the lodge to stay there and in the early morning we have started the journey to Golden Temple. It was the Great temple which ever saw in my life. It’s full of gold the lord Narayani in located in the temple. Our 2 eyes not sufficient to see the temple an the location of the temple is too good and it’s full of green.

Place at Vishnu Kanchi

After completion of Darshan in Vellore we came to Srikalahasthi which is very near Thirupathi and we completed the darshan @ 7 pm and we have reached the Renigunta railway station at 8pm and we have also reached Hyderabad at 8.30 on 27th dec 2010.

I had a great journey with my colleagues and I hope every should have such a great journey.

Struts Options Selection Example

Web.xml :

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                         "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
 <display-name>Smaple</display-name>
 <servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/struts-config.xml</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
 <taglib>
  <taglib-uri>/WEB-INF/struts-bean</taglib-uri>
  <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/struts-logic</taglib-uri>
  <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/struts-html</taglib-uri>
  <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
 </taglib>
 <login-config>
  <auth-method>BASIC</auth-method>
 </login-config>
</web-app>


struts-config.xml :
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
                               "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
 <data-sources/>
 <form-beans>
  <form-bean name="OPSFormBean" type="com.test.OptionsSelectionFormBean"/>
 </form-beans>
 <global-exceptions/>
 <global-forwards>
  <forward name="error" path="/error.jsp"/>
 </global-forwards>
 <action-mappings>
  <action name="OPSFormBean" path="/optionsSelection" scope="request" type="com.test.OptionsSelectionExampleAction">
       <forward name="success" path="/optionsCollectionExample.jsp"/>
  </action>
 </action-mappings>
 <controller/>
 <message-resources parameter="com/test/ApplicationResource"/>
 <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  <set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
 </plug-in>
</struts-config>

index.jsp :
<%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean" prefix="bean" %>

<jsp:forward page="optionsSelection.do"></jsp:forward>

optionsCollectionExample.jsp :

<%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean" prefix="bean" %>

<html>
<head>
<title>Options Collection Example</title>
</head>
<body>
<html:form action="/optionsSelection">
    <h4>Simple use of <html:optionsCollection> Tag</h4>
    <html:select property="selectedItem">
    <html:option value="Test">Select</html:option>
        <html:optionsCollection property="customers" label="name" value="id"></html:optionsCollection>
    </html:select>
    <html:submit />
</html:form>
</body>
</html>


OptionsSelectionExampleAction.java :
package com.test;

import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class OptionsSelectionExampleAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        System.out.println("This is Action Classs........................... ");
        OptionsSelectionFormBean exampleForm = (OptionsSelectionFormBean) form;

        // define a dummy collection
        Collection customers = new ArrayList();
        customers.add(new Customer(1, "Raju"));
        customers.add(new Customer(2, "Rani"));
        customers.add(new Customer(3, "Banu"));
        exampleForm.setCustomers(customers);

        // set the collection in the request
        request.setAttribute("customers", customers);

        return mapping.findForward("success");
    }
}

OptionsSelectionFormBean.java :
package com.test;

import java.util.Collection;

import org.apache.struts.action.ActionForm;

public class OptionsSelectionFormBean extends ActionForm {
    private String selectedItem;
    private Collection customers;
  

    public String getSelectedItem() {
        return selectedItem;
    }

    public void setSelectedItem(String selectedItem) {
        this.selectedItem = selectedItem;
    }

    public Collection getCustomers() {
        return customers;
    }

    public void setCustomers(Collection customers) {
        this.customers = customers;
    }
}


Customer.java :
package com.test;

public class Customer {
    private int id;
    private String name;

    public Customer() {
    }

    public Customer(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLabel() {
        return this.name;
    }

    public int getValue() {
        return this.id;
    }
}

Ajax Check Box Check Uncheck Example

ajaxSample.jsp :
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean" prefix="bean" %>
<html>
<head>
<script type="text/javascript">
function showHint()
{
var xmlhttp;
var str = document.getElementById("checkBox").checked;
var temp;
if(str){
    temp = "Checked"
}else{
    temp = "Un Checked";
}

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ajaxResponse.jsp?param="+temp,true);
xmlhttp.send();
}
</script>
</head>
<body onload="showHint()">
<h1>Ajax Check Box Check Un Check Example</h1>
<input type="checkBox" id="checkBox" name="checkBox" value="checked" onclick="showHint()"/> <span id="txtHint"></span>

</body>
</html>


ajaxResponse.jsp :

<%out.println(request.getParameter("param"));%>