📄 viewtopicaction.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -