tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venu Gopalan <venugopala...@yahoo.com.INVALID>
Subject Re: Struts 1 / Tile 2 integration issue
Date Fri, 17 Mar 2017 15:06:10 GMT
Thank you for the reply Torsten. Sorry for not putting the line where it fails. Below is the
code failing in DefaultAttributeResolver.java at line#42. (highlighted). This class is part
of tiles-template-2.2.1.jar. Ultimately the container variable is null which is org.apache.tiles.TilesContainer.
TilesContainer is part of tiles-api-2.2.1.jar. I have both jars in the classpath and WEB-INF\lib.
No idea any other set up is needed.
package org.apache.tiles.template;
import org.apache.tiles.Attribute;import org.apache.tiles.AttributeContext;import org.apache.tiles.Expression;import
org.apache.tiles.TilesContainer;
/** * The default implementation of AttributeResolver. * * @version $Rev: 788032 $ $Date:
2009-06-24 16:08:32 +0200(mer, 24 giu 2009) $ * @since 2.2.0 */public class DefaultAttributeResolver
implements AttributeResolver {
    /** {@inheritDoc} */    public Attribute computeAttribute(TilesContainer container,
Attribute attribute,            String name, String role, boolean ignore,       
    Object defaultValue, String defaultValueRole, String defaultValueType, Object... requestItems)
{        if (attribute == null) {            AttributeContext evaluatingContext
= container                    .getAttributeContext(requestItems);         
  attribute = evaluatingContext.getAttribute(name);            if (attribute == null)
{                attribute = computeDefaultAttribute(defaultValue,           
            defaultValueRole, defaultValueType);                if (attribute
== null && !ignore) {                    throw new NoSuchAttributeException("Attribute
'" + name                            + "' not found.");             
  }            }        }        if (attribute != null && role != null
&& !"".equals(role.trim())) {            attribute = new Attribute(attribute); 
          attribute.setRole(role);        }        return attribute;    }
    private Attribute computeDefaultAttribute(Object defaultValue,            String
defaultValueRole, String defaultValueType) {        Attribute attribute = null;     
  if (defaultValue != null) {            if (defaultValue instanceof Attribute) { 
              attribute = (Attribute) defaultValue;            } else if (defaultValue
instanceof String) {                attribute = new Attribute(defaultValue, (Expression)
null,                        defaultValueRole, defaultValueType);         
  }        }        return attribute;    }}
Thank you Venu 

    On Friday, 17 March 2017 10:00 AM, Torsten Krah <krah.tm@gmail.com> wrote:
 

 What about a debugger? Did you had a look at the failing code piece in
the:

DefaultAttributeResolver.java on line 42

Which variable is null, what the origin of the var? Who should set it -
if it is set somewhere why its lost ... more specific question are
needed than some error outputs with traces to which no one got an sample
app.

Its so dated code - you need to supply more information here so we may
have a chance to help you.

Cheers

Torsten



   
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message