Guest User

Untitled

a guest
Nov 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. package org.cab1729.portlets;
  2.  
  3. import com.liferay.portal.kernel.log.Log;
  4. import com.liferay.portal.kernel.log.LogFactoryUtil;
  5. import com.liferay.portal.kernel.util.ParamUtil;
  6.  
  7. import java.io.IOException;
  8. import javax.portlet.ActionRequest;
  9. import javax.portlet.ActionResponse;
  10. import javax.portlet.GenericPortlet;
  11. import javax.portlet.PortletException;
  12. import javax.portlet.PortletRequestDispatcher;
  13. import javax.portlet.RenderRequest;
  14. import javax.portlet.RenderResponse;
  15. import org.cab1729.beans.session.*;
  16.  
  17. /**
  18. * Portlet implementation class GetEmpInfoJSPPortlet
  19. * JSP portlet using a web service
  20. */
  21. public class GetEmpInfoJSPPortlet extends GenericPortlet {
  22.  
  23. public void init() {
  24. viewJSP = getInitParameter("view-jsp");
  25. }
  26.  
  27. public void processAction(
  28. ActionRequest actionRequest, ActionResponse actionResponse)
  29. throws IOException, PortletException {
  30.  
  31. long empId = ParamUtil.getLong(actionRequest, "empId");
  32. GetEmpInfoProxy proxy =
  33. new GetEmpInfoProxy(new GetEmpInfoServiceLocator().getGetEmpInfoAddress());
  34. GetEmpInfo getEmpInfo = proxy.getGetEmpInfo();
  35. String email;
  36. try {
  37. email = getEmpInfo.getEmpEmail(empId);
  38. } catch (Exception e) {
  39. // TODO Auto-generated catch block
  40. email = "";
  41. }
  42. System.out.println("email: " + email);
  43. actionResponse.setRenderParameter("email", email);
  44.  
  45. }
  46.  
  47. public void doView(
  48. RenderRequest renderRequest, RenderResponse renderResponse)
  49. throws IOException, PortletException {
  50.  
  51. include(viewJSP, renderRequest, renderResponse);
  52. }
  53.  
  54. protected void include(
  55. String path, RenderRequest renderRequest,
  56. RenderResponse renderResponse)
  57. throws IOException, PortletException {
  58.  
  59. PortletRequestDispatcher portletRequestDispatcher =
  60. getPortletContext().getRequestDispatcher(path);
  61.  
  62. if (portletRequestDispatcher == null) {
  63. _log.error(path + " is not a valid include");
  64. }
  65. else {
  66. portletRequestDispatcher.include(renderRequest, renderResponse);
  67. }
  68. }
  69.  
  70. protected String viewJSP;
  71.  
  72. private static Log _log = LogFactoryUtil.getLog(GetEmpInfoJSPPortlet.class);
  73.  
  74. }
Add Comment
Please, Sign In to add comment