A Techno Blog, mainly about Java

Trying out Webworks

I have been reading up about Struts 2.

I figured checking out the webworks framework first might be a good idea.


Config Files –

C:\java\webworks\webwork-2.2.2\webapps>ant build -Dwebapp=shopping-cart
Buildfile: build.xml

   [delete] Deleting directory C:\java\webworks\webwork-2.2.2\webapps\tmp
    [mkdir] Created dir: C:\java\webworks\webwork-2.2.2\webapps\tmp
     [copy] Copying 58 files to C:\java\webworks\webwork-2.2.2\webapps\tmp
    [javac] Compiling 13 source files to C:\java\webworks\webwork-2.2.2\webapps\
     [copy] Copying 1 file to C:\java\webworks\webwork-2.2.2\webapps\tmp\WEB-INF
      [war] Building war: C:\java\webworks\webwork-2.2.2\webapps\dist\shopping-c
      [war] Warning: selected war files include a WEB-INF/web.xml which will be
ignored (please use webxml attribute to war task)


copy C:\java\webworks\webwork-2.2.2\webapps\dis
t\shopping-cart.war c:\java\apache-tomcat-5.5.17\webapps\

http://localhost:8080/shopping-cart/ has a basic Webworks example (WAR).

Snippet from xworks.xml:

<default-interceptor-ref name="paramsPrepareParamsStack"/>
        <action name="index" class="net.vaultnet.learn.action.EmployeeAction" method="list">
            <result name="success">/jsp/employees.jsp</result>
            <!– we don’t need the full stack here –>
            <interceptor-ref name="basicStack"/>
        <action name="crud" class="net.vaultnet.learn.action.EmployeeAction" method="input">
            <result name="success" type="redirect-action">index</result>
            <result name="input">/jsp/employeeForm.jsp</result>
            <result name="error">/jsp/error.jsp</result>

  1. ActionMapper – mapping between HTTP requests and action invocation requests and
    vice-versa; may return null if no action invocation request maps,
    or it may return an ActionMapping.
  2. Filter Dispatcher (com.opensymphony.webwork.dispatcher.FilterDispatcher) – filter and its mapping are located in web.xml and defines what requests will be intercepted. Before executing an Action, it loooks through stack of interceptors.

    Webworks Interceptors (defined in webwork-default.xml)can be invoked before and after your action is executed. paramsPrepareParamsStack- This is useful for when you wish to apply parameters directly to an object that you wish to load externally.

  3. <%@ taglib prefix="ww" uri="/webwork" %> : access to the tag library

November 18, 2006 - Posted by | Struts

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: