- 浏览: 620404 次
- 来自: 信阳
文章分类
最新评论
-
贝塔ZQ:
导出数据到excel文档中,可以使用pageoffice插件实 ...
Java POI 数据导出到Excel 2010 -
熊佳佳:
key是需要向支付宝购买额度的
支付宝即时到帐接口调试入口页面 -
zhuzuofei:
你好,你代码中提供的pid,key好像是无效的...
支付宝即时到帐接口调试入口页面 -
xingxing:
光有图没有解决方案......
centOS setup 命令 设置网络参数 -
atgoingguoat:
...
Android:简单的图片浏览器
package com.baitw.struts.utils; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class Upload { public String uploadImage(File upload,String savePath,String uploadFileName) throws IOException{ FileOutputStream fos=new FileOutputStream(savePath+"\\"+uploadFileName); FileInputStream fis=new FileInputStream(upload); byte[] buffer=new byte[1024]; int length=0; while((length=fis.read(buffer))>0){ fos.write(buffer,0,length); } return "upload_success"; } }
package com.baitw.struts.action; import java.io.File; import java.util.Date; import org.apache.struts2.ServletActionContext; import com.baitw.dao.ActivityDao; import com.baitw.dao.CardTypeDao; import com.baitw.dao.UserDao; import com.baitw.hibernate.entity.TActivity; import com.baitw.struts.utils.Upload; import com.opensymphony.xwork2.ActionSupport; /** * * 添加活动 * * */ public class AddActivity extends ActionSupport { private String title; private Date begintime; private Date endtime; private String content; private Boolean state; private Date createtime; private Long cardTypeid; private String username; private ActivityDao activityDao; private CardTypeDao cardTypeDao; private UserDao userDao; /*-----------------------------------------------*/ private File upload; private String uploadContextType; private String uploadFileName; private String savePath; public File getUpload() { return upload; } public void setUpload(File upload) { this.upload = upload; } public String getUploadContextType() { return uploadContextType; } public void setUploadContextType(String uploadContextType) { this.uploadContextType = uploadContextType; } public String getUploadFileName() { return uploadFileName; } public void setUploadFileName(String uploadFileName) { this.uploadFileName = uploadFileName; } public String getSavePath() { return ServletActionContext.getRequest().getRealPath(savePath); } public void setSavePath(String savePath) { this.savePath = savePath; } /*-----------------------------------------------*/ public void setUserDao(UserDao userDao) { this.userDao = userDao; } public void setCardTypeDao(CardTypeDao cardTypeDao) { this.cardTypeDao = cardTypeDao; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Date getBegintime() { return begintime; } public void setBegintime(Date begintime) { this.begintime = begintime; } public Date getEndtime() { return endtime; } public void setEndtime(Date endtime) { this.endtime = endtime; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Boolean getState() { return state; } public void setState(Boolean state) { this.state = state; } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public Long getCardTypeid() { return cardTypeid; } public void setCardTypeid(Long cardTypeid) { this.cardTypeid = cardTypeid; } public ActivityDao getActivityDao() { return activityDao; } public void setActivityDao(ActivityDao activityDao) { this.activityDao = activityDao; } @Override public String execute() throws Exception { // TODO Auto-generated method stub TActivity activity=new TActivity(); activity.setTitle(title); activity.setTCardType(cardTypeDao.getTCardType(cardTypeid.toString())); activity.setCreatetime(createtime); activity.setBegintime(begintime); activity.setEndtime(endtime); activity.setContent(content); activity.setLogo(savePath+"/"+uploadFileName); activity.setState(true); activity.setTUser(userDao.getUserEntity(username)); Upload upFile=new Upload(); upFile.uploadImage(upload, ServletActionContext.getRequest().getRealPath(savePath), uploadFileName); return activityDao.addActivity(activity); } public String loadAddPage() throws Exception{ return "loadAddPage"; } }
<!--活动添加 --> <action name="addActivity" class="addActivity"> <result name="success" type="chain">scanActivity</result> <result name="error">/view/error.jsp</result> <result name="null">/view/error.jsp</result> <result name="loadAddPage">/view/admin/activity/createActivity.jsp</result> <result name="input">/view/globalError.jsp</result> <param name="savePath">/uploadImages</param> </action>
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%> <%@ taglib uri="http://ckeditor.com" prefix="ckeditor"%> <%@ taglib prefix="s" uri="/struts-tags"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'createNews.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <%!String sourceURL = "http://192.168.26.195:8080/btw";%> <link type="text/css" rel="stylesheet" href="<%=sourceURL%>/ckeditor/_samples/sample.css" /> <link type="text/css" rel="stylesheet" href="<%=sourceURL%>/css/body.css" /> <link type="text/css" rel="stylesheet" href="<%=sourceURL%>/css/createActivity.css" /> <script language="javascript" type="text/javascript" src="<%=sourceURL%>/js/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript"> function submit1(){ targetForm=document.forms[0]; targetForm.action="admin/addActivity.action"; } function submit2(){ targetForm=document.forms[0]; targetForm.action="uploadImage.action"; } </script> </head> <body> <div id="maincontent"> <form action="" method="post" enctype="multipart/form-data"> <div id="div_detailInfo"> <table width="" border="0"> <tr> <td width="70"> <span class="tableChars">活动标题</span> </td> <td width="200"> <label for="textfield"></label> <input type="text" name="title" id="title" class="text" /> </td> <td width="70"> <span class="tableChars">添加人</span> </td> <td width="200"> <label for="textfield2"></label> <input type="text" name="username" id="username" class="text" value="${sessionScope.username}" readonly="readonly" /> </td> </tr> <tr> <td> <span class="tableChars">开始时间</span> </td> <td> <input class="Wdate" type="text" onClick="WdatePicker()" name="begintime"> </td> <td> <span class="tableChars">结束时间</span> </td> <td> <input class="Wdate" type="text" onClick="WdatePicker()" name="endtime"> </td> </tr> <tr> <td> <span class="tableChars">发布时间</span> </td> <td> <input class="Wdate" type="text" onClick="WdatePicker()" name="createtime"> </td> <td> <span class="tableChars">卡类型</span> </td> <td> <label for="select"></label> <select name="cardTypeid" id="cardTypeid" class="text"> <option value="1"> 朕卡 </option> <option value="2"> OK卡 </option> <option value="3"> 朕卡、OK卡 </option> </select> </td> </tr> <tr> <td> <span class="tableChars">活动图片</span> </td> <td colspan="3"> <input type="file" class="upload" name="upload"/> </td> </tr> </table> </div> <div id="div_editor" style="left: 10px; width: 894px;"> <textarea cols="80" id="editor" name="content" rows="10"></textarea> </div> <div id="div_submit"> <input type="submit" value="添加" onclick="submit1();"/> </div> </form> </div> </body> <ckeditor:replace replace="editor" basePath="http://192.168.26.195:8080/btw/ckeditor/" /> </html>
发表评论
-
struts1 MyEclipse8.5配置
2013-01-03 15:20 489... -
struts2结合JSON的Ajax支持
2012-06-26 21:48 759参考资料http://json.org/json-zh.htm ... -
Struts标签换行
2012-05-28 17:00 786struts2默认格式化form,可以在struts.xml中 ... -
Struts2中<s:fielderror/>消息一直存在
2012-05-16 09:22 805在用spring管理实例中使用原型模式 即: scope= ... -
Struts2设置拦截器后,参数传不到ACTION
2012-05-15 14:54 880加入默认拦截器栈 <interceptor-ref na ... -
Struts值栈调试
2012-04-17 10:09 709<s:debug/> 为Stack Context ... -
简单的上传文件
2012-03-27 15:25 800<input type="file" ... -
使用<s:subset>截取list元素然后迭代
2012-03-16 15:53 1327首先用List查询出来4个对象 <!-- 使用sub ... -
cookie的Struts2实现
2012-03-13 10:42 1652Cookie c = new Cookie("use ... -
自动登录
2012-03-08 11:00 1064package com.zuwoba.presentation ... -
Struts2验证码
2012-03-07 14:26 981<div id="authCode" ... -
struts2 result type 介绍
2012-02-29 09:43 805chain:用来处理Action链 dispatc ... -
DMI(Dynamic Method Invocation)动态方法调用
2012-02-29 09:16 871<script> function regis ... -
struts1.x标签库
2011-12-23 15:41 771HTML Tags:用来创建html页面的动态元素,对html ... -
struts2迭代器的用法
2011-12-01 09:20 4691Name Required ...
相关推荐
软件方面,主要使用BMS2(碧彩管理系统2)进行商品资料的管理,包括导入、编辑和上传下载;BLD 5.23用于自定义标签设计和下传;UpdateProgBCII则用于秤的固件更新,确保设备软件始终保持最新状态。 BMS2软件的安装...
从提供的压缩包子文件的文件名称来看,我们有两个魔兽争霸III(Warcraft III)的地图文件:仙之侠道Ⅱ叁章.w3x和仙道苍云传测试3.w3x。魔兽争霸III是一款著名的即时战略游戏,允许玩家自定义地图进行对战或角色扮演...
将采集的信号经过简单处理后上传到TMS320F2812进行分析处理,得到井下水面高度变化以及井下水温等参数的精确值,并送至液晶显示屏实时显示,同时对USB设备进行简单文件操作,便于数据存取。将μC/OS-Ⅱ实时操作系统...
通过直观的图表或者数字,用户可以随时看到上传和下载的数据量,了解当前网络活动的状态。这对于控制带宽使用,避免因大文件下载或视频流媒体服务而造成的网络拥堵至关重要。例如,在网络条件有限的环境下,用户可以...