SSH2用法

小小黑yangw19820 2008-12-25 04:17:03
JSP 页面内容
<tr>
<td>${id }</td>
<td><s:url action="querybyid" id="url">
<s:param name="noteID">${id }</s:param>
</s:url> <s:a href="%{url}">${title }</s:a></td>
<td>${content }</td>
<td><s:date name="times" format="yyyy-MM-dd HH:mm:ss" /></td>
<td>${author }</td>
<td>${type }</td>

</tr>点链接进入ACTION

package com.news.user.action;

import java.util.List;

import com.news.user.dao.NewsDao;
import com.news.user.po.News;
import com.news.user.service.NewsService;
import com.opensymphony.xwork2.ActionSupport;

public class QueryByIdAction extends ActionSupport {


/**
*
*/
private static final long serialVersionUID = -2161673580079651325L;

private NewsService newsService;

//private NewsDao newsDao;

private News newss;

public NewsService getNewsService() {

return newsService;
}

public void setNewsService(NewsService newsService) {

this.newsService = newsService;
}

public News getNewss() {
return newss;
}

public void setNewss(News newss) {
this.newss = newss;
}


public String execute(String noteID) throws Exception{

this.setNewss(newsService.queryById(noteID));

return SUCCESS;
}
}
想通过execute方法进行查询查询,再在另一个JSP中显示出来,不晓得怎么的就是进不到ACTION中来

<action name="querybyid" class="com.news.user.action.QueryByIdAction">
<result>/queryByid.jsp</result>
</action>

<bean id="querybyidAction" class="com.news.user.action.QueryByIdAction">
<property name="newsService">
<ref bean="newsService"/>
</property>
</bean>
请问下,那里有错呀
...全文
54 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuanyemars 2008-12-31
  • 打赏
  • 举报
回复
execute方法是com.opensymphony.xwork2.ActionSupport类中的String execute()方法。
修改为
private String noteID;
public String execute() throws Exception{

this.setNewss(newsService.queryById(noteID));

return SUCCESS;
}

public set .....
public get ....
即可
zou_wei_forever 2008-12-25
  • 打赏
  • 举报
回复
先将<s:url action="querybyid" id="url"> 中的id属性去掉,输出一下看看是什么

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧