Commit bbf64a6a authored by fuhai999@gmail.com's avatar fuhai999@gmail.com
Browse files

v2.0-rc.9

parent 2f5d81de
Showing with 13 additions and 19 deletions
+13 -19
......@@ -16,14 +16,11 @@
package io.jpress.web.directive;
import com.jfinal.template.Env;
import com.jfinal.template.TemplateException;
import com.jfinal.template.io.Writer;
import com.jfinal.template.stat.Scope;
import io.jboot.web.directive.annotation.JFinalDirective;
import io.jboot.web.directive.base.JbootDirectiveBase;
import java.io.IOException;
/**
* @author Michael Yang 杨福海 (fuhai999@gmail.com)
* @version V1.0
......@@ -32,17 +29,17 @@ import java.io.IOException;
@JFinalDirective("checkedIf")
public class CheckedIfDirective extends JbootDirectiveBase {
@Override
public void onRender(Env env, Scope scope, Writer writer) {
Object param = getPara(0, scope);
if ("true".equalsIgnoreCase(String.valueOf(param))) {
try {
writer.write("checked");
} catch (IOException e) {
throw new TemplateException(e.getMessage(), location, e);
if (param instanceof Boolean) {
if ((Boolean) param) {
renderText(writer,"checked");
}
} else if ("true".equalsIgnoreCase(String.valueOf(param))) {
renderText(writer,"checked");
}
}
}
......@@ -43,7 +43,7 @@ public class MaxLengthDirective extends JbootDirectiveBase {
int maxLength = getPara(1, scope, 0);
if (maxLength <= 0) {
throw new IllegalArgumentException("#maxLength(content,length) 参数错误,length必须大于0 ");
throw new IllegalArgumentException("#maxLength(content,length) 参数错误,length必须大于0 " + getLocation());
}
String suffix = getPara(2, scope);
......
......@@ -16,14 +16,11 @@
package io.jpress.web.directive;
import com.jfinal.template.Env;
import com.jfinal.template.TemplateException;
import com.jfinal.template.io.Writer;
import com.jfinal.template.stat.Scope;
import io.jboot.web.directive.annotation.JFinalDirective;
import io.jboot.web.directive.base.JbootDirectiveBase;
import java.io.IOException;
/**
* @author Michael Yang 杨福海 (fuhai999@gmail.com)
* @version V1.0
......@@ -36,14 +33,14 @@ public class SelectedIfDirective extends JbootDirectiveBase {
@Override
public void onRender(Env env, Scope scope, Writer writer) {
Object param = getPara(0, scope);
if ("true".equalsIgnoreCase(String.valueOf(param))) {
try {
writer.write("selected");
} catch (IOException e) {
throw new TemplateException(e.getMessage(), location, e);
if (param instanceof Boolean) {
if ((Boolean) param) {
renderText(writer, "selected");
}
} else if ("true".equalsIgnoreCase(String.valueOf(param))) {
renderText(writer, "selected");
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment