TechnoBuzz

A Techno Blog, mainly about Java

links for 2006-11-30

November 29, 2006 Posted by | Uncategorized | Leave a comment

EL

jstl provides use of the EL.

JSP 2.0 includes EL (Expression language) : "Personally I use the EL
extensively in all my JSP projects and I’ll never go back to custom tags or
scriptlets for showing the value of a request-scoped variable."
http://weblogs.java.net/blog/jfalkner/archive/2003/10/blarg_3_about_t.html

November 28, 2006 Posted by | Web Design | Leave a comment

links for 2006-11-27

November 26, 2006 Posted by | Uncategorized | Leave a comment

Struts2 Samples

I downloaded Struts2 (2.0.1) for first time after experimenting with webworks.

My experience at this point with struts2/webworks is limited.

I figured I would start from scratch rather than migrating some old code.

C:\java\struts2\struts-2.0.1\apps
The sample apps they have are
struts2-blank-2.0.1.war
struts2-mailreader-2.0.1.war
struts2-portlet-2.0.1.war
struts2-showcase-2.0.1.war

User List

Contents of  struts2-blank-2.0.1 war (folders in bold):

src
example
— ExampleSupport.java:    ExampleSupport extends com.opensymphony.xwork2.ActionSupport
— HelloWorld.java: HelloWorld extends ExampleSupport
– struts.properties: struts.devMode = true
                                  struts.enable.DynamicMethodInvocation = false

– struts.xml:  <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
                     "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
                   
… <include file="example.xml"/>

– example.xml: <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
                     "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
                   
<package name="example" namespace="/example" extends="struts-default">
                        

<action name="HelloWorld" class="example.HelloWorld">
                            <result>/example/HelloWorld.jsp</result>
                        </action>
                       <action name="Login!*" method="{1}" class="example.Login">
                            <result name="input">/example/Login.jsp</result>
                           <result type="redirect-action">Menu</result>
                      </action>
                      <action name="*" class="example.ExampleSupport">
                            <result>/example/{1}.jsp</result>
                    </action>
WebContent
WEB-INF

-lib

— commons-collections-3.1

— freemarker-2.3.4

— spring-aop-1.2.8

— spring-context-1.2.8

— spring-web-1.2.8

— struts2-core-2.0.1

— commons-logging-1.0.4

— ognl-2.6.7

— spring-beans-1.2.8

— spring-core-1.2.8

— struts2-api-2.0.1

— xwork-2.0-beta-1
example

The Struts 2  home page states the Struts 2 requires  Java 5. However, an alternate set of jars for  Java 1.4.x are available.  The challenge here is for people using Java 1.4.X is that the sample apps  come with the Java 5 jars.The java 4 jars can be found here.  I extracted them to here:

C:\java\struts2\struts-2.0.1\j4\

But, the only file I needed from here was struts2-extras-j4-2.0.0.jar .

copy C:\java\struts2\struts-2.0.1\j4\struts2-extras-j4-2.0.0.jar
C:\java\eclipse\workspace\struts2-blank-2.0.1\WebContent\WEB-INF\lib

as I got the backport files from the nightlies:

http://people.apache.org/builds/jakarta-struts/nightlies/2.0.x/java-1.4/backport/

which i copied to

C:\java\eclipse\workspace\struts2-blank-2.0.1\WebContent\WEB-INF\lib

Then i modified the translate.bat as follows:

java -jar retrotranslator-transformer-1.0.8.jar -srcjar struts2-core-2.0.1.jar -destjar struts2-core-j4-2.0.1.jar
java -jar retrotranslator-transformer-1.0.8.jar -srcjar struts2-api-2.0.1.jar -destjar struts2-api-j4-2.0.1.jar 
java -jar retrotranslator-transformer-1.0.8.jar -srcjar xwork-2.0-beta-1 -destjar xwork-2.0-j4.jar

The key thing is after the translate takes place to remove the following files:

  • struts2-core-2.0.1.jar
  • struts2-api-2.0.1.jar
  • xwork-2.0-beta-1

Again, a Java 5 version of struts2-extras-j4-2.0.0.jar was not in the struts2-blank-2.0.1 war.
In Summary, my lib folder contains the following jars for 1.4.x:

— commons-collections-3.1
—commons-beanutils-1.6
— commons-digester-1.6
— commons-logging-1.0.4

— freemarker-2.3.4

— spring-aop-1.2.8

— spring-context-1.2.8

— spring-web-1.2.8

— retrotranslator-runtime-1.0.8
— retrotranslator-transformer-1.0.8

— ognl-2.6.7

— spring-beans-1.2.8

— spring-core-1.2.8

— struts2-core-j4-2.0.1

— struts2-api-j4-2.0.1

— xwork-2.0-j4
—struts2-extras-j4-2.0.0
— backport-util-concurrent
— translate.bat

Refer to this issue here

November 24, 2006 Posted by | Struts | Leave a comment

links for 2006-11-23

November 22, 2006 Posted by | Uncategorized | Leave a comment

Apache

I just downloaded the Apache Server on Windows which I have done a while ago alongside IBM’s websphere where they call it Http Server.

I ran the download program that pretty much self installs it. The executable for the Server can be found  here
C:\Program Files\Apache Software Foundation\Apache2.2\bin

It appears a bunch of the configuration for server can be found here

C:\Program Files\Apache Software Foundation\Apache2.2\conf

httpd.txt: This is the main Apache HTTP server configuration file.  It contains the
configuration directives that give the server its instructions.

Documentation gives details on the meaning of the information in the config file.

November 21, 2006 Posted by | SW Tools, Web Design | Leave a comment

links for 2006-11-20

November 19, 2006 Posted by | Uncategorized | Leave a comment

Football Weekend

MITCH ALBOM on Bo: A true Blue legend

Should Mike Shula be shown the door? or what about Chuck?

The Miami Dolphins Phinsider is here.

November 18, 2006 Posted by | Sports | Leave a comment

Trying out Webworks

I have been reading up about Struts 2.

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

API – http://www.opensymphony.com/webwork/api/allclasses-frame.html

Config Files – http://wiki.opensymphony.com/display/WW/Configuration+Files

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

build:
   [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\
tmp\WEB-INF\classes
     [copy] Copying 1 file to C:\java\webworks\webwork-2.2.2\webapps\tmp\WEB-INF
\classes
      [war] Building war: C:\java\webworks\webwork-2.2.2\webapps\dist\shopping-c
art.war
      [war] Warning: selected war files include a WEB-INF/web.xml which will be
ignored (please use webxml attribute to war task)

BUILD SUCCESSFUL

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/

learntechnology.net 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>
        <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>
        </action>

  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 | Leave a comment

links for 2006-11-18

November 17, 2006 Posted by | Uncategorized | Leave a comment

web 2.0 to 3.0

November 14, 2006 Posted by | Uncategorized | Leave a comment

Its a Tech Tuesday

After being a fan of Flickr for quite a while, and learning of the background of this product, i finally signed up for my own account . Thus, I am ready for the intro , should i be worried?

Another tool of note I enjoy is ITunes, not to be confused with M$FT ‘s Zune . I have not had this experinece with it. Here is one tip that I probably wont try,  as I am more interested in setting up my playlists, as I have plenty of Podcasts on my  player I listen to these but have not had a use for any .Podcast Tools or lessons on how to podcast . Listening to podcasts  via a phone.

Update: Why Microsoft’s Zune music player has little or no chance of denting Apple’s iPod juggernaut [more]

November 14, 2006 Posted by | Web/Tech | Leave a comment

Its here: Sun’s Java Platform on Open Source

OPEN JDK:"Santa Clara-based Sun said it is making nearly all of Java’s source
code — excluding small pockets of code that aren’t owned by Sun —
available under the GNU General Public License. The same type of
license also covers the distribution of the core, or kernel, of the
popular open-source operating system Linux" [q&a]

Why its good : "Java under the GPL means that they can now much more readily cross-leverage each other"

Sutor: "The most widely used license is the GNU General Public License (GPL).
While it is hard to quantify, it appears likely that approximately 70%
of all open source projects use the GPL. Code that uses the GPL is
referred to as “free software.”By its nature, the GPL makes new code that incorporates older GPLed
code also use the GPL. That is, the GPL is somewhat self-propagating as
code that uses it is picked up and re-used elsewhere. This is exactly
as the authors intended.The GNU/Linux operating systems use the GPL. You cannot charge
others for a license to use GPLed software and you must make your
source code available.

Another commonly used license is from the Apache Software
Foundation
. This is an open source license that does allow direct use
of the source code within commercial products. Unlike the GPL, the Apache License
allows “defensive termination”: if you sue someone because you claim
that the software infringes on one of your patents, then you lose the
right to freely use the patents of others that are implemented in the
software.

In other words, you stop having the right to use the software if you
are trying to stop others from using it. Much of the open source
software that implements the standards of the World Wide Web is covered
under the Apache license."

freeopen-vs-closed-software

Details of what is available:

The first pieces of source code are available today:

   

* Java HotSpot technology (JVM)
   
* Java programming language compiler (javac)
   
* JavaHelp software
   
* Sun’s feature phone Java ME implementation
* Java ME testing and compatibility kit framework

Later in 2006, Sun will release these pieces:

   

* An advanced operating system phone implementation
   
* The framework for the Java Device Test Suite

Finally, in the first quarter of 2007 the move to free software will be completed as Sun provides these pieces under the GPL:

   

* A buildable Java SE Development Kit (JDK)
   
* Project GlassFish (in addition to CDDL)

Duke  Open Sourced.

IBM’s take is one of dissapointment  but one    opinion: "What IBM holds back for its clients only gives it an advantage over
everyone else, especially among the large accounts that can afford its
overhead.The Apache license accepts this reality. The GPL does not. Behind
IBM’s mild complaint is a scream of pain, an acknowledgement that Sun
has cleverly kicked it in the shins."

 

November 13, 2006 Posted by | J2EE | Leave a comment

web 2.0 one year later

about this time last year I started exploring the buzz word web 2.0

the Web 2.0 Summit was just held this past week [pod].

Now there is talk of the Web 3.0  : "Back to Web 3.0. There will be one, and it has been associated at this point with concepts of the semantic Web". 

Nova Spivack defined the semantic Web

The Semantic Web is a set of technologies which are
designed to enable a particular vision for the future of the Web – a
future in which all knowledge exists on the Web in a format that
software applications can understand and reason about. By making
knowledge more accessible to software, software will essentially become
able to understand knowledge, think about knowledge, and create new
knowledge. In other words, software will be able to be more intelligent
– not as intelligent as humans perhaps, but more intelligent than say,
your word processor is today.

The blog readwriteweb.com had a nice  web2.0 roundup :

web 2.0 vs 1.0

Here is a link to many of the web 2.0 tools .

I personally like netvibes.com a whole lot.


November 13, 2006 Posted by | Web/Tech | Leave a comment

google code search

in google i put: pserver:guest@cvs.dev.java.net: /cvs dwr

which gave me this url

cvs.dev.java.net/cvs/dwrApacheJavaMore from dwr »

November 11, 2006 Posted by | Open Source | Leave a comment

AJAX Roundup

AJAX: It enhances user interaction by targeting updates from the server
to specific areas of the web page, known as "In-page replacement" . DWR is easy AJAX for Java

Introduction where I learned of Jesse James Garrett  from  web site Adaptivepath.com is the person who is behind the technology.

AJAX w Java

Google Maps mania

AJAXIAN

Relevance has Demo from Ajax presentation at Java in Action .

Sun Tip on AJAX

AJAX Talk notes

Eclipse AJAX Toolkit Framework project

Paul Graham : "Basically, what "Ajax" means is "Javascript now works." And that in turn means
that web-based applications can now be made to work much more like desktop ones.

Similarly, RMH tunes in about AJAX

 

Google Maps

Stu Halloway : "predicts Ajax will be part of nearly all web applications within the next year."

Google Web Toolkit (GWT) this API  &samples Designer  Tool

Software Development in the Real World: The Complete List of Ajax Tools
(tags: ajax)

November 11, 2006 Posted by | AJAX | Leave a comment

webtest canoo

I downloaded webtest to c:/java/webtest and started the install . Note that manual for webtest. I believe it makes use of clover the coverage tool.

webtest -buildfile installTest.xml

installTest.xml:

..

<target name="checkWebTest">

        <echo message="webtest.home is ${webtest.home}"/>
        <testSpec name="check calling and parsing a local file">
            <config
                host=""
                port="0"
                basepath="/"
                summary="false"
                saveresponse="false"
                haltonfailure="true"
                protocol="file"/>
            <steps>
                <invoke
                    description="get local file"
                    url="${basedir}/testfile.html"/>
                <verifyTitle
                    description="check the title is parsed correctly"
                    text="Test File Title"/>
            </steps>
        </testSpec>
    </target>

testfile.html:
<html><head>

<title>Test File Title</title>
</head>
<body>
empty
</body>
</html>

November 10, 2006 Posted by | SW Tools | Leave a comment

Servlet Filters

Servlet Filters [ link ] — are not Servlets and they are not responsible for
creating a response.

They are preprocessors of requests before they
reach a Servlet and postprocessors of responses after leaving a
Servlet.

Servlet filters can:

  • Intercept a Servlet’s invocation before the Servlet is called

  • Examine a request before the destination Servlet is invoked

  • Modify request headers and request/response data by subclassing the HttpServletRequest object and wrapping the original request

  • Intercept a Servlet’s invocation after the servlet is called

The designers of Servlet Filters identified the following examples for their use:
Authentication Filters, Logging and Auditing Filters,Image conversion Filters, Data compression Filters, Encryption Filters, Tokenizing Filters, Filters that trigger resource access events, XSL/T filters, Mime-type chain Filter

web.xml:

<filter>
      <filter-name>My Filter</filter-name>
      <filter-class>com.myproject.MyFilter</filter-class>
      <init-param>
         <param-name>enable</param-name>
         <param-value>yes</param-value>
      </init-param>
</filter>

<filter-mapping>
      <filter-name>My Filter</filter-name>
      <servlet-name>action</servlet-name>
</filter-mapping>

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
public class MyFilter implements Filter
{
    boolean _enable = false;

    public void init(FilterConfig fc) throws ServletException
    {
        String enable=fc.getInitParameter("enable");
        if ("yes".equals(enable))
            _enable=true
    }
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
                  throws IOException, ServletException
    {
        HttpServletRequest  request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) res;
       
        if (! _enable)
        { // proceed with request
            chain.doFilter(request, response);
            return;
        }
       doIt();
        chain.doFilter(request, response);
        //After
FilterChain.doFilter() returns, the filter can do more processing if it
chooses;      
        doINextt();
}

public void destroy()
    {
    }
}

 

November 5, 2006 Posted by | Web Design | Leave a comment

Breadcrumb Taglib

  • Trail Taglib allows a dynamic breadcrumbs trail to be built up and records a user’s movements for the entire session, while providing a normalized version to display to the user.
    (tags: taglib)

"Basic approach is that pages push themselves onto a trail-stack, and
a normalized version is maintained for showing on a page. ie)

In addition to the normalized user version, a full trail is also
maintained, which could be emailed or stored instead of access logs on
session expiry.

Normalization occurs whenever an element is repeated in a trail, its
http-referer is repeated in a trail [ie sneaky users used the back button]
or possibly when the trail:pop tag is used, though I’ve not had a need to
use that yet."

November 4, 2006 Posted by | Web Design | Leave a comment

One Year Out

Stu Halloway : "predicts Ajax will be part of nearly all web applications within the next year."

Tapestry: "component based framework"

Instantiations

November 4, 2006 Posted by | Web Design | Leave a comment

Struts 2

After the release of WebWork 2.2.2, the WebWork and Struts communities began a merge that will eventually produce Struts 2. This merger combines these two "action based" frameworks  as it is told .

Compared to SpringMVC,
you sacrifice some cleanliness but there is a lot more work done in
certain areas, for example client-side validation, a strong Interceptor
framework and a nice graphical flow
designer – this latter is also a strong area, with WebWork being one of
the pioneer adopters of the freshly unbundled RIFE Continuations package.

Continue reading

November 2, 2006 Posted by | Struts | Leave a comment