[Jsptest-svn-commits] SF.net SVN: jsptest:[263] trunk
Status: Alpha
Brought to you by:
lkoskela
From: <lko...@us...> - 2009-11-13 12:11:45
|
Revision: 263 http://jsptest.svn.sourceforge.net/jsptest/?rev=263&view=rev Author: lkoskela Date: 2009-11-13 12:11:24 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Added a sample project under version control Added Paths: ----------- trunk/jsptest-samples/ trunk/jsptest-samples/jsptest-samples-jsp20/ trunk/jsptest-samples/jsptest-samples-jsp20/.classpath trunk/jsptest-samples/jsptest-samples-jsp20/.project trunk/jsptest-samples/jsptest-samples-jsp20/pom.xml trunk/jsptest-samples/jsptest-samples-jsp20/src/ trunk/jsptest-samples/jsptest-samples-jsp20/src/main/ trunk/jsptest-samples/jsptest-samples-jsp20/src/main/java/ trunk/jsptest-samples/jsptest-samples-jsp20/src/main/webapp/ trunk/jsptest-samples/jsptest-samples-jsp20/src/main/webapp/WEB-INF/ trunk/jsptest-samples/jsptest-samples-jsp20/src/main/webapp/index.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/FormAssertionTest.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/PageAssertionTest.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTag.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTagTest.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/RequestAndSessionAttributeTest.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibTest.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibsDefinedInJarFileTest.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/log4j.properties trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/custom-taglib.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/fmt.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/fn.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/sql.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/web.xml trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/x.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/echo_attributes.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/html/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/html/forms/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/html/forms/simpleform.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/html/simple.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/index.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/name$_test-file2.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/su-b.dir/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/su-b.dir/page_in_sub.dir.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/sub/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/sub/dir/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/sub/dir/page_in_subdir.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/taglibs/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/taglibs/custom-taglib.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/taglibs/standard-taglibs.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/WEB-INF/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/WEB-INF/custom-taglib.tld trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/WEB-INF/lib/ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/WEB-INF/lib/tlds.jar trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/WEB-INF/web.xml trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/custom-taglib.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/index.jsp trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc2/standard-taglibs.jsp Property changes on: trunk/jsptest-samples/jsptest-samples-jsp20 ___________________________________________________________________ Added: svn:ignore + target Added: trunk/jsptest-samples/jsptest-samples-jsp20/.classpath =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/.classpath (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/.classpath 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,48 @@ +<classpath> + <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/> + <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/> + <classpathentry kind="src" path="src/main/java" including="**/*.java"/> + <classpathentry kind="output" path="target/classes"/> + <classpathentry kind="var" path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/> + <classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar"/> + <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"/> + <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar"/> + <classpathentry kind="var" path="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0.jar"/> + <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar"/> + <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/> + <classpathentry kind="var" path="M2_REPO/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar"/> + <classpathentry kind="var" path="M2_REPO/tomcat/jasper-compiler/5.5.15/jasper-compiler-5.5.15.jar"/> + <classpathentry kind="var" path="M2_REPO/tomcat/jasper-runtime/5.5.15/jasper-runtime-5.5.15.jar"/> + <classpathentry kind="var" path="M2_REPO/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar"/> + <classpathentry kind="var" path="M2_REPO/net/sf/jsptest/jsptest-common/0.19/jsptest-common-0.19.jar" sourcepath="M2_REPO/net/sf/jsptest/jsptest-common/0.19/jsptest-common-0.19-sources.jar"> + <attributes> + <attribute value="jar:file:/Users/lkoskela/.m2/repository/net/sf/jsptest/jsptest-common/0.19/jsptest-common-0.19-javadoc.jar!/" name="javadoc_location"/> + </attributes> + </classpathentry> + <classpathentry kind="var" path="M2_REPO/net/sf/jsptest/jsptest-compiler-api/0.19/jsptest-compiler-api-0.19.jar" sourcepath="M2_REPO/net/sf/jsptest/jsptest-compiler-api/0.19/jsptest-compiler-api-0.19-sources.jar"> + <attributes> + <attribute value="jar:file:/Users/lkoskela/.m2/repository/net/sf/jsptest/jsptest-compiler-api/0.19/jsptest-compiler-api-0.19-javadoc.jar!/" name="javadoc_location"/> + </attributes> + </classpathentry> + <classpathentry kind="var" path="M2_REPO/net/sf/jsptest/jsptest-framework/0.19/jsptest-framework-0.19.jar" sourcepath="M2_REPO/net/sf/jsptest/jsptest-framework/0.19/jsptest-framework-0.19-sources.jar"> + <attributes> + <attribute value="jar:file:/Users/lkoskela/.m2/repository/net/sf/jsptest/jsptest-framework/0.19/jsptest-framework-0.19-javadoc.jar!/" name="javadoc_location"/> + </attributes> + </classpathentry> + <classpathentry kind="var" path="M2_REPO/net/sf/jsptest/jsptest-jsp20/0.19/jsptest-jsp20-0.19.jar" sourcepath="M2_REPO/net/sf/jsptest/jsptest-jsp20/0.19/jsptest-jsp20-0.19-sources.jar"> + <attributes> + <attribute value="jar:file:/Users/lkoskela/.m2/repository/net/sf/jsptest/jsptest-jsp20/0.19/jsptest-jsp20-0.19-javadoc.jar!/" name="javadoc_location"/> + </attributes> + </classpathentry> + <classpathentry kind="var" path="M2_REPO/jtidy/jtidy/4aug2000r7-dev/jtidy-4aug2000r7-dev.jar"/> + <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar"/> + <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar"/> + <classpathentry kind="var" path="M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar"/> + <classpathentry kind="var" path="M2_REPO/xalan/xalan/2.6.0/xalan-2.6.0.jar"/> + <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/> + <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.3.02/xml-apis-1.3.02.jar"/> + <classpathentry kind="var" path="M2_REPO/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar"/> + <classpathentry kind="var" path="M2_REPO/xom/xom/1.0/xom-1.0.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> +</classpath> \ No newline at end of file Added: trunk/jsptest-samples/jsptest-samples-jsp20/.project =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/.project (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/.project 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,13 @@ +<projectDescription> + <name>jsptest-samples-jsp20</name> + <comment>Example project that makes use of JspTest</comment> + <projects/> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> \ No newline at end of file Added: trunk/jsptest-samples/jsptest-samples-jsp20/pom.xml =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/pom.xml (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/pom.xml 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-samples-jsp20</artifactId> + <version>0.19</version> + <packaging>jar</packaging> + <name>jsptest-samples-jsp20</name> + <description>Example project that makes use of JspTest</description> + <dependencies> + <dependency> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-jsp20</artifactId> + <version>0.19</version> + </dependency> + </dependencies> +</project> Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/main/webapp/index.jsp =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/main/webapp/index.jsp (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/main/webapp/index.jsp 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,9 @@ +<%@ page language="Java" %> +<html> + <head> + <title>Index</title> + </head> + <body> + <p>Hello, <%= "World" %></p> + </body> +</html> \ No newline at end of file Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/FormAssertionTest.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/FormAssertionTest.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/FormAssertionTest.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,77 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.html; + +import junit.framework.AssertionFailedError; +import net.sf.jsptest.HtmlTestCase; + +/** + * @author Lasse Koskela + */ +public class FormAssertionTest extends HtmlTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + public void testFormFieldPresent() throws Exception { + get("/html/forms/simpleform.jsp"); + form().shouldHaveField("text_field_1"); + form().shouldHaveField("text_field_2"); + try { + form().shouldHaveField("text_field_3"); + throw new RuntimeException("There is no such field!"); + } catch (AssertionFailedError expected) { + } + } + + public void testAssertingAgainstFormFieldValue() throws Exception { + setRequestAttribute("j_username", "bob"); + get("/html/forms/simpleform.jsp"); + form("form_name").field("text_field_1") + .shouldHaveValue("one"); + form("form_name").field("text_field_2") + .shouldHaveValue("two"); + try { + form("form_name").field("text_field_1").shouldHaveValue( + "three"); + throw new RuntimeException( + "The field value shouldn't match!"); + } catch (AssertionFailedError expected) { + } + } + + public void testFormHasNamedSubmitButton() throws Exception { + get("/html/forms/simpleform.jsp"); + form("form_name").shouldHaveSubmitButton("GO"); + try { + form("form_name").shouldHaveSubmitButton("NOSUCHBUTTON"); + throw new RuntimeException("There is no such button!"); + } catch (AssertionFailedError expected) { + } + } + + public void testFormHasUnnamedSubmitButton() throws Exception { + get("/html/forms/simpleform.jsp"); + form("form_name").shouldHaveSubmitButton(); + try { + form("form_without_buttons").shouldHaveSubmitButton(); + throw new RuntimeException("There is no submit buttons!"); + } catch (AssertionFailedError expected) { + } + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/PageAssertionTest.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/PageAssertionTest.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/html/PageAssertionTest.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,40 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.html; + +import junit.framework.AssertionFailedError; +import net.sf.jsptest.HtmlTestCase; + +/** + * @author Lasse Koskela + */ +public class PageAssertionTest extends HtmlTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + public void testPageShouldContain() throws Exception { + get("/html/simple.jsp"); + page().shouldContain("Hello from Jasper"); + try { + page().shouldContain("no such content"); + throw new RuntimeException(); + } catch (AssertionFailedError expected) { + } + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,80 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import junit.framework.AssertionFailedError; +import net.sf.jsptest.HtmlTestCase; + +/** + * @author Lasse Koskela + */ +public class BasicJspTest extends HtmlTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + public void testRenderingTrivialJsp() throws Exception { + get("/index.jsp"); + output().shouldContain("Hello from Jasper"); + } + + public void testOutputAssertion() throws Exception { + get("/index.jsp"); + output().shouldContain("Hello from Jasper"); + try { + output().shouldContain("No such content"); + throw new RuntimeException("Assertion should've failed"); + } catch (AssertionFailedError expected) { + } + } + + public void testRenderingSameJspMultipleTimes() throws Exception { + for (int i = 0; i < 5; i++) { + get("/index.jsp"); + output().shouldContain("Hello from Jasper"); + } + } + + public void testJspFileWithSpecialCharactersInName() + throws Exception { + get("/name$_test-file2.jsp"); + output().shouldContain("Hello from Jasper"); + } + + public void testJspFileInSubDirectory() throws Exception { + get("/sub/dir/page_in_subdir.jsp"); + output().shouldContain("Hello from Jasper"); + } + + public void testJspFileInSubDirectoryWithSpecialCharsInPath() + throws Exception { + get("/su-b.dir/page_in_sub.dir.jsp"); + output().shouldContain("Hello from Jasper"); + } + + public void testJspPathNotStartingWithSlash() throws Exception { + try { + get("sub/dir/page_in_subdir.jsp"); + fail("JSP path not starting with a slash should raise an exception"); + } catch (AssertionFailedError pass) { + throw pass; + } catch (Throwable e) { + assertEquals(IllegalArgumentException.class, e.getClass()); + } + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTag.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTag.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTag.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,97 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import java.io.IOException; +import java.util.Enumeration; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +/** + * @author Lasse Koskela + */ +public class CustomTag extends TagSupport { + + protected String timezone; + + public void setTz(String timezone) { + this.timezone = timezone; + } + + private HttpServletRequest getRequest() { + return ((HttpServletRequest) pageContext.getRequest()); + } + + public int doStartTag() throws JspException { + return TagSupport.EVAL_BODY_INCLUDE; + } + + public int doAfterBody() throws JspException { + try { + JspWriter out = pageContext.getOut(); + out.println("<pre>"); + out + .println("This content is coming from CustomTag for timezone " + + timezone); + printRequestMethod(out); + printRequestAttributes(out); + printSessionAttributes(out); + out.println("</pre>"); + } catch (Exception e) { + e.printStackTrace(System.err); + throw new JspException(e); + } + return TagSupport.EVAL_PAGE; + } + + private void printRequestMethod(JspWriter out) throws IOException { + out.println("HTTP request method: " + + getRequest().getMethod()); + } + + private void printRequestAttributes(JspWriter out) + throws IOException { + Enumeration attrNames = getRequest().getAttributeNames(); + while (attrNames.hasMoreElements()) { + String name = (String) attrNames.nextElement(); + String value = String.valueOf(getRequest().getAttribute( + name)); + out.println("HTTP request attribute: " + name + "=" + + value); + } + } + + private void printSessionAttributes(JspWriter out) + throws IOException { + HttpSession session = getRequest().getSession(true); + Enumeration attrNames = session.getAttributeNames(); + while (attrNames.hasMoreElements()) { + String name = (String) attrNames.nextElement(); + String value = String.valueOf(session.getAttribute(name)); + out.println("HTTP session attribute: " + name + "=" + + value); + } + } + + public int doEndTag() throws JspException { + return TagSupport.EVAL_PAGE; + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTagTest.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTagTest.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/CustomTagTest.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,75 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import net.sf.jsptest.JspTestCase; + +/** + * @author Lasse Koskela + */ +public class CustomTagTest extends JspTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + public void testRenderingJspUsingCustomTaglibs() throws Exception { + get("/taglibs/custom-taglib.jsp"); + output().shouldContain( + "This content is coming from CustomTag"); + } + + public void testTaglibAttributes() throws Exception { + get("/taglibs/custom-taglib.jsp"); + output().shouldContain("timezone GMT"); + output().shouldContain("timezone EST"); + } + + public void testRequestMethods() throws Exception { + // GET + get("/taglibs/custom-taglib.jsp"); + output().shouldContain("HTTP request method: GET"); + // POST + post("/taglibs/custom-taglib.jsp"); + output().shouldContain("HTTP request method: POST"); + } + + public void testRequestAndSessionAttributes() throws Exception { + // GET + setRequestAttribute("Rn1", "Rv1"); + setRequestAttribute("Rn2", "Rv2"); + setSessionAttribute("Sn1", "Sv1"); + setSessionAttribute("Sn2", "Sv2"); + get("/taglibs/custom-taglib.jsp"); + output().shouldContain("request attribute: Rn1=Rv1"); + output().shouldContain("request attribute: Rn2=Rv2"); + output().shouldContain("session attribute: Sn1=Sv1"); + output().shouldContain("session attribute: Sn2=Sv2"); + + // POST + setRequestAttribute("Rn1", "Rv1"); + setRequestAttribute("Rn2", "Rv2"); + setSessionAttribute("Sn1", "Sv1"); + setSessionAttribute("Sn2", "Sv2"); + post("/taglibs/custom-taglib.jsp"); + output().shouldContain("request attribute: Rn1=Rv1"); + output().shouldContain("request attribute: Rn2=Rv2"); + output().shouldContain("session attribute: Sn1=Sv1"); + output().shouldContain("session attribute: Sn2=Sv2"); + } + +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/RequestAndSessionAttributeTest.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/RequestAndSessionAttributeTest.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/RequestAndSessionAttributeTest.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,63 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import net.sf.jsptest.JspTestCase; + +/** + * Unit testing JavaServer Pages has never been this easy! + */ +public class RequestAndSessionAttributeTest extends JspTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + public void testRequestAttributes() throws Exception { + setRequestAttribute("Rn1", "Rv1"); + setRequestAttribute("Rn2", "Rv2"); + get("/echo_attributes.jsp"); + output().shouldContain("request attribute: 'Rn1'='Rv1'"); + output().shouldContain("request attribute: 'Rn2'='Rv2'"); + } + + public void testSessionAttributes() throws Exception { + setSessionAttribute("Sn1", "Sv1"); + setSessionAttribute("Sn2", "Sv2"); + get("/echo_attributes.jsp"); + output().shouldContain("session attribute: 'Sn1'='Sv1'"); + output().shouldContain("session attribute: 'Sn2'='Sv2'"); + } + + public void testRequestAndSessionAttributesCanBeObjects() + throws Exception { + setRequestAttribute("request", (Object) "1"); + setSessionAttribute("session", (Object) new Integer(2)); + get("/echo_attributes.jsp"); + output().shouldContain("request attribute: 'request'='1'"); + output().shouldContain("session attribute: 'session'='2'"); + } + + public void testSessionAndRequestAttributesDontOverrideEachOther() + throws Exception { + setRequestAttribute("name", "request"); + setSessionAttribute("name", "session"); + get("/echo_attributes.jsp"); + output().shouldContain("request attribute: 'name'='request'"); + output().shouldContain("session attribute: 'name'='session'"); + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibTest.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibTest.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibTest.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,36 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import net.sf.jsptest.JspTestCase; + +/** + * @author Lasse Koskela + */ +public class TaglibTest extends JspTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + public void testStandardTaglibsWork() throws Exception { + get("/taglibs/standard-taglibs.jsp"); + for (int i = 1; i <= 10; i++) { + output().shouldContain("loop-" + i); + } + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibsDefinedInJarFileTest.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibsDefinedInJarFileTest.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TaglibsDefinedInJarFileTest.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,36 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import net.sf.jsptest.JspTestCase; + +/** + * @author Lasse Koskela + */ +public class TaglibsDefinedInJarFileTest extends JspTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc2"; + } + + public void testStandardTaglibsWork() throws Exception { + get("/standard-taglibs.jsp"); + for (int i = 1; i <= 10; i++) { + output().shouldContain("loop-" + i); + } + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,63 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +import net.sf.jsptest.JspTestCase; + +/** + * @author Lasse Koskela + */ +public class TestMockingTaglibs extends JspTestCase { + + protected String getJspPackageName() { + return "cust.om.tags"; + } + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + /** + * This taglib class gets to replace the real thing. + */ + public static class MockCustomTag extends CustomTag { + public int doAfterBody() throws JspException { + try { + JspWriter out = pageContext.getOut(); + out.println("<pre>"); + out + .println("This content is coming from the mock CustomTag" + + " for timezone " + timezone); + out.println("</pre>"); + } catch (Exception e) { + throw new JspException(e); + } + return TagSupport.EVAL_PAGE; + } + } + + public void testRenderingJspUsingCustomTaglibs() throws Exception { + substituteTaglib("custom", MockCustomTag.class); + get("/taglibs/custom-taglib.jsp"); + output().shouldContain( + "This content is coming from the mock CustomTag"); + } +} Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/log4j.properties =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/log4j.properties (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/log4j.properties 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,8 @@ +log4j.rootCategory=INFO, CONSOLE + +log4j.category.org.apache.commons.logging=WARN +log4j.category.net.sf.jsptest=DEBUG + +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%d{ISO8601}]%8.8p: %30.50c{6} -- %m%n Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,393 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE taglib + PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" + "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> +<taglib> + <tlib-version>1.0</tlib-version> + <jsp-version>1.2</jsp-version> + <short-name>c_rt</short-name> + <uri>http://java.sun.com/jstl/core_rt</uri> + <display-name>JSTL core RT</display-name> + <description>JSTL 1.0 core library</description> + + <validator> + <validator-class> + org.apache.taglibs.standard.tlv.JstlCoreTLV + </validator-class> + <description> + Provides core validation features for JSTL tags. + </description> + </validator> + + <tag> + <name>catch</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class> + <body-content>JSP</body-content> + <description> + Catches any Throwable that occurs in its body and optionally + exposes it. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>choose</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + </description> + </tag> + + <tag> + <name>if</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + </description> + <attribute> + <name>test</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>boolean</type> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>import</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class> + <body-content>JSP</body-content> + <description> + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + </description> + <attribute> + <name>url</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varReader</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>charEncoding</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forEach</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class> + <body-content>JSP</body-content> + <description> + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + </description> + <attribute> + <name>items</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object</type> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forTokens</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class> + <body-content>JSP</body-content> + <description> + Iterates over tokens, separated by the supplied delimeters + </description> + <attribute> + <name>items</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.String</type> + </attribute> + <attribute> + <name>delims</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.String</type> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>out</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class> + <body-content>JSP</body-content> + <description> + Like <%= ... >, but for expressions. + </description> + <attribute> + <name>value</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>default</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>escapeXml</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + + <tag> + <name>otherwise</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + </description> + </tag> + + <tag> + <name>param</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class> + <body-content>JSP</body-content> + <description> + Adds a parameter to a containing 'import' tag's URL. + </description> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>redirect</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class> + <body-content>JSP</body-content> + <description> + Redirects to a new URL. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>url</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>remove</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class> + <body-content>empty</body-content> + <description> + Removes a scoped variable (from a particular scope, if specified). + </description> + <attribute> + <name>var</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>set</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class> + <body-content>JSP</body-content> + <description> + Sets the result of an expression evaluation in a 'scope' + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>target</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>property</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>url</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class> + <body-content>JSP</body-content> + <description> + Creates a URL with optional query parameters. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>when</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + </description> + <attribute> + <name>test</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>boolean</type> + </attribute> + </tag> + +</taglib> Added: trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c.tld =================================================================== --- trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c.tld (rev 0) +++ trunk/jsptest-samples/jsptest-samples-jsp20/src/test/resources/websrc/WEB-INF/c.tld 2009-11-13 12:11:24 UTC (rev 263) @@ -0,0 +1,416 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE taglib + PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" + "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> +<taglib> + <tlib-version>1.0</tlib-version> + <jsp-version>1.2</jsp-version> + <short-name>c</short-name> + <uri>http://java.sun.com/jstl/core</uri> + <display-name>JSTL core</display-name> + <description>JSTL 1.0 core library</description> + + <validator> + <validator-class> + org.apache.taglibs.standard.tlv.JstlCoreTLV + </validator-class> + <init-param> + <param-name>expressionAttributes</param-name> + <param-value> + out:value + out:default + out:escapeXml + if:test + import:url + import:context + import:charEncoding + forEach:items + forEach:begin + forEach:end + forEach:step + forTokens:items + forTokens:begin + forTokens:end + forTokens:step + param:encode + param:name + param:value + redirect:context + redirect:url + set:property + set:target + set:value + url:context + url:value + when:test + </param-value> + <description> + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + </description> + </init-param> + </validator> + + <tag> + <name>catch</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class> + <body-content>JSP</body-content> + <description> + Catches any Throwable that occurs in its body and optionally + exposes it. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>choose</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + </description> + </tag> + + <tag> + <name>out</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.OutTag</tag-class> + <body-content>JSP</body-content> + <description> + Like <%= ... >, but for expressions. + </description> + <attribute> + <name>value</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>default</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>escapeXml</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>if</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.IfTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + </description> + <attribute> + <name>test</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>import</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ImportTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class> + <body-content>JSP</body-content> + <description> + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + </description> + <attribute> + <name>url</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varReader</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>charEncoding</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forEach</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ForEachTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class> + <body-content>JSP</body-content> + <description> + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + </description> + <attribute> + <name>items</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forTokens</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ForTokensTag</tag-class> + <body-content>JSP</body-content> + <description> + Iterates over tokens, separated by the supplied delimeters + </description> + <attribute> + <name>items</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>delims</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>otherwise</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + </description> + </tag> + + <tag> + <name>param</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ParamTag</tag-class> + <body-content>JSP</body-content> + <description> + Adds a parameter to a containing 'import' tag's URL. + </description> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>redirect</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.RedirectTag</tag-class> + <body-content>JSP</body-content> + <description> + Redirects to a new URL. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>url</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>remove</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class> + <body-content>empty</body-content> + <description> + Removes a scoped variable (from a particular scope, if specified). + </description> + <attribute> + <name>var</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>set</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.SetTag</tag-class> + <body-content>JSP</body-content> + <description> + Sets the result of an expression evaluation in a 'scope' + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>target</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>property</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>url</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.UrlTag</tag-class> + <body-content>JSP</body-content> + <description> + Prints or exposes a URL with optional query parameters + (via the c:param tag). + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>when</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.WhenTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + </description> + <attribute> + <name>test</name> + <required>true</required> ... [truncated message content] |