单击s:iterator struts2中的按钮
我已经创建了一个对象音乐属性名称,作者,艺术家,路径 下面是文件listproduct.jsp中的代码 我想点击每行中的播放按钮,它的显示路径在s:actionerror的音乐名称行中,并获得歌曲的路径和播放歌曲的路径对应单击s:iterator struts2中的按钮,struts2,iterator,Struts2,Iterator,我已经创建了一个对象音乐属性名称,作者,艺术家,路径 下面是文件listproduct.jsp中的代码 我想点击每行中的播放按钮,它的显示路径在s:actionerror的音乐名称行中,并获得歌曲的路径和播放歌曲的路径对应 我该怎么办?我想获取要传递到PlaySongAction的行中的音乐路径,并使用该路径播放mp3文件。但我无法获取行中的歌曲路径。如果您提交表单,请使用音乐路径创建隐藏字段。 <font color="red"><s:actionerror/><
我该怎么办?我想获取要传递到PlaySongAction的行中的音乐路径,并使用该路径播放mp3文件。但我无法获取行中的歌曲路径。如果您提交表单,请使用音乐路径创建隐藏字段。
<font color="red"><s:actionerror/></font>
<table align="center">
<tr>
<td width="200" style="background: #4682B4">Name song</td>
<td width="200" style="background: #4682B4">Artist</td>
<td style="background: #4682B4">Play</td>
<td style="background: #4682B4">Delete</td>
</tr>
<s:iterator value="arrayMusic">
<tr>
<td width="200" style="background: #CCCCCC"><s:property value="%{name}" /></td>
<td width="200" style="background: #CCCCCC"><s:property value="%{artist}" /></td>
<td style="background: #CCCCCC"><s:submit name="playBtn" value="Play" theme="simple" action="play"/></td>
<td style="background: #CCCCCC"><s:submit name="delBtn" value="Delete" theme="simple" action="delete"/></td>
</tr>
</s:iterator>
</table>
<action name="play" class="demo.PlaySongAction">
<result name="success">listproduct.jsp</result>
<result name="error">listproduct.jsp</result>
</action>
<action name="delete" class="demo.DeleteSongAction">
<result name="success">listproduct.jsp</result>
<result name="error">listproduct.jsp</result>
</action>
public class PlaySongAction extends ActionSupport {
public PlaySongAction() {
}
public String execute() throws Exception {
addActionError("display path of Music");
//Mp3Player is class to play mp3 with path of song
Mp3Player mp=new Mp3Player("path of song");
mp.play();
}
}