Sunday 22 December 2013

Odesk Seo Test Answers 2013-2014



1. Some words, when followed by a colon, have special meanings to yahoo. What is performed by the link:Operator?

a. it shows all the outbound links from the url
b. It shows how many pages of the site yahoo is pointing to
c.It shows all the pages that point to that url
d. It show url's with broken links

answer: C

2. Which blackhat Seo techniques is characterized by a method to deceive search engine, by detecting the search engine bot and "feeding" it with a different HTML code than the HTML actually served to users?

a.Coaling
b.Foisting
c.Slighting
d.Cloaking

answer: D

3. Why is it bad idea from SEO perspective to host free articles and write ups that are very common on the internet?

a.Because they will not lead to fresh traffic
b.Because you could be penalize by search engine for using duplicate contents
c.Because you will not get the benefits of proper keyword targeting
d.because people could turn up claiming copyright infirigement

answer: B

4. What will happen if you type the word 'Certification-Networking' in the google search box?

a.Google will find the web pages about "certification" and also containing the word "networking"
b.Google will find ALL the web pages containing the word word "Certification" and "Networking"
c.Google will find ALL the web pages in which the words "Certification" and "Networking" appear together.
d.Google will find the web pages about Certification that do not contain the word Networking

answer: C

5. Which of the following factors does google take into account while accessing whether or not a website is an authority website?

a. The frequency with which the contents of the website is updated
b. the number of web pages containing relevant information on the main theme of the website
c.The number of in-bound natural links related to the website's theme (or keywords)
d. None of the above

answer: C


6. What is keyword density?

a.The number of times the keyword is used / (divided by) the total word count on page - (minus) the total words in HTML on the page
b.The number of times the keyword is used x (multiply by) the total word count on page.
c.The number of times the keyword is used in the page description
d.The number of times the keyword is used in the page title
e.The number of times the keyword is used / (divided by) the total word count on the page.

answer: E

7. Which of the following statement about FFA pages are true?

a.They are greatly beneficial to SEO
b.They are also called Link Farms
c.They are Paid Listings
d.They contain numerous inbound links

answer: B

8. What is the illegal act of copying of a page by unauthorized parties in order to filter off traffic to another site called?

a.Traffic jacking
b.Visitors Jacking
c.View Jacking
d. Page Jacking

answer: D

9. What is the most likely time period required for getting a google page ranking?

a.1 week
b. 3 weeks
c. 1 month
d. More than 3 months

answer: D

10. Which of the following can be termed as a good keyword selection and placement strategies?

a.Targeting synonyms of the main keyword, A & D
b.Targeting the highest searched keywords only
c.Copying competitor keywords
d.Optimizing 5 or more keywords per page (check)

answer: A

11. Some words, when followed by a colon, have special meanings to yahoo. What is perfermed by the link:Operator?

a. it shows all the outbound links from the url
b. It shows how many pages of the site yahoo is pointing to
c. It shows all the pages that point to that url
d. It show url's with broken links
answer: C

12. Which blackhat Seo techniques is characterized by a method to decieve search engine, by detecting the search engine bot and "feeding" it with a different HTML code than the HTML actually served to users?

a.Coaling
b.Foisting
c.Slighting
d.Cloaking

answer: D

13. Why is it bad idea from SEO perspective to host free articles and write ups that are very common on the internet?

a.Because they will not lead to fresh traffic
b.Because you could be penalize by search engine for using duplicate contents
c.Because you will not get the benefits of proper keyword targeting
d.because people could turn up claiming copyright infirigement

answer: B

14. What will happen if you type the word 'Certification-Networking' in the google search box?

a.Google will find the web pages about "certification" and also containing the word "networking"
b.Google will find ALL the web pages containing the word word "Certification" and "Networking"
c.Google will find ALL the web pages in which the words "Certification" and "Networking" appear together.
d.Google will find the web pages about Certification that do not contain the word Networking

answer: C

15. Which of the following factors does google take into account while accessing whether or not a website is an authority website?

a. The frequency with which the contents of the website is updated
b. the number of web pages containing relevant information on the main theme of the website
c.The number of in-bound natural links related to the website's theme (or keywords)
d. None of the above

answer: C

16. What is keyword density?

a.The number of times the keyword is used / (divided by) the total word count on page - (minus) the total words in HTML on the page
b.The number of times the keyword is used x (multiply by) the total word count on page.
c.The number of times the keyword is used in the page description
d.The number of times the keyword is used in the page title
e.The number of times the keyword is used / (divided by) the total word count on the page.

answer: E

17. Which of the following statement about FFA pages are true?

a.They are greatly beneficial to SEO
b.They are also called Link Farms
c.They are Paid Listings
d.They contain numerous inbound links

answer: B

18. What is the illegal act of copying of a page by unauthorized parties in order to filter off traffic to another site called?

a.Traffic jacking
b.Visitors Jacking
c.View Jacking
d. Page Jacking

answer:D

19. What is the most likely time period required for getting a google page ranking?

a.1 week
b. 3 weeks
c. 1 month
d. More than 3 months

answer: D

20. Which of the following can be termed as a good keyword selection and placement strategies?

a. Targeting synonyms of the main keyword (ans) A & D
b.Targeting the highest searched keywords only
c.Copying competitor keywords
d*Optimizing 5 or more keywords per page (check)

answer: D

21. Google displays up to ------------------------ characters of a web pages title tag

a.56
b.60 * B & C
c.66
d.80

answer: B

22. Which of the following fact about Alexa are correct ?

a.Alexa provides free data on relative website visitors traffic
b. Alexa and Quancast provide information on visitors household income
c.Alexa is baised towards US based traffic
d.Quantcast only track people who have installed the quantcast toolbar

answer: A

23. What is the name of the search engine technology due to which a query for the word "actor" will aslo show search result for related word such as actress, acting or act?

a.Spreading
b.Dilating
c.RSD (real time synonyms detection)
d.Stemming
e.Branching

answer: D

24.Do search engine such as google detect unnatural linking patterns by checking the class C IP address of the page where the link to the website originates

a. Yes
b. No

answer: A

25. Which of the following conditions will google treat favorably from the "Relevancy" perspective.

a.The website offering product and services to the visitors country
b.A website that provides Free content for related keywords
c.Hidden keywords on the homepage matching search term
d.Image alt tag on the homepage matching search term

answer: B

26. Which of the following website design guideline has been recommended by google?

a.Having a clear hierachy and text links
b.Every page should be reachable from atleast one static text link
c.If the sitemap is larger than 100 or so links, you should break the sitemap into separate pages
d.Keep the links on a given page to a reasonable number (fewer than 100)
e. Use less than 30 images or graphics per page

answer: A

27. What is the main reason for the effectiveness of Optimizing a web page towards a long tails keyword search? Recheck

a.There are more long tail searches than shorter keyword queries
b.*Search engine often pass on long tail searches to lesser or new website
c.Search engine do not pass on long tail search traffic to website that rank high for shorter keyword searches (check)
d.There are fewer webvsite that have targeted such keyword's

answer: D

28 Which of the following statement is correct with regard's to the images within a web page?

a.Images can not be spidered by the search engine (check)
b.Important keywords related to the image should be plcaed in the ALT text
c.Images should always be kept close to the top of a web page
d. Image maps should be used while including the images

answer: B

29. What does the 302 server Response Code signify?

a.It signifies conflict, too many people wanting the same file at the same time
b.The page has been permanently removed
c.The method you are using to access the file is not allowed
d.The page has temporarily moved
e.What you requested is just too big to process

answer: D


30. State whether the following statement is true or false. A sitemap provide a list of natural links to user accessible pages on a website

a.True
b.False

answer: B

31.  State whether true or false.
The Yahoo Directory listing is a free service for commercial site?

a.True
b.False

answer: A

Friday 20 December 2013

login example using struts 2 and hibernate with mysql

 CREATE TABLE `login_master` (
  `login_id` int(10) NOT NULL,
  `login_name` varchar(30) NOT NULL,
  `login_password` varchar(30) NOT NULL,
  `hint_password` varchar(50) NOT NULL,
  `temp` varchar(30) NOT NULL,
  PRIMARY KEY  (`login_id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1;

Login.jsp

<%@taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<div id="login">
    <s:form action="Login" id="form1" method="post">
    <h2>
    <p><s:textfield name="username" label="username" id="textfield" /></p>
    <br>
    <p><s:password name="password" label="password" id="textfield2"></s:password></p>
    </h2>
    <s:submit value="Authentification" />
</s:form> <s:if test="hasActionErrors()">
    <s:div id="errror1" cssStyle="color:red ">
        <p><s:actionerror /></p>
        <br>
    </s:div>
</s:if> <br clear="all" /></body>
</html>

struts.xml

<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
  <package name="default" extends="struts-default">
          <action name="Login" class="Action.LoginAction">
            <result name="Home">Login.jsp</result>
            <result name="success">Home.html</result>
            <result name="input">Login.jsp</result>
        </action>
 </package>
</struts>

Action.java

package Action;

import java.util.Map;

import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.SessionAware;

import DAO.Logindao;
import bean.Loginbean;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class LoginAction extends ActionSupport implements ModelDriven<Loginbean>,SessionAware{

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    Logger logger = Logger.getLogger(LoginAction.class);
    Loginbean bean=new Loginbean();
    private Map<String, Object> session = null;
    Logindao dao=new Logindao();
    boolean isValidat;
   
    public String execute()
    {
         if(dao.find(bean.getUsername(),bean.getPassword()))
             
             return "success";
           
         else
            
          this.addActionError("The username or password  is incorrect.");       
           return "Home";
        }
   
    public String Logout()
    {
       
        return "Logout";
    }
   
 public Loginbean getModel()
{
    return bean;
}
public void setSession(Map<String, Object> session) {
    this.session = session;
}
public Map<String, Object> getSession() {
    return session;
}

}





Loginbean.java

package bean;

public class Loginbean {
    private String username;
    private String  password;
   
   
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
}

Logindao.java

package DAO;

import java.util.Iterator;
import java.util.List;
import master.LoginMaster;
import org.hibernate.Query;
import org.hibernate.Session;
import util.HibernateUtil;

public class Logindao{

    Session session;
   
      @SuppressWarnings("unchecked")
       public boolean find(String name, String password) {
          session = HibernateUtil.getSession();                         
 String     SQL_QUERY=  " from LoginMaster u where u.loginName='" + name + "' and u.loginPassword='" + password + "'";
    
                System.out.println(SQL_QUERY);
                Query query = session.createQuery(SQL_QUERY);
                Iterator<LoginMaster> it = query.iterate();
                List<LoginMaster> list = query.list();
                if (list.size() > 0) {
                    session.close();
                    return true;
                }
                session.close();
                return false;
               
        }
}

HibernateUtil.java

package util;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
      private static SessionFactory sessionFactory;
       
        public static void createSessionFactory() {
        sessionFactory = new Configuration().configure().buildSessionFactory();
        System.out.println("Value of sessionFactory is==="+sessionFactory);
        }

        public static Session getSession() {
        return sessionFactory.openSession();
        }

    }

Struts2dispatcher.java

package util;


import javax.servlet.FilterConfig;
import javax.servlet.ServletException;

import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter;
import org.hibernate.HibernateException;
public class Struts2dispatcher extends StrutsPrepareAndExecuteFilter{
   
    public void init(FilterConfig filterConfig) throws ServletException {
    super.init(filterConfig);
    try {
    HibernateUtil.createSessionFactory();
    System.out.println("application initializing successfully");
    } catch (HibernateException e) {
    throw new ServletException(e);
    }

    }
   
}

hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 <hibernate-configuration>
    <session-factory>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:330/LoginMasterdatabase</property>
        <property name="connection.username">root</property>
        <property name="connection.password">root</property>
        <property name="connection.pool_size">1</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="current_session_context_class">thread</property>
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
        <property name="show_sql">true</property>
        <property name="hbm2ddl.auto">validate</property
        <mapping resource="master/LoginMaster.hbm.xml" />
    </session-factory>
</hibernate-configuration>






LoginMaster.java

package master;


/**
 * LoginMaster generated by hbm2java
 */
public class LoginMaster implements java.io.Serializable {

    private int loginId;
    private String loginName;
    private String loginPassword;
    private String hintPassword;
    private String temp;

    public LoginMaster() {
    }

    public LoginMaster(int loginId, String loginName, String loginPassword,
            String hintPassword, String temp) {
        this.loginId = loginId;
        this.loginName = loginName;
        this.loginPassword = loginPassword;
        this.hintPassword = hintPassword;
        this.temp = temp;
    }

    public int getLoginId() {
        return this.loginId;
    }

    public void setLoginId(int loginId) {
        this.loginId = loginId;
    }

    public String getLoginName() {
        return this.loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getLoginPassword() {
        return this.loginPassword;
    }

    public void setLoginPassword(String loginPassword) {
        this.loginPassword = loginPassword;
    }

    public String getHintPassword() {
        return this.hintPassword;
    }

    public void setHintPassword(String hintPassword) {
        this.hintPassword = hintPassword;
    }

    public String getTemp() {
        return this.temp;
    }

    public void setTemp(String temp) {
        this.temp = temp;
    }

}



Thursday 19 December 2013

how to create a simple Gujarati or any language web application in struts2 and hibernate with mysql


 whenever we create a simple jsp page or html file the default char set is 'ISO' like <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
Because it treats English is the standard language for developing a web application.
So in order to make language specific application first we need to change the charset from ex: charset=ISO-8859-1 to charset="UTF-8".

Now I am going to create a simple application having text box is an input field to enter text in any language store it in the database and displays on the same web page.
  
CREATE TABLE `student_master` (
  `student_id` int(20) NOT NULL auto_increment,
  `student_fname` varchar(20) character set utf8 default NULL,
  `student_mname` varchar(30) character set utf8 default NULL,
  `student_lname` varchar(30) character set utf8 default NULL,
  `student_p_add` varchar(70) character set utf8 default NULL,
  `status` tinyint(1) default NULL,
  `temp6` varchar(40) character set utf8 default NULL,
  PRIMARY KEY  (`student_id`)
) ENGINE=MEMORY  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

Studentform.jsp
<%@ page pageEncoding="UTF-8"%>

<%@taglib uri="/struts-tags" prefix="s"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<!doctype html>
<html lang="en">

<head>
    <meta http-equiv="Content-Language" content="hi">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
 <header> <h3>વિદ્યાર્થી રજીસ્ટ્રેશન ફોર્મ</h3> </header>
<div id="tablesorter" style="font-style:inherit;font-size:15px;font-variant:inherit;font-style: inherit;font-weight: normal;color:#2C333D;background-color: #E5E5E5 ">
<center>   
<s:form action="addStudent!addStudentdata.action"name="student" enctype="multipart/form-data"  >
<table>
 <tr>
 <td align="left">
            <s:textfield name="FirstName" label="નામ"  size="25" id="my"/>   
</td>
<td align="right" colspan="1">     
            <s:textfield name="MiddleName" label="પિતા / પતિ નામ"  id="target" id="my"></s:textfield>
</td>
</tr>
<tr>
      <td>
            <s:textfield name="LastName" label="અટક" id="my"></s:textfield>
     
      </td>
     
</tr>
      <tr>
      <td> 


      <s:textfield name="permanentAddress"label="કાયમી સરનામું" id="my"/>
      </td>
      </tr>
     
      <tr align="left">
            <td height="" colspan="2" align="left">
     
      <s:textfield name="Phonenumber"     label="ફોન નંબર" id="my"></s:textfield>
      </td>
      </tr>
     
      <tr align="center">
            <td height="47" colspan="2" align="center">
            <s:submit value="સાચવો" name="userSave" theme="simple" id="colorsubmit"></s:submit>
            <s:submit id="colorsubmit" value="રદ કરો" theme="simple"/>

              </td>
            </tr>
     
</table>

</s:form>
</center>
</div>

</body>
</html>

Now I have defined the charset is "UTF-8" which is essential for any language.Now the form tag contains one text box to enter text.We need to define a accept-charset attribute of form tag to "UTF-8" to send the request to server in hindi language.
Now if the method attribute of form tag is "Get" then we need to specify request.setCharacterEncoding("UTF-8") in our Action class. and If we are using "POST" method means request is in the body then we need to add the attribute URIEncoding="UTF-8" in the server.xml file of tomcat which is in the conf directory.
for Ex:

 <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8" />

struts.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
<struts>
 <package name="default" extends="struts-default">
            <action name="addStudent" class="Action.StudentAction">
                  <result name="Home">studentregistration.jsp</result>
                  <result name="success">studentview.jsp</result>
            </action>
      </package>
</struts>
StudentAction.java

package Action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionMessages;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;

import service.studentservice;
import master.StudentMaster;

import DAO.studentdao;
import bean.StudentBean;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class StudentAction  extends ActionSupport implements ModelDriven<StudentBean>,ServletRequestAware,SessionAware {

            boolean insert = false;
            StudentBean sbean=new StudentBean();
            studentdao sdao=new studentdao();
            StudentMaster studentmaster=new StudentMaster();
            List<StudentMaster> liststudent;
            private Map<String, Object> ses;
            HttpServletRequest request;
            boolean isinsert=false;
            Logger logger = Logger.getLogger(StudentAction.class);

            public String addStudentdata()throws Exception{
                 
           
                  System.out.println("Inside addStudent()....");
           
                  try{
                         isinsert = studentservice.addstudent(sbean);
                        if(isinsert){
                  addActionMessage("Student details add successfully");                         getStudentList();
                        }
                        else{
                              addActionError("error:001");
                        }
                  }catch (Exception e) {
                        e.printStackTrace();
                  }
            return "success";
      }
           
            public String getStudentList()throws Exception{
                 
                  try {      
                        liststudent = sdao.getstudent();
                        ses.put("liststudent",liststudent);            
                  } catch (Exception e) {
                        e.printStackTrace();
                  }
                  return "view";
            }
            public StudentBean getModel() {
                  // TODO Auto-generated method stub
                  return sbean;
            }
            public void setServletRequest(HttpServletRequest req) {
                  // TODO Auto-generated method stub
                  this.request=req;
            }
            public void setSession(Map<String, Object> ses) {
                  // TODO Auto-generated method stub
                  this.ses=ses;
            }

            public HttpServletRequest getHttpServletRequest() {
                  return request;
            }


            public Map<String, Object> getSes() {
                  return ses;
            }
      }
StudentBean.java

package bean;

import java.util.Date;

public class StudentBean  implements java.io.Serializable{
      /**
       *
       */
      private static final long serialVersionUID = 1L;
      private String studid;
      private int studentid;
      private String FirstName;
      private String MiddleName;   
      private String LastName;
      private String Phonenumber;
      private String permanentAddress;
     
     
      public String getMotherName() {
            return MotherName;
      }
      public void setMotherName(String motherName) {
            MotherName = motherName;
      }
      public String getPhonenumber() {
            return Phonenumber;
      }
      public void setPhonenumber(String phonenumber) {
            Phonenumber = phonenumber;
      }
     
      public String getFirstName() {
            return FirstName;
      }
      public void setFirstName(String firstName) {
            FirstName = firstName;
      }
      public String getMiddleName() {
            return MiddleName;
      }
      public void setMiddleName(String middleName) {
            MiddleName = middleName;
      }
      public String getLastName() {
            return LastName;
      }
      public void setLastName(String lastName) {
            LastName = lastName;
      }
      public String getPermanentAddress() {
            return permanentAddress;
      }
      public void setPermanentAddress(String permanentAddress) {
            this.permanentAddress = permanentAddress;
      }
      public String getFatherName() {
            return FatherName;
      }
      public void setFatherName(String fatherName) {
            FatherName = fatherName;
      }
      }
}

studentservice.java

package service;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import DAO.studentdao;
import bean.StudentBean;

import master.StudentMaster;

public class studentservice implements SessionAware {
     
       Map<String,Object> ses;
     
      public static boolean addstudent(StudentBean b) {
            // TODO Auto-generated method stub
            StudentMaster sm=new StudentMaster();
            studentdao dao=new studentdao();
            boolean add=false;
            try{
                  sm.setStudentFname(b.getFirstName());
                  sm.setStudentMname(b.getMiddleName());
                  sm.setStudentLname(b.getLastName());
                  sm.setStudentBdate(b.getBirthDate());
                  sm.setStatus(true);
                  sm.setStudentPAdd(b.getPermanentAddress());
                  add=dao.addstudent(sm);
            } catch (Exception e) {
                  e.printStackTrace();
            }
            return add;
            }    
      public void setSession(Map<String, Object> session) {
            // TODO Auto-generated method stub
            this.ses=session;
      }

}
studentdao.java  
package DAO;
import java.util.List;
import java.util.Map;

import org.hibernate.Query;
import org.hibernate.Session;

import util.HibernateUtil;
import master.StudentMaster;

import bean.StudentBean;

public class studentdao {

      Session session;
      public String date;

      public boolean addstudent(StudentMaster studentmaster)
      {
            boolean isInserted = false;
            try
            {
                  session = HibernateUtil.getSession();
                  session.beginTransaction();
                  session.save(studentmaster);
                  session.getTransaction().commit();
                  session.flush();
                  session.close();
                  session = null;
                  isInserted = true;
            }
            catch (Exception e)
            {
                  e.printStackTrace();
            }
            return isInserted;
      }

      @SuppressWarnings("unchecked")
      public List<StudentMaster> getstudent() {
            // TODO Auto-generated method stub
            List<StudentMaster>list = null;
            try {
                  session = HibernateUtil.getSession();
                  session.beginTransaction();
                  session.getTransaction().commit();
                  Query query = session.createQuery(" from StudentMaster");
                  list = query.list();
                  System.out.println("You Now in Student List");
                  System.out.println("List Size : "+list.size());
                  session.flush();
            } catch (Exception e) {
                  e.printStackTrace();
            }
            return list;
           
      }    
}

studentview.jsp

<%@ page pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8" />
</head>

<body>
<header>
<h3>વિદ્યાર્થી માહિતી</h3>
</header>
<table>
      <s:form action="addStudent!getStudentList.action" id="studentview" name="studentview">
      <display:table id="liststud" list="${liststudent}" width="80%" border="1" pagesize="8" class="">
            <s:hidden name="liststud.studentId" key="studentId" value="%{liststud.studentId}"/>      
                  <display:column title="નંબર"><%=liststud_rowNum%></display:column>
                 
                  <display:column title="નામ" property="studentFname"></display:column>
                  <display:column title="પિતા / પતિ નામ" property="studentMname"></display:column>
                  <display:column title="અટક" property="studentLname"></display:column>
                  <display:column title="કાયમી સરનામું" property="studentPAdd"></display:column>
                  <display:column title="Action">
                  <img src="images/icn_edit.png" id="colorsubmit" onclick="javascript:updateStudent(${liststud.studentId})"></img>
                  &nbsp; &nbsp;
                  <img src="" onclick=""></img>
                  </display:column>

            </display:table>
      </s:form>
</table>
</body>
</html>

Next step is store the value taken from the form onto the hibernate.
Now in the hibernate.cfg.xml if we are using JNDI as a datasource then we have to do some changes in the context.xml of tomcat which is in the conf directory.
Like

<Resource name="jndi_ialds" auth="Container" type="javax.sql.DataSource" removeAbandoned="true"
                                    removeAbandonedTimeout="60" logAbandoned="true"
              maxActive="100" maxIdle="30" maxWait="10000"
               username="root" password="" driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost/dbname?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf8"/>


and if we are using a driver class in the hibernate.cfg.xml file the we add to property in our hibernate.cfg.xml file like:

<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>

Now after following these simple steps we can inset or display the Gujarati text.