⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testcanceltag2.jsp

📁 这是STRUTS1.2。6的开发包。。这是我从芝APACHE网站下下来
💻 JSP
字号:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="junit.framework.Assert"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>


<logic:equal name="runTest" value="testCancelStyle">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel style="Put something here"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Cancel" onclick="bCancel=true;" style="Put something here">
	</bean:define>
</logic:equal>

<logic:equal name="runTest" value="testCancelStyleClass">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel styleClass="Put something here"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Cancel" onclick="bCancel=true;" class="Put something here">
	</bean:define>
</logic:equal>

<logic:equal name="runTest" value="testCancelStyleId">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel styleId="Put something here"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Cancel" onclick="bCancel=true;" id="Put something here">
	</bean:define>
</logic:equal>

<logic:equal name="runTest" value="testCancelTabindex">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel tabindex="Put something here"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" tabindex="Put something here" value="Cancel" onclick="bCancel=true;">
	</bean:define>
</logic:equal>

<logic:equal name="runTest" value="testCancelTitle">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel title="Put something here"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Cancel" onclick="bCancel=true;" title="Put something here">
	</bean:define>
</logic:equal>

<logic:equal name="runTest" value="testCancelTitleKey">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel titleKey="default.bundle.message"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Cancel" onclick="bCancel=true;" title="Testing Message">
	</bean:define>
</logic:equal>

<logic:equal name="runTest" value="testCancelTitleKey_fr">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel titleKey="default.bundle.message"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Cancel" onclick="bCancel=true;" title="Message D'Essai">
	</bean:define>
</logic:equal>

<logic:equal name="runTest" value="testCancelValue">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel value ="Put something here"/>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Put something here" onclick="bCancel=true;">
	</bean:define>
</logic:equal>


<logic:equal name="runTest" value="testCancelBodyContent">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel>Cancel Value Here</html:cancel>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Cancel Value Here" onclick="bCancel=true;">
	</bean:define>
</logic:equal>


<logic:equal name="runTest" value="testCancelBodyContentMessageKey">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel>
			<bean:message key="default.bundle.message"/>
		</html:cancel>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Testing Message" onclick="bCancel=true;">
	</bean:define>
</logic:equal>


<logic:equal name="runTest" value="testCancelBodyContentMessageKey_fr">
	<bean:define id="TEST_RESULTS" toScope="page">
		<html:cancel>
			<bean:message key="default.bundle.message"/>
		</html:cancel>
	</bean:define>
	<bean:define id="EXPECTED_RESULTS" toScope="page">
		<input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="Message D'Essai" onclick="bCancel=true;">
	</bean:define>
</logic:equal>

<% 
String expected = "";
String compareTo = "";

if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
    throw new javax.servlet.jsp.JspException("No tests on this page were called.  Please verify that you've setup the tests correctly.");
}else{
	expected=pageContext.getAttribute("TEST_RESULTS").toString();
}
if (pageContext.getAttribute("TEST_RESULTS") != null){
	compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
}

Assert.assertEquals(expected, compareTo);
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -