本文整理汇总了Java中org.apache.ecs.html.Input.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Input.setValue方法的具体用法?Java Input.setValue怎么用?Java Input.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ecs.html.Input
的用法示例。
在下文中一共展示了Input.setValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeUsername
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
protected Element makeUsername(WebSession s)
{
ElementContainer ec = new ElementContainer();
StringBuffer script = new StringBuffer();
script.append("<STYLE TYPE=\"text/css\"> ");
script.append(".blocklabel { margin-top: 8pt; }");
script.append(".myClass { color:red;");
script.append(" font-weight: bold;");
script.append("padding-left: 1px;");
script.append("padding-right: 1px;");
script.append("background: #DDDDDD;");
script.append("border: thin black solid; }");
script.append("LI { margin-top: 10pt; }");
script.append("</STYLE>");
ec.addElement(new StringElement(script.toString()));
ec.addElement(new StringElement("User ID: "));
Input username = new Input(Input.TEXT, "username", "");
ec.addElement(username);
String userInput = s.getParser().getRawParameter("username", "");
ec.addElement(new BR());
ec.addElement(new BR());
String formattedInput = "<span class='myClass'>" + userInput + "</span>";
ec.addElement(new Div(SELECT_ST + formattedInput));
Input b = new Input();
b.setName("Submit");
b.setType(Input.SUBMIT);
b.setValue("Submit");
ec.addElement(new PRE(b));
return ec;
}
示例2: createContent
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
protected Element createContent(WebSession s)
{
ElementContainer ec = new ElementContainer();
if (s.getRequest().getMethod().equalsIgnoreCase("POST"))
{
makeSuccess(s);
}
String lineSep = System.getProperty("line.separator");
String script = "<script>" + lineSep + "function validate() {" + lineSep
+ "var keyField = document.getElementById('key');" + lineSep + "var url = '" + getLink()
+ "&from=ajax&key=' + encodeURIComponent(keyField.value);" + lineSep
+ "if (typeof XMLHttpRequest != 'undefined') {" + lineSep + "req = new XMLHttpRequest();" + lineSep
+ "} else if (window.ActiveXObject) {" + lineSep + "req = new ActiveXObject('Microsoft.XMLHTTP');"
+ lineSep + " }" + lineSep + " req.open('GET', url, true);" + lineSep
+ " req.onreadystatechange = callback;" + lineSep + " req.send(null);" + lineSep + "}" + lineSep
+ "function callback() {" + lineSep + " if (req.readyState == 4) { " + lineSep
+ " if (req.status == 200) { " + lineSep + " var message = req.responseText;" + lineSep
+ " var messageDiv = document.getElementById('MessageDiv');" + lineSep + " try {" + lineSep
+ " eval(message);" + lineSep + " " + lineSep
+ " messageDiv.innerHTML = 'Correct licence Key.' " + lineSep + " }" + lineSep
+ " catch(err)" + lineSep + " { " + lineSep + " messageDiv.innerHTML = 'Wrong license key.'"
+ lineSep + "} " + lineSep + " }}}" + lineSep + "</script>" + lineSep;
ec.addElement(new StringElement(script));
ec.addElement(new BR().addElement(new H1().addElement("Welcome to WebGoat Registration Page:")));
ec.addElement(new BR()
.addElement("Please enter the license key that was emailed to you to start using the application."));
ec.addElement(new BR());
ec.addElement(new BR());
Table t1 = new Table().setCellSpacing(0).setCellPadding(0).setBorder(0).setWidth("70%").setAlign("center");
TR tr = new TR();
tr.addElement(new TD(new StringElement("License Key: ")));
Input input1 = new Input(Input.TEXT, KEY, "");
input1.setID(KEY);
input1.addAttribute("onkeyup", "validate();");
tr.addElement(new TD(input1));
t1.addElement(tr);
tr = new TR();
tr.addElement(new TD(" ").setColSpan(2));
t1.addElement(tr);
tr = new TR();
Input b = new Input();
b.setType(Input.SUBMIT);
b.setValue("Activate!");
b.setName("SUBMIT");
b.setID("SUBMIT");
b.setDisabled(true);
tr.addElement(new TD(" "));
tr.addElement(new TD(b));
t1.addElement(tr);
ec.addElement(t1);
Div div = new Div();
div.addAttribute("name", "MessageDiv");
div.addAttribute("id", "MessageDiv");
ec.addElement(div);
return ec;
}
示例3: makeButton
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
/**
* Description of the Method
*
* @param text
* Description of the Parameter
* @return Description of the Return Value
*/
public static Element makeButton(String text)
{
Input b = new Input();
b.setType(Input.SUBMIT);
b.setValue(text);
b.setName(Input.SUBMIT);
return (b);
}
示例4: makeOnClickInput
import org.apache.ecs.html.Input; //导入方法依赖的package包/类
/**
* Description of the Method
*
* @param text
* Description of the Parameter
* @param clickAction
* Description of the Parameter
* @param type
* Description of the Parameter
* @return Description of the Return Value
*/
public static Input makeOnClickInput(String text, String clickAction, String type)
{
Input b = new Input();
b.setType(type);
b.setValue(text);
b.setOnClick(clickAction);
return (b);
}