标签:content request turn str system ret string success new
1.需要的Java包
import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable;
2.代码实现
/** * copy支付链接 */ @RequestMapping("/copyLink.do") @ResponseBody public String CopyLink(HttpServletRequest request){ String url = request.getParameter("url"); Clipboard sysClip = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable text = new StringSelection(url); sysClip.setContents(text, null); return "success"; }
标签:content request turn str system ret string success new
原文地址:http://www.cnblogs.com/ldbangel/p/6247326.html