1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
package org.demosys.web.story.action; |
7 |
|
import javax.servlet.http.HttpServletRequest; |
8 |
|
import javax.servlet.http.HttpServletResponse; |
9 |
|
import org.apache.struts.action.Action; |
10 |
|
import org.apache.struts.action.ActionForm; |
11 |
|
import org.apache.struts.action.ActionForward; |
12 |
|
import org.apache.struts.action.ActionMapping; |
13 |
|
import org.demosys.web.ServiceLocator; |
14 |
|
import org.demosys.web.story.CreateStoryException; |
15 |
|
|
16 |
|
|
17 |
|
|
18 |
0 |
public class NewStoryAction extends Action { |
19 |
|
public ActionForward execute(ActionMapping mapping, ActionForm objForm, |
20 |
|
HttpServletRequest req, HttpServletResponse res) { |
21 |
0 |
NewStoryForm form = (NewStoryForm)objForm; |
22 |
|
|
23 |
0 |
String result = null; |
24 |
|
|
25 |
|
try { |
26 |
0 |
ServiceLocator.getServiceLocator().getStoryService().newStory(form |
27 |
|
.toStoryView()); |
28 |
0 |
result = "success"; |
29 |
0 |
} |
30 |
|
catch (CreateStoryException e) { |
31 |
0 |
e.printStackTrace(); |
32 |
0 |
result = "failure"; |
33 |
0 |
} |
34 |
|
|
35 |
0 |
return mapping.findForward(result); |
36 |
|
} |
37 |
|
} |