org.apache.jasper.JasperException: The function test must be used with a prefix when a default namespace is not specified

前端 未结 3 1829
南方客
南方客 2020-11-28 14:20

I\'m using the following things for my project: Spring 3.0.1 + Apache Tiles 2.2.1 + Glassfish 2.1. What I\'m trying to do is to call some method in a jsp-page and pass some

3条回答
  •  -上瘾入骨i
    2020-11-28 15:15

    Because I have to work on Servlet 2.5, I made this hack:

    JSP:

    ${testBean.test["hello"]}
    

    Bean:

    private Map test;
    
    public Map getTest() {
        if (test == null) {
            test = new Map() {
                @Override
                public Object get(Object key) {
                    System.out.println("param = " + key);
                    return null;
                }
    
                @Override
                public int size() {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public boolean isEmpty() {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public boolean containsKey(Object key) {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public boolean containsValue(Object value) {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public Object put(Object key, Object value) {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public Object remove(Object key) {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public void putAll(Map m) {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public void clear() {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public Set keySet() {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public Collection values() {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
                @Override
                public Set entrySet() {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
    
            };
        }
        return test;
    }
    

提交回复
热议问题