📄 friendfindwherenoteequalsaction.java
字号:
package com.relationinfo.txl.struts.actions;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.relationinfo.txl.dao.FriendDao;
import com.relationinfo.txl.dto.Friend;
import com.relationinfo.txl.factory.FriendDaoFactory;
public class FriendFindWhereNoteEqualsAction extends Action
{
/**
* Method 'execute'
*
* @param mapping
* @param form
* @param request
* @param response
* @throws Exception
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
try {
// 解析参数
java.lang.String _note = request.getParameter("note");
//创建Dao类
FriendDao dao = FriendDaoFactory.create();
// 执行查询
Friend dto[] = dao.findWhereNoteEquals(_note);
// 存储结果
request.setAttribute( "result", dto );
return mapping.findForward( "success" );
}
catch (Exception e) {
ActionErrors _errors = new ActionErrors();
_errors.add( ActionErrors.GLOBAL_ERROR, new ActionError("internal.error", e.getClass().getName() + ": " + e.getMessage() ) );
saveErrors( request, _errors );
return mapping.findForward( "failure" );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -