當前位置: 首頁>>代碼示例>>Java>>正文


Java Input.setValue方法代碼示例

本文整理匯總了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;
}
 
開發者ID:RIGS-IT,項目名稱:sonar-xanitizer,代碼行數:39,代碼來源:BackDoors.java

示例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("&nbsp;").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("&nbsp;"));
	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;
}
 
開發者ID:RIGS-IT,項目名稱:sonar-xanitizer,代碼行數:68,代碼來源:DOMInjection.java

示例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);
}
 
開發者ID:RIGS-IT,項目名稱:sonar-xanitizer,代碼行數:20,代碼來源:ECSFactory.java

示例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);
}
 
開發者ID:RIGS-IT,項目名稱:sonar-xanitizer,代碼行數:26,代碼來源:ECSFactory.java


注:本文中的org.apache.ecs.html.Input.setValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。