public void onClick$downloadAgent(Event event){ try { Filedownload.save("download/xxx.xls", "application/octet-stream"); } catch (FileNotFoundException e) { System.out.println("FileNotFoundException:" + e.getMessage()); } }
星期日, 3月 27, 2011
[ZK] How to download file in ZK
[Asp.Net] zip and unzip in asp.net using DotNetZip Library
If you want to create a zip in your asp.net.I suggests that you can use DotNetZip Libriay that is very easy to use.You can get more details in the following link :
DotNetZip Library
Create a downloadable zip within ASP.NET. This example creates a zip dynamically within an ASP.NET postback method, then downloads that zipfile to the requesting browser through Response.OutputStream. No zip archive is ever created on disk.
DotNetZip Library
Create a downloadable zip within ASP.NET. This example creates a zip dynamically within an ASP.NET postback method, then downloads that zipfile to the requesting browser through Response.OutputStream. No zip archive is ever created on disk.
public void btnGo_Click (Object sender, EventArgs e) { Response.Clear(); Response.BufferOutput= false; // for large files String ReadmeText= "This is a zip file dynamically generated at " + System.DateTime.Now.ToString("G"); string filename = System.IO.Path.GetFileName(ListOfFiles.SelectedItem.Text) + ".zip"; Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "filename=" + filename); using (ZipFile zip = new ZipFile()) { zip.AddFile(ListOfFiles.SelectedItem.Text, "files"); zip.AddEntry("Readme.txt", "", ReadmeText); zip.Save(Response.OutputStream); } Response.Close(); }
星期二, 3月 22, 2011
[Alfresco] Create your first web script
if you want to create customize web script in Alfresco.
You will need to understand:
You will need to understand:
- XML for expressing the Web Script description
- <basename>.<httpmethod>.desc.xml
- Optionally, JavaScript for writing Web Script behaviour
- <basename>.<httpmethod>.js
- Freemarker for rendering a Web Script response
- <basename>.<httpmethod>.<format>.ftl
星期日, 3月 20, 2011
[XSLT] XSLT Note
XSLT(Extensible StyleSheet Language Transformations)
XSLT是一種把XML文件轉換成XHTML文件或是其他的XML文件的語言。
XPath則是可以操控XML文件的語言,XSLT大量的使用此技術。
XSLT文件是利用stylesheet當作root element的XML文件
Reference:
XSLT Tutorial
XSLT是一種把XML文件轉換成XHTML文件或是其他的XML文件的語言。
XPath則是可以操控XML文件的語言,XSLT大量的使用此技術。
XSLT文件是利用stylesheet當作root element的XML文件
Reference:
XSLT Tutorial
星期三, 3月 16, 2011
[ZK] How to pass parameter to another zul page
Today i want to pass parameter to another zul page so i find the solution for using "Executions.createComponents".
arg - java.util.Map(Refer to ZK:The User Guide)
The arg argument passed to the createComponents method in the
org.zkoss.zk.ui.Executions class. It might be null, depending on how
createComponents is called.
It is the same as self.desktop.execution.arg.
params.put("name", "John");
Executions.createComponents("/my.zul", null, params);
Then, in my.zul,
...
Notice that arg is available only when creating the components for the included page, say
my.zul. On the other hand, all events, including onCreate, are processed later. Thus, if you
want to access arg in the onCreate's listener, use the getArg method of the
org.zkoss.zk.ui.event.CreateEvent class.
Testing code is the below:
In the a.zul composer.
In teh b.zul composer.(change_password.zul)
arg - java.util.Map(Refer to ZK:The User Guide)
The arg argument passed to the createComponents method in the
org.zkoss.zk.ui.Executions class. It might be null, depending on how
createComponents is called.
It is the same as self.desktop.execution.arg.
params.put("name", "John");
Executions.createComponents("/my.zul", null, params);
Then, in my.zul,
...
Notice that arg is available only when creating the components for the included page, say
my.zul. On the other hand, all events, including onCreate, are processed later. Thus, if you
want to access arg in the onCreate's listener, use the getArg method of the
org.zkoss.zk.ui.event.CreateEvent class.
Testing code is the below:
In the a.zul composer.
final Map<String, Object> map = new HashMap<String, Object>(0); map.put("userid",detailsUser.getUserName() ); Window changepasswordWin = null; changepasswordWin = (Window) Executions.createComponents( "/admin/change_password.zul", null, map);
In teh b.zul composer.(change_password.zul)
Map<String, Object> args = null; public void onCreate$changePasswordWin(Event e) throws Exception { System.out.println("--ChangePassword changePasswordWin--"); CreateEvent ce = (CreateEvent) ((ForwardEvent) e).getOrigin(); this.args = ce.getArg(); System.out.println("pass userid:" + this.args.get("userid")); //do something //.... System.out.println("--/ChangePassword changePasswordWin--"); }
星期二, 3月 15, 2011
[ZK] Dynamic to add button and listen event
Button btnModify = new Button("Modify Password"); //parent is cell of row btnModify.setParent(cell); btnModify.setImage("/admin/images/btn/modify_key.png"); btnModify.addEventListener("onClick", new EventListener() { public void onEvent(Event event) throws Exception { //to do something } });
[ZK] Messagebox EventListener
捕捉Question Messagebox的事件
//popup messagebox Messagebox.show("Are you sure?", "Question", Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, new EventListener() { public void onEvent(Event event) throws Exception { //if clicks ok to do something if (((Integer) event.getData()).intValue() == Messagebox.OK) { //to do something } } });
星期五, 3月 11, 2011
[Java] Notes for Json in Java
在java中操作json,可從Json in java 下載source code,用eclipse重新build成jar檔。
Reference:
Json in Java
JSON in JAVA 的簡單程式範例
Reference:
Json in Java
JSON in JAVA 的簡單程式範例
星期四, 3月 10, 2011
星期五, 3月 04, 2011
PHP ZEND Framwork
http://blog.corausir.org/website-design/ausir-1219
http://www.jaceju.net/blog/archives/category/web-development/php/zend-framework/page/2
http://blog.wu-boy.com/2009/03/24/1060
http://www.jaceju.net/blog/archives/category/web-development/php/zend-framework/page/2
http://blog.wu-boy.com/2009/03/24/1060
星期二, 3月 01, 2011
[ZK] ZK Eclipse Setting
From: ZK Essentials/Working with the Sample Applications/Setting Up the Applications Using Eclipse
In the fifth step:
"Once the download is complete, go to Window > Preferences > ZK > ZK Packages, click Add File/Directory to add the ZK package downloaded"
The default ZK Package versioin is 3.6.3, so downloaded the latest one which is zk-bin-5.0.5.zip from zk downloads. Then keep following the fifth step to select the downloaded file and then the latest version could be displayed as an option.
In the fifth step:
"Once the download is complete, go to Window > Preferences > ZK > ZK Packages, click Add File/Directory to add the ZK package downloaded"
The default ZK Package versioin is 3.6.3, so downloaded the latest one which is zk-bin-5.0.5.zip from zk downloads. Then keep following the fifth step to select the downloaded file and then the latest version could be displayed as an option.
訂閱:
文章 (Atom)