我工作的一个servlet,使到数据库的连接得到表答之一的信息,将这些信息发送到JSP文件。 该文件将打印在布劳尔的信息表,添加单选按钮,允许我们选择行之一。
该servlet看起来是这样的:
List<InfoBean> items = new ArrayList<InfoBean>();
if (!conexion.isClosed()){
Statement st = (Statement) conexion.createStatement();
ResultSet rs = st.executeQuery("select * from lista_audio" );
while (rs.next())
{items.add(getRow(rs));}
conexion.close();}
req.getSession().setAttribute("items", items);
在JSP文件我可以打印一个表中的信息,并补充说,用户将使用选择1行,使用形式,我可以添加发送所选信息到一个servlet单选按钮:
< form action="administ" method=get enctype=multipart/form-data>
< table>
< table border=\"1\">< tr>< th>Title< /th>< th>Author< /th>< th>Album< /th>< /tr>
< c:forEach items="${items}" var="item">
< tr>< td><input type="radio" name="SongInfo" value=${item.title}>
< td>${item.title}< /td>
< td>${item.author}< /td>
< td>${item.album}< /td>< /tr>
< /c:forEach>
< /table>
在现场的“价值”,我应该能够发送到servlet存储在$ {} item.title的信息。 当我设置值= $ {} item.title和标题,例如“保镖”,在servlet我可以检索的信息只是“该”。 它看起来像它发送位于字符串的第一个空格前的字符。 我怎么能得到整个字符串?
谢谢