viewtopicaction.java
来自「JAVA Servlet2.3外文书籍源码」· Java 代码 · 共 37 行
JAVA
37 行
package forum;
import javax.servlet.http.*;
/**
* Represents the logic behind viewing the details of a topic. This action
* is responsible for looking up the appropriate Topic instance and placing
* it in the request in order that the view can display it.
*
* @author Simon Brown
*/
public class ViewTopicAction extends Action {
/**
* Peforms the processing associated with this action.
*
* @param req the HttpServletRequest instance
* @param res the HttpServletResponse instance
* @return the name of the next view
*/
public String process(HttpServletRequest request, HttpServletResponse response) {
System.out.println("ViewTopicAction : Processing request");
// get the id parameter and use it to look up
// the appropriate Topic instance
String id = request.getParameter("id");
Topic topic = Topics.getTopic(Integer.parseInt(id));
// now that we have the Topic, place it in the request
// ready for use on the view
request.setAttribute("topic", topic);
return "/view-topic.jsp";
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?