KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > demo > action > ReplyCommand


1 package org.apache.velocity.demo.action;
2
3 /*
4  * Copyright 1999,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 // Servlet
19
import javax.servlet.http.HttpServlet JavaDoc;
20 import javax.servlet.http.HttpServletRequest JavaDoc;
21 import javax.servlet.http.HttpServletResponse JavaDoc;
22
23 // Velocity
24
import org.apache.velocity.context.Context;
25
26 // Demo
27
import org.apache.velocity.demo.om.*;
28
29 /**
30  * This command is called when a user
31  * wants to add a reply to a message.
32  * It simply adds the parent message ID to the
33  * reply from and the subject.
34  *
35  * @author <a HREF="mailto:daveb@miceda-data.com">Dave Bryson</a>
36  * @version $Revision: 1.2.14.1 $
37  * $Id: ReplyCommand.java,v 1.2.14.1 2004/03/04 00:18:29 geirm Exp $
38  */

39 public class ReplyCommand extends Command
40 {
41     /** The form to call */
42     public static final String JavaDoc REPLY = "reply.vm";
43             
44     public ReplyCommand( HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc resp )
45     {
46         super( req, resp );
47     }
48     
49     /**
50      * Add the message ID and the subject to
51      * the Form reply.
52      */

53     public String JavaDoc exec( Context ctx )
54     {
55         String JavaDoc id = request.getParameter("id");
56         String JavaDoc subject = request.getParameter("subject");
57         ctx.put("id", id );
58         ctx.put("subject", subject);
59         
60         return REPLY;
61     }
62 }
63
Popular Tags