||Struts 1.x 2.x | Spring | Strips | Wicket | Tapestry | Seam | JSF | RIFE | DWR | DOJO | EXT | Jquery | Json | Prototype | Hibernate | iBatis | web 2.0 | www.siva2baba.com & shivababa@gmail.com
   
  FrameWorks Theater
  WebWork
 


Content


   -->what is Webwork
  --->Key Principles    
  --->Developer point of View
  ---> step by step Develpement
  --->Example program --http://siva2baba.diinoweb.com
Webwork

WebWork is a Java web-application development framework. It is built specifically with developer productivity and code simplicity in mind, providing robust support for building reusable UI templates, such as form controls, UI themes, internationalization, dynamic form parameter mapping to JavaBeans, robust client and server side validation, and much more.

WebWork is a Model-View-Controlled type of framework. This means it separates logic from view and simplifies Web development by using a powerful "action" concept on the server side.

Developer point of View:

       -> "webwork framework littlebit closer to struts 1.x"
        -> "compare struts 1.x and webwork my choice is
             web work"
        -->" strus 1.x + webwork =struts 2.0"
           


Step by step Development:



Webwork

 jars required to set up a WebWork web application

 


xwork.jar- XWork library on which WebWork is built

 commons-logging.jar- Commons logging, which WebWork uses to support transparently logging to
either Log4J or JDK 1.4+

oscore- OSCore, a general-utility library from OpenSymphony

velocity-dep.jar- Velocity library with dependencies

ognl.jar- Object Graph Navigation Language (OGNL), the expression language used

throughout WebWork

 


xml congiguraton Files required to set up a WebWork web application

 

 

xwork.xml-- WebWork configuration file that defines the actions, results, and interceptors

for your application

 

 

web.xml

J2EE web application configuration file that defines the servlets, JSP tag libraries, and so on for your web application

 

 


|---WEB-INF

|---web.xml

|---classes

| |---xwork.xml

  |-- ch2.example1.HelloWorld.java

  |--- webwork.properties

|---lib

| |---webwork-2.1.7.jar, xwork.jar, oscore.jar, ognl.jar, ...

|-hello.jsp

 


You must first add the following entry to web.xml:

<servlet>

<servlet-name>webwork</servlet-name>

<servlet-class>

com.opensymphony.webwork.dispatcher.ServletDispatcher

</servlet-class>

</servlet>

The next step is to map the servlet to a URL pattern. The pattern you choose can

be anything you want, but the most typical pattern is *.action. You can configure

the pattern the servlet will match by adding the following to web.xml:

<servlet-mapping>

<servlet-name>webwork</servlet-name>

<url-pattern>*.action</url-pattern>

</servlet-mapping>

Finally, in order to use WebWork’s tag library, you must add an entry to web.xml

indicating where the tag library definition can be found:1

 

 

<taglib>

<taglib-uri>webwork</taglib-uri>

<taglib-location>/WEB-INF/lib/webwork-2.1.7.jar

</taglib-location>

</taglib>

 

webwork.properties

webwork.objectFactory = spring

webwork.devMode = true

 

Creating the xwork.xml configuration file

 

 

<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN"

"http://www.opensymphony.com/xwork/xwork-1.0.dtd">

<xwork>

<include file="webwork-default.xml"/>

<package name="default" extends="webwork-default">

<default-interceptor-ref name="completeStack"/>

<action name="helloWorld"

class="ch2.example1.HelloWorld">

<result name="success">JspFolde/hello.jsp</result>

</action>

</package>

</xwork>

 

hello.jsp

<%@ taglib prefix="ww" uri="webwork" %>

<html>

<head>

<title>Hello Page</title>

</head>

<body>

The message generated by my first action is:

<ww:property value="message"/>

</body>

</html>

 

HelloWorld.java

package ch2.example1;

import com.opensymphony.xwork.Action;

public class HelloWorld implements Action {

private String message;

public String execute() {

message = "Hello, World!n";

message += "The time is:n";

message += System.currentTimeMillis();

return SUCCESS;

}

public String getMessage() {

return message;

}

}

           

 

 

 

 

 

java org.apache.axis.wsdl.WSDL2Java <URLofWSDL> -p <package_name> -o <DIR>

import java.sql.*;

import java.io.*;

 

class LoadDriver

{

            public static void main(String[] args)

            {

                        try {

                        // The newInstance() call is a work around for some

                        // broken Java implementations

                                    Class.forName("com.mysql.jdbc.Driver").newInstance();

                                    //"jdbc:mysql://localhost:3306/mysql";

                                    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/first","gunjan","gunjan");

                                    // Do something with the Connection

                                    System.out.println("nSucess");

                                   

                                    Statement sel = conn.createStatement();

                                    ResultSet rs = sel.executeQuery("select * from people");

                                   

                                    while(rs.next())

                                    {

                                                System.out.println(rs.getString(1) + " " + rs.getString(2));                       

                                    }

                        }          

                        catch (Exception ex)

                        {

                        ex.printStackTrace();// handle the error

                        }                      

           

            }

}

 
  Today, there have been 2 visitors (10 hits) on this page! www.siva2baba.com & shivababa@gmail.com  
 
=> Do you also want a homepage for free? Then click here! <=
||Struts 1.x 2.x | Spring | Strips | Wicket | Tapestry | Seam | JSF | RIFE | DWR | DOJO | EXT | Jquery | Json | Prototype | Hibernate | iBatis | web 2.0 | http://siva2baba.diinoweb.com/files/ and www.siva2baba.com