FileDocCategorySizeDatePackage
SearchAction.javaAPI DocJBoss 4.2.11970Fri Jul 13 20:55:40 BST 2007xpetstore.web.webwork.action.product

SearchAction

public class SearchAction extends xpetstore.web.webwork.action.BaseAction
author
Herve Tchepannou
webwork.action
name="search" success="search.vm"

Fields Summary
private String
_keyword
private Collection
_products
Constructors Summary
Methods Summary
protected java.lang.StringdoExecute()

see
webwork.action.ActionSupport#doExecute()


    //~ Methods ----------------------------------------------------------------

           
        
         
    
        if ( ( _keyword == null ) || ( _keyword.length(  ) == 0 ) )
        {
            return SUCCESS;
        }

        Session s = getHibernateSession(  );
        try
        {
            String oql = "FROM p IN CLASS " + Product.class + " WHERE" + " ( p.productId LIKE '%" + _keyword + "%' ) OR" + " ( p.name LIKE '%" + _keyword + "%' ) OR" + " ( p.description LIKE '%" + _keyword + "%' )";
            _products = s.find( oql );

            return SUCCESS;
        }
        finally
        {
            s.close(  );
        }
    
public java.lang.StringgetKeyword()

return
String

        return _keyword;
    
public java.util.CollectiongetProducts()

return
Collection

        return _products;
    
public voidsetKeyword(java.lang.String keyword)
Sets the keyword.

param
keyword The keyword to set

        _keyword = keyword;
    
public voidsetProducts(java.util.Collection products)
Sets the products.

param
products The products to set

        _products = products;