private void generatePlayListFile(Song[] songs)throws Exception{
ServletRequest request = ServletActionContext.getRequest();
localAddr = "http://" + request.getLocalAddr() + ":8080" + "/popmusic";
songListFileName += ".m3u";
String songListLocation = request.getRealPath("/upload") + "/" + songListFileName;
PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(songListLocation))); for(int i = 0; i < songIds.length; i++){
String tempLocation = songs[i].getLocation();
String songFileName = tempLocation.substring(tempLocation.lastIndexOf("/") + 1);
out.println(songFileName);
}
out.close();
}
ServletRequest request = ServletActionContext.getRequest();
localAddr = "http://" + request.getLocalAddr() + ":8080" + "/popmusic";
songListFileName += ".m3u";
String songListLocation = request.getRealPath("/upload") + "/" + songListFileName;
PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(songListLocation))); for(int i = 0; i < songIds.length; i++){
String tempLocation = songs[i].getLocation();
String songFileName = tempLocation.substring(tempLocation.lastIndexOf("/") + 1);
out.println(songFileName);
}
out.close();
}
解决方案 »
- JS简单的判断
- 谁有SSH批量删除的例子
- 验证浏览器是否有装Flash播放器时时出错
- 请问用什么技术开发桌面宠物? 高分(100)
- 熟悉servlet的人请进,关于servlet调用javabean的问题。
- 用户的请求关键字是一串乱码……
- 新手提问,关于javabean的存放路径问题。。。。。。
- poi 操作单元格 背景色的问题
- 散分!hoho...
- 严重: The web application [/jpkc] created a ThreadLocal with key of type [java.lan
- java socket两个项工程间对象传输问题
- common-fileupload 组件应用的问题
private String songListFileName="";
private SongManageService songManageService;
private String localAddr;
private Map<Song, Set<Singer>> songSingerMap = new HashMap<Song, Set<Singer>>();
private Logger logger = Logger.getLogger(PlaySongAction.class);
public String execute()throws Exception{
Song[] songs = new Song[songIds.length];
for(int i = 0; i < songIds.length; i++){
songListFileName += songIds[i] + "_";
songs[i] = songManageService.getSongById(songIds[i]);
}
generatePlayListFile(songs);
return SUCCESS;
}private void generatePlayListFile(Song[] songs)throws Exception{
ServletRequest request = ServletActionContext.getRequest();
localAddr = "http://" + request.getLocalAddr() + ":8080" + "/popmusic";
songListFileName += ".m3u";
String songListLocation = request.getRealPath("/upload") + "/" + songListFileName;
PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(songListLocation))); for(int i = 0; i < songIds.length; i++){
String tempLocation = songs[i].getLocation();
String songFileName = tempLocation.substring(tempLocation.lastIndexOf("/") + 1);
out.println(songFileName);
}
out.close();
}