what is difference between Collection and Collections?


Collection:
Collection is an interface which can be used to represent a group of individual objects as a single entity.
Collections:
Collections is an utility class to define several utility methods for collection objects.

Collection Framework interfaces in java


Collection Framework interfaces are

1.java.util.Collection(1.2v)
2.java.util.List(1.2v)
3.java.util.Set(1.2v)
4.java.util.SortedSet(1.2v)
5.java.util.NavigableSet(1.6v)
6.java.util.Queue(1.5v)
7.java.util.Map(1.2v)
8.java.util.SortedMap(1.2v)
9.java.util.NavigableMap(1.6v)

How to increase heap size in jvm?


It depends upon the application.
If you are running your java code from command line by using java executable,

then you can simply pass these parameters as arguments to java executable.
Code Snippet:
java -Xms256m -Xmx2096m

-Xms        set initial Java heap size
-Xmx<size>        set maximum Java heap size
-Xss<size>          set java thread stack size
By using the above code we can change the heap size

Example:
java -Xms256m -Xmx2096m StringDemo

Struts BasicStrutsApplication Example By Using MyEclipse


Directory Structure for BasicStrutsApplication:

Capture

// LoginAction.java

package com.chennarapu.action;

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;

import com.chennarapu.form.LoginForm;

public class LoginAction extends Action {

      public ActionForward execute(ActionMapping mapping, ActionForm form,

                  HttpServletRequest request, HttpServletResponse response) {

            LoginForm LoginForm = (LoginForm) form;

            return mapping.findForward(“success”);

      }

}

// LoginForm.java

package com.chennarapu.form;

import org.apache.struts.action.ActionForm;

public class LoginForm extends ActionForm {

      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;

      }

}

// struts-config.xml

<?xml version=“1.0” encoding=“UTF-8”?>

<!–DOCTYPE struts-config PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 1.2//EN” “http://struts.apache.org/dtds/struts-config_1_2.dtd”&gt;

<struts-config>

      <form-beans>

            <form-bean name=“LoginForm” type=“com.javaflow.form.LoginForm” />

      </form-beans>

      <action-mappings>

            <action attribute=“LoginForm” input=“/login.jsp” name=“LoginForm”

                  path=“/LoginAction” scope=“request” type=“com.javaflow.action.LoginAction”>

                  <forward name=“success” path=“/success.jsp” />

            </action>

      </action-mappings>

</struts-config>

// index.jsp

<%@ page language=“java” import=“java.util.*” pageEncoding=“ISO-8859-1”%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;

%>

<!–DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>

<html>

          <center>

                 <body>

                       This is my Login page. <br>

              </body>

       </center>

</html>

// login.jsp

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

<%@ taglib uri=http://struts.apache.org/tags-bean&#8221; prefix=“bean”%>

<%@ taglib uri=http://struts.apache.org/tags-html&#8221; prefix=“html”%>

<html>

      <head>

            <title>LoginForm </title>

      </head>

      <body>

            <html:form action=“/LoginAction”>

                  userName : <html:text property=“userName”/><html:errors property=“userName”/><br/>

                  password : <html:text property=“password”/><html:errors property=“password”/><br/>

                  <html:submit/><html:cancel/>

            </html:form>

      </body>

</html>

// success.jsp

Login Successfully