当前位置: 编程技术>WEB前端
本页文章导读:
▪静态select回显 页面:
<select style="width:80px;" id="selectjob" name="expenseAccount.payShape">
<option value="转账">转账</option>
&nbs.........
▪liunx命令 ./startup.sh ;tail -f ../logs/catalina.out 启动tomcat
作者:woshiyjk 发表于2013-3-1 14:49:39 原文链接
阅读:1 评论:0 查看评论
......
▪ajax struts2 给下拉框赋值 一、js代码$(function(){
$.ajax({
type:'post',
url:'${ctx}/dictionary/listChannel.do',
data:'',
dataType:'json',
success:function(json){
for(var i=0; i< json.length;i++){
$("#channel_id").append(&.........
[1]静态select回显
来源: 互联网 发布时间: 2013-11-06
页面:
<select style="width:80px;" id="selectjob" name="expenseAccount.payShape">
<option value="转账">转账</option>
<option value="公务卡">公务卡</option>
<option value="现金">现金</option>
<option value="集中支付">集中支付</option>
</select>
<input type="hidden" id="selectstate" value="${expenseAccount.payShape}"/><%--影藏保存在数据库中的值,以便jquery中比较--%>
jquery:
$(document).ready(function(){
var yms_name=$("#selectjob>option");
var nameselect=$("#selectstate").val();
for(var i=0;i<yms_name.length;i++){
var svalue=yms_name[i].text;
if(nameselect==svalue){
$("#selectjob option[value='"+svalue+"']").attr("selected","selected");
}
}
});
作者:yangyz_love 发表于2013-3-1 14:50:56 原文链接
阅读:0 评论:0 查看评论
[2]liunx命令
来源: 互联网 发布时间: 2013-11-06
./startup.sh ;tail -f ../logs/catalina.out 启动tomcat
作者:woshiyjk 发表于2013-3-1 14:49:39 原文链接
阅读:1 评论:0 查看评论
[3]ajax struts2 给下拉框赋值
来源: 互联网 发布时间: 2013-11-06
一、js代码
$(function(){ $.ajax({ type:'post', url:'${ctx}/dictionary/listChannel.do', data:'', dataType:'json', success:function(json){ for(var i=0; i< json.length;i++){ $("#channel_id").append("<option value='" +json[i].value_Id+"'>" +json[i].value+"</option>"); } }, error:function(){ alert('error'); } }); //选择渠道信息时候,加载版本信息
$("#channel_id").change(function(){ var channel_id=$("#channel_id").val(); $("#version_id").empty(); if (""!= channel_id) { //查询版本信息 $.ajax({ type:'post', url:'${ctx}/dictionary/listVersion2.do', data:'Id='+channel_id, dataType:'json', success:function(json){ if(null != json){ $("#version_id").append("<option value=''>---请选择---</option>"); for(var i=0; i< json.length;i++){ $("#version_id").append("<option value='" +json[i].value_Id+"'>" +json[i].value+"</option>"); } } }, error:function(){ alert('该渠道下没有版本信息'); } }); }else{ $("#version_id").append("<option value=''>---请选择---</option>"); } }); });
二、html页面关键代码
<td align="left" height="18" bgcolor="#ecf6fa"> <span class="STYLE8">渠道标识:</span> <select id="channel_id" name="packageBean.CHANNEL_ID" class="selectstyle200"> <option value="">---请选择---</option> </select> </td> <td align="left" height="18" bgcolor="#ecf6fa"> <span class="STYLE8">版本标识:</span> <select id="version_id" name="packageBean.VERSION_ID" class="selectstyle200"> <option value="">---请选择---</option> </select> </td>
三、struts2 action中的方法package com.ecp.web.dictionary.action; import java.io.PrintWriter; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext; import com.alibaba.fastjson.JSON; import com.ecp.web.dictionary.business.DictionaryManager; import com.hzdracomsoft.base.BaseAction; import com.hzdracomsoft.common.LogUtil; import com.hzdracomsoft.javabean.Dictionary; /*** * 获取字典表信息 * @author ZhuangZi * @version $Id: DictionaryAction.java,v 0.1 2013-1-29 上午10:55:53 ZhuangZi Exp $ */ public class DictionaryAction extends BaseAction{ private static LogUtil log = LogUtil.getInstance(DictionaryAction.class); private DictionaryManager dictionaryManager; private Dictionary dictionary; private List<Dictionary> listDictionary; private String Id; /*** * 获取渠道信息 * */ public void listChannel(){ String json=""; try{ listDictionary = dictionaryManager.handleListChannel(); json=JSON.toJSONString(listDictionary); HttpServletResponse response=ServletActionContext.getResponse(); response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); PrintWriter out; out = response.getWriter(); out.println(json); out.flush(); out.close(); }catch(Exception e){ log.error(e); } } /*** * 获取版本信息 * */ public void listVersion2(){ String json=""; try{ listDictionary=dictionaryManager.handleListVersion(Id); json=JSON.toJSONString(listDictionary); HttpServletResponse response=ServletActionContext.getResponse(); response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); PrintWriter out; out = response.getWriter(); out.println(json); out.flush(); out.close(); }catch(Exception e){ log.error(e); } } /*** * 获取下载包表信息 * @return */ public void listPackage(){ String json=""; try{ listDictionary=dictionaryManager.handleListPackage(Id); json=JSON.toJSONString(listDictionary); HttpServletResponse response=ServletActionContext.getResponse(); response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); PrintWriter out; out = response.getWriter(); out.println(json); out.flush(); out.close(); }catch(Exception e){ log.error(e); } } public Dictionary getDictionary() { return dictionary; } public void setDictionary(Dictionary dictionary) { this.dictionary = dictionary; } public List<Dictionary> getListDictionary() { return listDictionary; } public void setListDictionary(List<Dictionary> listDictionary) { this.listDictionary = listDictionary; } public DictionaryManager getDictionaryManager() { return dictionaryManager; } public void setDictionaryManager(DictionaryManager dictionaryManager) { this.dictionaryManager = dictionaryManager; } public String getId() { return Id; } public void setId(String id) { Id = id; } }
作者:zhuangchuanao 发表于2013-3-1 14:10:48 原文链接
阅读:53 评论:0 查看评论
最新技术文章: