当前位置: 首页>>代码示例>>Java>>正文


Java JspRuntimeLibrary类代码示例

本文整理汇总了Java中org.apache.jasper.runtime.JspRuntimeLibrary的典型用法代码示例。如果您正苦于以下问题:Java JspRuntimeLibrary类的具体用法?Java JspRuntimeLibrary怎么用?Java JspRuntimeLibrary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JspRuntimeLibrary类属于org.apache.jasper.runtime包,在下文中一共展示了JspRuntimeLibrary类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import org.apache.jasper.runtime.JspRuntimeLibrary; //导入依赖的package包/类
public void visit(Node.GetProperty n) throws JasperException {
    String name = n.getTextAttribute("name");
    String property = n.getTextAttribute("property");

    n.setBeginJavaLine(out.getJavaLine());

    if (beanInfo.checkVariable(name)) {
        // Bean is defined using useBean, introspect at compile time
        Class bean = beanInfo.getBeanType(name);
        String beanName = JspUtil.getCanonicalName(bean);
        java.lang.reflect.Method meth = JspRuntimeLibrary
                .getReadMethod(bean, property);
        String methodName = meth.getName();
        out
                .printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString("
                        + "((("
                        + beanName
                        + ")_jspx_page_context.findAttribute("
                        + "\""
                        + name + "\"))." + methodName + "())));");
    } else {
        // The object could be a custom action with an associated
        // VariableInfo entry for this name.
        // Get the class name and then introspect at runtime.
        out
                .printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString"
                        + "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty"
                        + "(_jspx_page_context.getAttribute(\""
                        + name
                        + "\", PageContext.PAGE_SCOPE), \""
                        + property
                        + "\")));");
    }

    n.setEndJavaLine(out.getJavaLine());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:Generator.java

示例2: visit

import org.apache.jasper.runtime.JspRuntimeLibrary; //导入依赖的package包/类
@Override
public void visit(Node.GetProperty n) throws JasperException {
	String name = n.getTextAttribute("name");
	String property = n.getTextAttribute("property");

	n.setBeginJavaLine(out.getJavaLine());

	if (beanInfo.checkVariable(name)) {
		// Bean is defined using useBean, introspect at compile time
		Class<?> bean = beanInfo.getBeanType(name);
		String beanName = bean.getCanonicalName();
		java.lang.reflect.Method meth = JspRuntimeLibrary.getReadMethod(bean, property);
		String methodName = meth.getName();
		out.printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString(" + "(((" + beanName
				+ ")_jspx_page_context.findAttribute(" + "\"" + name + "\"))." + methodName + "())));");
	} else if (!STRICT_GET_PROPERTY || varInfoNames.contains(name)) {
		// The object is a custom action with an associated
		// VariableInfo entry for this name.
		// Get the class name and then introspect at runtime.
		out.printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString"
				+ "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty"
				+ "(_jspx_page_context.findAttribute(\"" + name + "\"), \"" + property + "\")));");
	} else {
		StringBuilder msg = new StringBuilder();
		msg.append("file:");
		msg.append(n.getStart());
		msg.append(" jsp:getProperty for bean with name '");
		msg.append(name);
		msg.append("'. Name was not previously introduced as per JSP.5.3");

		throw new JasperException(msg.toString());
	}

	n.setEndJavaLine(out.getJavaLine());
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:36,代码来源:Generator.java

示例3: visit

import org.apache.jasper.runtime.JspRuntimeLibrary; //导入依赖的package包/类
public void visit(Node.GetProperty n) throws JasperException {
    String name = n.getTextAttribute("name");
    String property = n.getTextAttribute("property");

    n.setBeginJavaLine(out.getJavaLine());

    if (beanInfo.checkVariable(name)) {
        // Bean is defined using useBean, introspect at compile time
        Class bean = beanInfo.getBeanType(name);
        String beanName = JspUtil.getCanonicalName(bean);
        java.lang.reflect.Method meth =
            JspRuntimeLibrary.getReadMethod(bean, property);
        String methodName = meth.getName();
        out.printil(
            "out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString("
                + "((("
                + beanName
                + ")_jspx_page_context.findAttribute("
                + "\""
                + name
                + "\"))."
                + methodName
                + "())));");
    } else {
        // The object could be a custom action with an associated
        // VariableInfo entry for this name.
        // Get the class name and then introspect at runtime.
        out.printil(
            "out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString"
                + "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty"
                + "(_jspx_page_context.findAttribute(\""
                + name
                + "\"), \""
                + property
                + "\")));");
    }

    n.setEndJavaLine(out.getJavaLine());
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:40,代码来源:Generator.java

示例4: visit

import org.apache.jasper.runtime.JspRuntimeLibrary; //导入依赖的package包/类
@Override
public void visit(Node.GetProperty n) throws JasperException {
    String name = n.getTextAttribute("name");
    String property = n.getTextAttribute("property");

    n.setBeginJavaLine(out.getJavaLine());

    if (beanInfo.checkVariable(name)) {
        // Bean is defined using useBean, introspect at compile time
        Class<?> bean = beanInfo.getBeanType(name);
        String beanName = bean.getCanonicalName();
        java.lang.reflect.Method meth = JspRuntimeLibrary
                .getReadMethod(bean, property);
        String methodName = meth.getName();
        out.printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString("
                + "((("
                + beanName
                + ")_jspx_page_context.findAttribute("
                + "\""
                + name + "\"))." + methodName + "())));");
    } else if (!STRICT_GET_PROPERTY || varInfoNames.contains(name)) {
        // The object is a custom action with an associated
        // VariableInfo entry for this name.
        // Get the class name and then introspect at runtime.
        out.printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString"
                + "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty"
                + "(_jspx_page_context.findAttribute(\""
                + name
                + "\"), \""
                + property
                + "\")));");
    } else {
        StringBuilder msg = new StringBuilder();
        msg.append("file:");
        msg.append(n.getStart());
        msg.append(" jsp:getProperty for bean with name '");
        msg.append(name);
        msg.append(
                "'. Name was not previously introduced as per JSP.5.3");
        
        throw new JasperException(msg.toString());
    }

    n.setEndJavaLine(out.getJavaLine());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:46,代码来源:Generator.java

示例5: visit

import org.apache.jasper.runtime.JspRuntimeLibrary; //导入依赖的package包/类
@Override
public void visit(Node.GetProperty n) throws JasperException {
    String name = n.getTextAttribute("name");
    String property = n.getTextAttribute("property");

    n.setBeginJavaLine(out.getJavaLine());

    if (beanInfo.checkVariable(name)) {
        // Bean is defined using useBean, introspect at compile time
        Class<?> bean = beanInfo.getBeanType(name);
        String beanName = bean.getCanonicalName();
        java.lang.reflect.Method meth = JspRuntimeLibrary
                .getReadMethod(bean, property);
        String methodName = meth.getName();
        out.printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString("
                + "((("
                + beanName
                + ")_jspx_page_context.findAttribute("
                + "\""
                + name + "\"))." + methodName + "())));");
    } else if (!STRICT_GET_PROPERTY || varInfoNames.contains(name)) {
        // The object is a custom action with an associated
        // VariableInfo entry for this name.
        // Get the class name and then introspect at runtime.
        out.printil("out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString"
                + "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty"
                + "(_jspx_page_context.findAttribute(\""
                + name
                + "\"), \""
                + property
                + "\")));");
    } else {
        StringBuilder msg = new StringBuilder();
        msg.append("file:");
        msg.append(n.getStart());
        msg.append(" jsp:getProperty for bean with name '");
        msg.append(name);
        msg.append(
                "'. Name was not previously introduced as per JSP.5.3");

        throw new JasperException(msg.toString());
    }

    n.setEndJavaLine(out.getJavaLine());
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:46,代码来源:Generator.java

示例6: checkSetter

import org.apache.jasper.runtime.JspRuntimeLibrary; //导入依赖的package包/类
private void checkSetter(Node.CustomTag n, TagAttributeInfo tldattr) 
                throws JasperException {

            Class handler = n.getTagHandlerClass();
            if (handler == null) {
                // Handler unknown.  Maybe tag file?
                return;
            }

            String handlerName = handler.getName();
            String property = tldattr.getName();
            Method setter = null;

            try {
                setter = JspRuntimeLibrary.getWriteMethod(handler, property);
            } catch (Exception ex) {
            }
            if (setter == null) {
                err.jspError(n, "jsp.error.setter.none", handlerName,
                             property);
            }
            Class setterType = setter.getParameterTypes()[0];
            String typeName = setterType.getName();
            if (tldattr.isDeferredValue()) {
                if (tldattr.canBeRequestTime()) {
                    if (! "java.lang.Object".equals(typeName)) {
                        err.jspError(n, "jsp.error.setter.notobject",
                            handlerName, property);
                    }
                    return;
                }
                if (! "javax.el.ValueExpression".equals(typeName)) {
                    err.jspError(n, "jsp.error.setter.notvalueexpression",
                        handlerName, property);
                }
                return;
            }
            if (tldattr.isDeferredMethod()) {
                if (! "javax.el.MethodExpression".equals(typeName)) {
                    err.jspError(n, "jsp.error.setter.notmethodexpression",
                        handlerName, property);
                }
                return;
            }
/* Temporarily removed, as it breaks some JSF applications.  Should be
   able to refine the check.
            String tldType = tldattr.getTypeName();
            if (tldType != null && ! tldType.equals(typeName)) {
                err.jspError(n, "jsp.error.setter.notequal",
                    handlerName, property);
            }
*/
        }
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:54,代码来源:Validator.java


注:本文中的org.apache.jasper.runtime.JspRuntimeLibrary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。