1 7 package com.inversoft.verge.mvc.view.jsp.error; 8 9 10 import javax.servlet.jsp.PageContext ; 11 12 import com.inversoft.verge.mvc.model.ModelResolution; 13 import com.inversoft.verge.mvc.view.jsp.model.ModelResolutionRegistry; 14 import com.inversoft.verge.util.RequestContext; 15 16 17 27 public class ErrorHelper { 28 29 32 private ErrorHelper() { 33 } 35 36 37 53 public static boolean hasPropertyErrors(String property, RequestContext context, 54 PageContext pageContext) { 55 return (findPropertyErrors(property, context, pageContext) != null); 56 } 57 58 74 public static String findPropertyErrors(String property, RequestContext context, 75 PageContext pageContext) { 76 77 if (!context.hasPropertyErrors(property)) { 78 79 int index = property.indexOf("."); 82 if (index == -1) { 83 return null; 84 } 85 86 ModelResolution mr = ModelResolutionRegistry.lookup( 87 property.substring(0, index), pageContext); 88 if (mr == null) { 89 return null; 90 } 91 92 StringBuffer buf = new StringBuffer (); 93 buf.append(mr.getMetaData().getID()).append("."); 94 buf.append(property.substring(index + 1)); 95 property = buf.toString(); 96 if (!context.hasPropertyErrors(property)) { 97 return null; 98 } 99 } 100 101 return property; 102 } 103 } | Popular Tags |