nodejs 发送短信 |
|
|
var request = require("request");
request({
uri: "http://utf8.sms.webchinese.cn/",
method: "POST",
form: {
Uid: "dsr_22",
key: '87390ad029fe9acbb583',
smsMob: '13916754197',
smsText: '您的奶粉到货了'
}
}, function(error, response, body) {
console.log(body);
});
|
RadioButton |
|
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.dsr;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
/**
*
* @author dsr
*/
@ManagedBean(name = "radioBean" )
@SessionScoped
public class RadioBean {
private String state="bbb";
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
private List<Field> fieldList;
public RadioBean(){
fieldList = new ArrayList<Field>();
fieldList.add(new Field("Build up","bbb","ss","aa"));
fieldList.add(new Field("Build down","aaa","ss","aa"));
}
public List<Field> getFieldList() {
return fieldList;
}
public void setFieldList(List<Field> fieldList) {
this.fieldList = fieldList;
}
}
|
Field |
|
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.dsr;
/**
*
* @author dsr
*/
public class Field{
private String field;
private String required;
private String optional;
private String nonRequired;
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public String getNonRequired() {
return nonRequired;
}
public void setNonRequired(String nonRequired) {
this.nonRequired = nonRequired;
}
public String getOptional() {
return optional;
}
public void setOptional(String optional) {
this.optional = optional;
}
public String getRequired() {
return required;
}
public void setRequired(String required) {
this.required = required;
}
public Field(String field, String required, String optional, String nonRequired) {
this.field = field;
this.required = required;
this.optional = optional;
this.nonRequired = nonRequired;
}
}
|
activityCode.xhtml |
|
|
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>Facelet Title</title>
<style>
.radioClass td{
border: none!important;
}
</style>
<script>
//<![CDATA[
function uncheckOthers(radio) {
var name = radio.id.substring(radio.id.indexOf(':')+1,radio.id.length);
var name2 = name.substring(name.indexOf(':')+1,name.length);
var name3 = name2.substring(0,name2.indexOf(':'));
var require = name3 + ':r:0';
var optional = name3 + ':o:0';
var non = name3 + ':n:0';
var elements = radio.form.elements;
for (var i = 0; i < elements.length; i++) {
var elementName = elements[i].id.substring(elements[i].id.indexOf(':')+1,elements[i].id.length);
var elementName2 = elementName.substring(elementName.indexOf(':')+1,elementName.length)
if (elementName2 == require) {
elements[i].checked = false;
}
if (elementName2 == optional) {
elements[i].checked = false;
}
if (elementName2 == non) {
elements[i].checked = false;
}
}
radio.checked = true;
}
//]]>
</script>
</h:head>
<h:body>
<h:form>
<p:dataTable var="cc" value="#{radioBean.fieldList}">
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="Fields" />
<p:column colspan="3" headerText="Applicable" />
</p:row>
<p:row>
<p:column headerText="Required" />
<p:column headerText="Optional" />
<p:column headerText="Non-required" />
</p:row>
</p:columnGroup>
<p:column>
<h:outputLabel value="#{cc.field}"></h:outputLabel>
</p:column>
<p:column>
<h:selectOneRadio id="r" class="radioClass" value="#{cc.required}" onclick="uncheckOthers(this);">
<f:selectItem itemValue="bbb" ></f:selectItem>
</h:selectOneRadio>
</p:column>
<p:column>
<h:selectOneRadio id="o" class="radioClass" onclick="uncheckOthers(this);">
<f:selectItem ></f:selectItem>
</h:selectOneRadio>
</p:column>
<p:column>
<h:selectOneRadio id="n" class="radioClass" onclick="uncheckOthers(this);">
<f:selectItem ></f:selectItem>
</h:selectOneRadio>
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
|