主题 : 我想发布新闻的时候作者名称自动获取登陆管理员的名称
级别: 童生
UID: 118637
积分:15 加为好友
威望: 3 精华: 0
主题:3 回复:17
注册时间:2017-12-04
在线时长:0
1#   发表于:2017-12-04 23:30:32  IP:175.194.*.*
<#elseif item.field=="origin">
<@p.td help=item.help helpPosition="${item.helpPosition!2}" label=item.label colspan=item.single?string("2","1") width="${item.single?string(100,50)}">
<@p.text name=item.field value="${site.name!}" maxlength="100" style="width:70px"/> &nbsp;
<@s.m "content.originUrl"/>: <input type="text" name="originUrl" maxlength="255" style="width:100px"/>
</@p.td>

现在的代码是这样的,获取的是网站的名称,我想得到管理员的名称
级别: 版主
UID: 117477
积分:5145 加为好友
威望: 0 精华: 0
主题:0 回复:4823
注册时间:2017-10-25
在线时长:0
2#   发表于:2017-12-05 08:39:00  IP:182.12.*.*
回复第1楼
${user.group.name}
级别: 童生
UID: 118637
积分:15 加为好友
威望: 3 精华: 0
主题:3 回复:17
注册时间:2017-12-04
在线时长:0
3#   发表于:2017-12-05 10:50:09  IP:175.176.*.*
<#elseif item.field=="origin">
<@p.td help=item.help helpPosition="${item.helpPosition!2}" label=item.label colspan=item.single?string("2","1") width="${item.single?string(100,50)}">
<@p.text name=item.field value="${user.group.name}" maxlength="100" style="width:70px"/> &nbsp;
<@s.m "content.originUrl"/>: <input type="text" name="originUrl" maxlength="255" style="width:100px"/>
</@p.td>

我直接放进去显示这些内容....

FreeMarker template error: The following has evaluated to null or missing: ==> user [in template "csagri_sys/content/add.html" at line 392, column 35] Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)?? The failing instruction (FTL stack trace): ---------- ==> ${user.group.name} [in template "csagri_sys/content/add.html" at line 392, column 33] @p.text name=item.field value="\${use... [in template "csagri_sys/content/add.html" at line 392, column 1] #nested [in template "ftl/csagri/ui/td.ftl" in macro "td" at line 16, column 1] @p.td help=item.help helpPosition="\$... [in template "csagri_sys/content/add.html" at line 391, column 1] #elseif item.field == "origin" [in template "csagri_sys/content/add.html" at line 390, column 1] #if !item.custom [in template "csagri_sys/content/add.html" at line 325, column 1] #nested [in template "ftl/csagri/ui/form.ftl" in macro "form" at line 25, column 1] @p.form id="jvForm" action="o_save.do... [in template "csagri_sys/content/add.html" at line 320, column 1] ---------- Java stack trace (for programmers): ---------- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98) at 
级别: 总版主
UID: 10736
积分:149787 加为好友
威望: 212 精华: 42
主题:297 回复:127674
注册时间:2010-09-08
在线时长:90.1
4#   发表于:2017-12-05 10:54:28  IP:182.12.*.*
${user.username!}
路漫漫其修远兮,吾将上下而求索!
级别: 童生
UID: 118637
积分:15 加为好友
威望: 3 精华: 0
主题:3 回复:17
注册时间:2017-12-04
在线时长:0
5#   发表于:2017-12-05 10:58:02  IP:175.176.*.*
<#elseif item.field=="origin">
<@p.td help=item.help helpPosition="${item.helpPosition!2}" label=item.label colspan=item.single?string("2","1") width="${item.single?string(100,50)}">
<@p.text name=item.field value="${user.username!}" maxlength="100" style="width:70px"/> &nbsp;
<@s.m "content.originUrl"/>: <input type="text" name="originUrl" maxlength="255" style="width:100px"/>
</@p.td>



FreeMarker template error: The following has evaluated to null or missing: ==> user [in template "csagri_sys/content/add.html" at line 392, column 35] Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)?? The failing instruction (FTL stack trace): ---------- ==> ${user.username!} [in template "csagri_sys/content/add.html" at line 392, column 33] @p.text name=item.field value="\${use... [in template "csagri_sys/content/add.html" at line 392, column 1] #nested [in template "ftl/csagri/ui/td.ftl" in macro "td" at line 16, column 1] @p.td help=item.help helpPosition="\$... [in template "csagri_sys/content/add.html" at line 391, column 1] #elseif item.field == "origin" [in template "csagri_sys/content/add.html" at line 390, column 1] #if !item.custom [in template "csagri_sys/content/add.html" at line 325, column 1] #nested [in template "ftl/csagri/ui/form.ftl" in macro "form" at line 25, column 1] @p.form id="jvForm" action="o_save.do... [in template "csagri_sys/content/add.html" at line 320, column 1] ---------- Java stack trace (for programmers): ---------- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98) at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:41) at 
级别: 版主
UID: 117477
积分:5145 加为好友
威望: 0 精华: 0
主题:0 回复:4823
注册时间:2017-10-25
在线时长:0
6#   发表于:2017-12-05 11:00:02  IP:182.12.*.*
回复第5楼
${content.user.username}  
级别: 童生
UID: 118637
积分:15 加为好友
威望: 3 精华: 0
主题:3 回复:17
注册时间:2017-12-04
在线时长:0
7#   发表于:2017-12-05 11:03:47  IP:175.176.*.*
<#elseif item.field=="origin">
<@p.td help=item.help helpPosition="${item.helpPosition!2}" label=item.label colspan=item.single?string("2","1") width="${item.single?string(100,50)}">
<@p.text name=item.field value="${content.user.username}" maxlength="100" style="width:70px"/> &nbsp;
<@s.m "content.originUrl"/>: <input type="text" name="originUrl" maxlength="255" style="width:100px"/>
</@p.td>


FreeMarker template error: The following has evaluated to null or missing: ==> content [in template "csagri_sys/content/add.html" at line 392, column 35] Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)?? The failing instruction (FTL stack trace): ---------- ==> ${content.user.username} [in template "csagri_sys/content/add.html" at line 392, column 33] @p.text name=item.field value="\${con... [in template "csagri_sys/content/add.html" at line 392, column 1] #nested [in template "ftl/csagri/ui/td.ftl" in macro "td" at line 16, column 1] @p.td help=item.help helpPosition="\$... [in template "csagri_sys/content/add.html" at line 391, column 1] #elseif item.field == "origin" [in template "csagri_sys/content/add.html" at line 390, column 1] #if !item.custom [in template "csagri_sys/content/add.html" at line 325, column 1] #nested [in template "ftl/csagri/ui/form.ftl" in macro "form" at line 25, column 1] @p.form id="jvForm" action="o_save.do... [in template "csagri_sys/content/add.html" at line 320, column 1] ---------- Java stack trace (for programmers): ---------- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98) at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:41) at 
级别: 版主
UID: 117477
积分:5145 加为好友
威望: 0 精华: 0
主题:0 回复:4823
注册时间:2017-10-25
在线时长:0
8#   发表于:2017-12-05 11:04:43  IP:182.12.*.*
回复第7楼
这不大可能吧
级别: 童生
UID: 118637
积分:15 加为好友
威望: 3 精华: 0
主题:3 回复:17
注册时间:2017-12-04
在线时长:0
9#   发表于:2017-12-05 11:11:50  IP:175.176.*.*
嗯嗯,我放${site.name!}可以显示站点名称,${site.username!}、${site.realname!}没显示也不出现看不懂的代码,大佬们,我都蒙圈了
级别: 总版主
UID: 10736
积分:149787 加为好友
威望: 212 精华: 42
主题:297 回复:127674
注册时间:2010-09-08
在线时长:90.1
10#   发表于:2017-12-05 11:17:52  IP:182.12.*.*
你那标签是在前台 模板里调用获取的
路漫漫其修远兮,吾将上下而求索!
1 2 > >| 共2页