public class ERXWOSwitch
extends com.webobjects.appserver.WODynamicElement
==========================
Example.wo/Example.html (modern syntax)
==========================
<wo:ERXWOSwitch case="$case">
<wo:ERXWOCase case="caseOne">
Case One!
</wo:ERXWOCase>
<wo:ERXWOCase case="caseTwo">
Case Two!
</wo:ERXWOCase>
<wo:ERXWOCase case="default">
OTHER
</wo:ERXWOCase>
</wo:ERXWOSwitch>
==========================
Example.wo/Example.html (traditional syntax, with wod below)
==========================
<webobject name=Switch>
<webobject name=CaseOne>
<h2>One: <webobject name=ChosenCaseString></webobject></h2>
</webobject>
<webobject name=CaseTwo>
<h2>Two: <webobject name=ChosenCaseString></webobject></h2>
</webobject>
<webobject name=CaseThree>
<h2>Three: <webobject name=ChosenCaseString></webobject></h2>
</webobject>
<webobject name=CaseFour>
<h2>Four: <webobject name=ChosenCaseString></webobject></h2>
</webobject>
<webobject name=DefaultCase>
<h2>Default: <webobject name=ChosenCaseString></webobject></h2>
</webobject>
</webobject>
==========================
Example.wo/Example.wod
==========================
Switch: ERXWOSwitch {
case = chosenCase;
}
CaseFour: ERXWOCase {
case = "Fourth";
}
CaseOne: ERXWOCase {
case = "First";
}
CaseThree: ERXWOCase {
case = "Third";
}
CaseTwo: ERXWOCase {
case = 2;
}
DefaultCase: ERXWOCase {
case = "default";
}
ChosenCaseString: WOString {
value = chosenCase;
}
==========================
Example.java
==========================
public Object chosenCase() {
Object objects = new Object[] {"Fourth", "Third", "First", Integer.valueOf(2), "dummy"};
return objects[(new Random()).nextInt(objects.length)];
}
Name | Description |
---|---|
case | the ivar that holds the value to be switched on |
Constructor and Description |
---|
ERXWOSwitch(String name,
NSDictionary<String,com.webobjects.appserver.WOAssociation> associations,
com.webobjects.appserver.WOElement template) |
Modifier and Type | Method and Description |
---|---|
void |
appendToResponse(com.webobjects.appserver.WOResponse woresponse,
com.webobjects.appserver.WOContext wocontext) |
protected com.webobjects.appserver.WOElement |
childCaseInContext(com.webobjects.appserver.WOContext context) |
com.webobjects.appserver.WOActionResults |
invokeAction(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext wocontext) |
void |
takeValuesFromRequest(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext wocontext) |
public ERXWOSwitch(String name, NSDictionary<String,com.webobjects.appserver.WOAssociation> associations, com.webobjects.appserver.WOElement template)
protected com.webobjects.appserver.WOElement childCaseInContext(com.webobjects.appserver.WOContext context)
public void appendToResponse(com.webobjects.appserver.WOResponse woresponse, com.webobjects.appserver.WOContext wocontext)
appendToResponse
in class com.webobjects.appserver.WOElement
public com.webobjects.appserver.WOActionResults invokeAction(com.webobjects.appserver.WORequest worequest, com.webobjects.appserver.WOContext wocontext)
invokeAction
in class com.webobjects.appserver.WOElement
public void takeValuesFromRequest(com.webobjects.appserver.WORequest worequest, com.webobjects.appserver.WOContext wocontext)
takeValuesFromRequest
in class com.webobjects.appserver.WOElement
Copyright © 2002 – 2020 Project Wonder.