67,549
社区成员




<a href="post/post.jsp?id=<%= postId%>"><%= postId %></a>
<% request.getParameter("id") %>
来解决,接着用一个JavaBean,public static Topic selectTopicByPostId(int postId)
来获得一个对象,接着在JSP页面慢慢搞。。。。。ActionContext.getContext().getSession().put("email", email);
更加合适呢?有错误请指出哦!
然后在需要的jsp中取呢?
<a href="<s:url action="test"/>">test</a>
给你们分享哈超链接链接action的方法 <td > <a href="<%=basePath%>/user/QueryReceiveEmail_read?readid=<s:property value="#email.id"/>"><s:property value="#email.title"/></a> </td>
上面这代码是点击邮件标题进入对应的邮件详细信息页代码。
1.这里用到的就是超链接至action,其中/user是namespace。QueryReceiveEmail_read用到了*_*通配符,2.QueryReceiveEmail是userpackage下的action--QueryReceiveEmailAction,read是这个action中的read方法。
3.readid就是页面需要传回action的参数,在action中只需定义一个readid,添加get/set方法即可得到其值。
4.既然得到邮件id,你便可在此方法中通过service层调取dao层的数据处理方法得到该邮件信息email。
5. ServletActionContext.getRequest().setAttribute("email",email);
return "eamilSuccess";
6.在struts.xml中eamilSuccess对应相应的jsp页面