Yesterday when I was on Google searching for something I found that Apache had released the latest Struts 2 version which is Struts 2.1.2, and promoted to "Beta" on 26 March 2008
You can download it from Struts Download Page
Wednesday, July 9, 2008
Monday, July 7, 2008
Struts 2 Hello World Example
I had seen many new deveopers struggling against struts2 hello world example. So I decided to write a small example.
Below are the required libraries to run this example which are easily availabel
struts2-core-2.0.11
xwork-2.0.4
commons-logging-1.0.4
commons-logging-api-1.1
freemarker-2.3.8
ognl-2.6.11
The structure of the applictaion which I am following is (Eclipse IDE)
Struts2Demo
|---src
| |----org
| | |----vinod
| | | |----action
| | | | |----HelloWorld।java
|---struts.xml
|---WebContent
| |---jsp
| |---HelloWorld।jsp
|---index.jsp
|---WEB-INF
| |---lib
| |---web.xml
It is true that different IDE's use different structure, but at last when war is build they follow same structure.
Lets start...
HelloWorld.java
I had also written some more examples and some solutions of struts which can be easily found at
Struts 2 ajax drop down example
Struts 2 change <actionerror /> <actionmessage />
Struts 2 Session Check Interceptor
About Struts 2
Below are the required libraries to run this example which are easily availabel
struts2-core-2.0.11
xwork-2.0.4
commons-logging-1.0.4
commons-logging-api-1.1
freemarker-2.3.8
ognl-2.6.11
The structure of the applictaion which I am following is (Eclipse IDE)
Struts2Demo
|---src
| |----org
| | |----vinod
| | | |----action
| | | | |----HelloWorld।java
|---struts.xml
|---WebContent
| |---jsp
| |---HelloWorld।jsp
|---index.jsp
|---WEB-INF
| |---lib
| |---web.xml
It is true that different IDE's use different structure, but at last when war is build they follow same structure.
Lets start...
HelloWorld.java
package org.vinod.action;HelloWorld.jsp
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport{
String greetings = null;
public String execute() throws Exception {
setGreetings("Hello World");
return SUCCESS;
}
/**
* @return the greetings
*/
public String getGreetings() {
return greetings;
}
/**
* @param greetings the greetings to set
*/
public void setGreetings(String greetings) {
this.greetings = greetings;
}
}
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"index.jsp
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Struts 2 Example</title>
</head>
<body>
<s:property value="greetings"/>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"struts.xml
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Struts 2 Example</title>
</head>
<body>
<s:action name="HelloWorldAction" executeResult="true"></s:action>
</body>
</html>
<!DOCTYPE struts PUBLICweb.xml
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="hello" extends="struts-default">
<action name="HelloWorldAction"
class="org.vinod.action.HelloWorld">
<result>/jsp/HelloWorld.jsp</result>
</action>
</package>
</struts>
<?xml version="1.0" encoding="UTF-8"?>Enjoy the struts2(most popular java framework today)
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
I had also written some more examples and some solutions of struts which can be easily found at
Struts 2 ajax drop down example
Struts 2 change <actionerror /> <actionmessage />
Struts 2 Session Check Interceptor
About Struts 2
Labels:
struts2,
struts2 hello world example
Friday, July 4, 2008
Java Code Names
Yesterday I was crawling web and found some intersting things about java. Firstly when java was release its name is Oak. After some time the creator of java found the name Java.
I found some of the intersting things like the code names of the reeases of the java which I am going to describe below.
VERSION CODE NAME RELEASE DATE
You can these names on the sun website.
Here is the brief history of java. Some of you wanted to know that how many packages are there in java when it is officially released well here are the some facts.
Java 1.0 - 212 classes in 8 packages
Java 1.1 - 503 classes in 23 packages
Java 1.2/2.0 - 1,520 classes in 59 packages
Java 1.3 - 1842 classes in 76 packages
Java1.4 - 2991 classes in 135 packages
Java 5.0 - 3562 classes in 166 packages
Labels:
java,
java code name
Subscribe to:
Posts (Atom)

















