当前位置: 首页>>代码示例>>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;未经允许,请勿转载。