webwork<ww:if>标签的使用【转】

返回值进行区分:
1.如果是String型

Java代码
<ww:if test="sftd.equals(\"4\")"></ww:if>[
Java代码
<ww:if test="sftd.equals(\"4\")"></ww:if>[
<ww:if test="sftd.equals(\"4\")"></ww:if>[


2.如果是char型

Java代码
<ww:if test="sftd.equals('4')"></ww:if>[
Java代码
<ww:if test="sftd.equals('4')"></ww:if>[
<ww:if test="sftd.equals('4')"></ww:if>[


3.如果是int型

Java代码
<ww:if test="sftd==4"></ww:if>
Java代码
<ww:if test="sftd==4"></ww:if>
<ww:if test="sftd==4"></ww:if>


在循环中:

Java代码
<select name="belong">
<ww:iterator value="sortBigList" status="index">
<option value="<ww:property value="id"/>" <ww:if test="%{id==model.belong}">selected</ww:if>><ww:property value="lb"/></option>
</ww:iterator>
</select>
Java代码
<select name="belong">
<ww:iterator value="sortBigList" status="index">
<option value="<ww:property value="id"/>" <ww:if test="%{id==model.belong}">selected</ww:if>><ww:property value="lb"/></option>
</ww:iterator>
</select>
<select name="belong">
<ww:iterator value="sortBigList" status="index">
<option value="<ww:property value="id"/>" <ww:if test="%{id==model.belong}">selected</ww:if>><ww:property value="lb"/></option>
</ww:iterator>
</select>

注意:id==model.belong,而不是belong==model.belong


定义变量

Java代码
<ww:set name="tt1" value="'aaaaaaaaaaaaaa'"/>
<ww:property value="#tt1"/>
Java代码
<ww:set name="tt1" value="'aaaaaaaaaaaaaa'"/>
<ww:property value="#tt1"/>
<ww:set name="tt1" value="'aaaaaaaaaaaaaa'"/>
<ww:property value="#tt1"/>


注意:字符串要加''

日期显示:
<ww:property value="createTime.toString()" />


<ww:if test="selectedByOthers!='true'">

<input onclick="ST(this); " type="checkbox" name="$$SelectDoc" value="<ww:property value='id'/>" style="border: 0pt;"/>

</ww:if>

<ww:else>

<input type="radio" name="$$SelectDoc" value="<ww:property value='id'/>|<ww:property value='topic'/>"

<ww:if test="id.toString().equals(aboutDocid)">checked</ww:if>

<ww:if test="#status.count % 2">style="border: 0pt;"</ww:if>

<ww:else>style="border: 0pt;background-color:#F7F7F7"</ww:else> >

</ww:else>


在ww:if比较时id.toString().equals(aboutDocid)中的id是长整型,必须通过toString()成为字符串后再与字符型的aboutDocid比较,否则不报错,却也得不到想要的结果。因为这些代码是写在jsp页面的,这个小细节经常忘记,导致显示的结果不正确却又一时想不起原因来。


此篇文章转于http://cissco.iteye.com/blog/206737 谢谢作者!
请详细分析下面代码<tr class="b"> <td>RunCard Category:</td> <td colspan="3"><#--@ww.select name="'requestForm.ercCategory'" list="{'Rework(<3 lots for one case with same reason)','Normal Condition Split(split on qualified comparison or split within spec)','Add Measurement','For Customer Request','Input the STR Number','Expriment on scrap wafer(<1 lot and must scrap in 3 stages after experiment)','Expriment on scrap wafer(<1 lot and must change lot type to engineering lot type before experiment)'}" headerKey="'Please Select'" headerValue="'Please Select'" onchange="'reloadFormForErcCategory()'" emptyOption="false" theme="'simple'"/--> <#if requestForm.ercCategory?if_exists=="STR" || requestForm.ercCategory?if_exists=="MSTR"> <select name="requestForm.ercCategory"> <option value="${requestForm.ercCategory?if_exists}">${requestForm.ercCategory}</option> </select> <#else> <select name="requestForm.ercCategory" onchange="reloadFormForErcCategory(this)" <#if requestForm.formType?if_exists=="Scan Defect">disabled=true</#if>> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="Normal Condition Split"> selected="selected"</#if></#if> value="Normal Condition Split">Normal Condition Split(split on qualified comparison or split within spec)</option> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="Rework"> selected="selected"</#if></#if> value="Rework">Rework(<3 lots for one case with same reason)</option> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="Add Measurement" || requestForm.ercCategory=="need reposition"> selected="selected"</#if></#if> value="need reposition"> Add Measurement(Normal, need fill reposition step information)</option> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="no reposition"> selected="selected"</#if></#if> value="no reposition">Add Measurement( Scan defect without reposition step)</option> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="For Customer Request"> selected="selected"</#if></#if> value="For Customer Request">For Customer Request(Pls input the EN number)</option> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="Input the STR Number"> selected="selected"</#if></#if> value="Input the STR Number">For STR/MSTR lots(Pls input the effective STR or MSTR number)</option> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="Experiment on scrap wafer"> selected="selected"</#if></#if> value="Experiment on scrap wafer">Experiment on scrap wafer(<1 lot and must scrap in 3 stages after experiment)</option> <option <#if requestForm.ercCategory?has_content> <#if requestForm.ercCategory=="Experiment on production wafer"> selected="selected"</#if></#if> value="Experiment on production wafer">Experiment on production wafer(<1 lot and must change lot type to engineering lot type before experiment)</option> </#if> </select> </td> </tr>
09-17
请分析下面代码:<script> function doQTime(groupResult){ var form = document.forms['updateRequestForm']; form.action="comeinQTime.action?method=fromMainPage&groupResultId="+groupResult; form.submit(); } function doMainFlowQTime(groupResult){ var form = document.forms['updateRequestForm']; form.action="comeinMainFlowQTime.action?method=fromMainPage&groupResultId="+groupResult; form.submit(); } </script> <tr class="b"> <th colspan="4">Group Result</th> </tr> <tr class="b"> <td colspan="4"> <table border="0" cellspacing="1" cellpadding="8" width="100%"> <#if requestForm.groupResults?has_content> <#assign groupResults=requestForm.groupResults/> <#list groupResults as groupResult> <@ww.hidden name="'groupResults[${groupResult_index}].id'" value="${groupResult.id?if_exists}"/> <tr class=odder> <td><b>Wafer List</b></td> <td colspan=2 align=left><b>Step List</b></td> <td colspan=2><b>QTime(m)</b></td> <td></td> </tr> <tr class=odder> <td>${groupResult.waferIdsShow?if_exists}</td> <td width=15% colspan=2 align=left>${groupResult.steps?if_exists}</td> <td colspan=2> <table border="0" cellspacing="1" cellpadding="8" width="100%"> <#if groupResult.qtimes?has_content> <#list groupResult.qtimes as qtime> <tr><TD><B>Type:</B>${qtime.controlType} <B>Period:</B>${qtime.intervalTime} <B>From:</B>${qtime.strStepSeq} <B>To:</B>${qtime.endStepSeq} <B>mpsStepSeq:</B>${qtime.mpsStepSeq?if_exists} <B>Action:</B>${qtime.expireAction}</TD></tr> </#list> </#if> </table> </td> <td> <#if !showWGAction?if_exists> <input type="button" name="btnAddQtime" value="AddQTime" onclick="doQTime('${groupResult.id?if_exists}')" class="button"> <BR> <input type="button" name="btnAddMainFlowQtime" value="AddMainFlowQTime" onclick="doMainFlowQTime('${groupResult.id?if_exists}')" class="button"> </#if> </td> </tr> </#list> </#if> </table> </td> </tr>
最新发布
09-19
分析代码:<#setting datetime_format="yyyy-MM-dd"/> <#import "/decorators/includes/macros.ftl" as m> <#assign ww = JspTaglibs["/WEB-INF/webwork.tld"] /> <div id="breadcrumbs"> <a href="${req.contextPath}/index.action">Home</a> > To Do </div> <div class="app"> <#list toDoItemsMap?keys as owner> <#assign toDoItems = toDoItemsMap[owner]?if_exists> <#if ercService.CanSignoffRuncardMemberByE1Manager(userLogin.employeeInfo.employeeNo)?has_content> <#if specialDuty?default("") ==""> <a href="toDo.action?specialDuty=T">Todo List for E1 specialDuty</a> <#else> <a href="toDo.action">Normal Todo List</a> </#if> </#if> <h3><@m.directoryLink owner/>'s ToDo List</h3> <table border="0" cellspacing="2" cellpadding="3" width="100%" id="todo"> <thead> <tr> <th>Case No</th> <th>Lot Id</th> <th>Applicant</th> <th>Product Id</th> <th>Stage Id</th> <th>Status</th> <th>Purpose</th> <th>Submit Date</th> </tr> </thead> <tbody> <#list toDoItems?sort_by('caseNo') as todo> <#if specialDuty?default("") =="" || todo.queuedOwners?seq_contains(todo.e1OrgId)> <tr class="b"> <td><a href="viewWorkFlowEntry.action?requestFormId=${todo.id}&specialDuty=${specialDuty?default("")}">${todo.caseNo?default("Not Assigned")?if_exists}</a></td> <td>${todo.lotId?if_exists}</td> <td><@m.directoryLink todo.applicant?if_exists/></td> <td>${todo.prodId?if_exists}</td> <td>${todo.lotStageId?if_exists}</td> <td>${todo.status?if_exists}</td> <td>${todo.purpose?if_exists}</td> <td>${todo.submitDate?datetime?if_exists}</td> </tr> </#if> </#list> </tbody> </table> </#list> <script type="text/javascript"> var st0 = new SortableTable(document.getElementById("todo"), ["String", "String" ,"String" ,"String"]); </script> </div>
09-02
你好,请分析下面代码:<#setting datetime_format="yyyy-MM-dd"/> <#import "/decorators/includes/macros.ftl" as m> <#assign ww = JspTaglibs["/WEB-INF/webwork.tld"] /> <div id="breadcrumbs"> <a href="${req.contextPath}/index.action">Home</a> > To Do </div> <div class="app"> <#list toDoItemsMap?keys as owner> <#assign toDoItems = toDoItemsMap[owner]?if_exists> <#if ercService.CanSignoffRuncardMemberByE1Manager(userLogin.employeeInfo.employeeNo)?has_content> <#if specialDuty?default("") ==""> <a href="toDo.action?specialDuty=T">Todo List for E1 specialDuty</a> <#else> <a href="toDo.action">Normal Todo List</a> </#if> </#if> <h3><@m.directoryLink owner/>'s ToDo List</h3> <table border="0" cellspacing="2" cellpadding="3" width="100%" id="todo"> <thead> <tr> <th>Case No</th> <th>Lot Id</th> <th>Applicant</th> <th>Product Id</th> <th>Stage Id</th> <th>Status</th> <th>Purpose</th> <th>Submit Date</th> </tr> </thead> <tbody> <#list toDoItems?sort_by('caseNo') as todo> <#if specialDuty?default("") =="" || todo.queuedOwners?seq_contains(todo.e1OrgId)> <tr class="b"> <td><a href="viewWorkFlowEntry.action?requestFormId=${todo.id}&specialDuty=${specialDuty?default("")}">${todo.caseNo?default("Not Assigned")?if_exists}</a></td> <td>${todo.lotId?if_exists}</td> <td><@m.directoryLink todo.applicant?if_exists/></td> <td>${todo.prodId?if_exists}</td> <td>${todo.lotStageId?if_exists}</td> <td>${todo.status?if_exists}</td> <td>${todo.purpose?if_exists}</td> <td>${todo.submitDate?datetime?if_exists}</td> </tr> </#if> </#list> </tbody> </table> </#list> <script type="text/javascript"> var st0 = new SortableTable(document.getElementById("todo"), ["String", "String" ,"String" ,"String"]); </script> </div>
09-02
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值