Package org.apache.struts.util

Examples of org.apache.struts.util.MessageResources


    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
   
    action.setServlet(servlet);

    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
    expect(servlet.getServletContext()).andReturn(context);
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("");
    expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);
    expect(messageResources.getMessage(Locale.getDefault(), "insert.key")).andReturn("Insert Stuff Here");
    expect(actionBean.insert()).andReturn("inserted");
    expect(mapping.findForward("inserted")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
View Full Code Here


    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);

    action.setServlet(servlet);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
View Full Code Here

    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);

    action.setServlet(servlet);

    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
    {
      new MessageResourcesConfig()
    });
    expect(servlet.getServletContext()).andReturn(context);
    expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
    expect(moduleConfig.getPrefix()).andReturn("");
    expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);
    expect(messageResources.getMessage(Locale.getDefault(), "insert.key")).andReturn("Insert Stuff Here");
    actionBean.insert();
    expect(actionBean.getNavigationResult()).andReturn("inserted");
    expect(mapping.findForward("inserted")).andReturn(actionForward);

    replay(actionBean);
View Full Code Here

    HttpServletRequest request = createMock(HttpServletRequest.class);
    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);

    action.setServlet(servlet);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
View Full Code Here

   */
  private UserBean auto_create_user(String username){
    UserBean ubean = new UserBean();
    ubean.setName(username);
    String nickname = null;
      MessageResources res = StrutsUtils.getMessageResources(request, context, null);
      if(res!=null)
        nickname = res.getMessage("administrator");
      if(StringUtils.isEmpty(nickname))
        nickname = "Administrator";
    ubean.setNickname(nickname);
    ubean.setPassword("admin");   
    UserDAO.createUser(ubean);
View Full Code Here

   * @exception   Exception 
   */
  public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception
  {
    System.out.println( "   In DownLoadFileHandler for preferences synchronization ");
     MessageResources messages = MessageResources.getMessageResources("ApplicationResources");

    HttpSession session = request.getSession(true)

    int individualID=((UserObject)session.getAttribute("userobject")).getIndividualID();
View Full Code Here

  @Override
  public Object getValue(ActionContext injectionContext)
  {
   
    MessageResources messageResources = getMessageResources(injectionContext);

    if (messageResources == null)
    {
      throw new ApplicationConfigurationException("test me");
    }
View Full Code Here

   * @return
   */
    protected String getMessage(HttpServletRequest req, String bundle, String key) {
      if(key==null)
        return null;
      MessageResources res = StrutsUtils.getMessageResources(req, context, bundle);
      if(res==null)
        return null;
      return res.getMessage(key);
    }
View Full Code Here

    request.setAttribute("showComposeButton", new Boolean(false));
    request.setAttribute("showNewButton", new Boolean(false));
    request.setAttribute("showPrintButton", new Boolean(false));
    // Description must allow i18n
    Locale locale = request.getLocale();
    MessageResources messages = MessageResources.getMessageResources("ApplicationResources");
    String searchButtonDescription = messages.getMessage(locale,
        "label.home.searchbutton.description");
    request.setAttribute("searchButtonDescription", searchButtonDescription);
    request.setAttribute("hideListDropdown", new Boolean(true));

    // Set the moduleId to Entity so search knows where we want to look.
View Full Code Here

   */
  public final String getLabel()
  {
    String label = this.label;
    if (CVUtility.notEmpty(locale) && CVUtility.notEmpty(resourceKey)) {
      MessageResources messages = MessageResources.getMessageResources("ApplicationResources");
      label = messages.getMessage(this.locale, this.resourceKey);
    }
    return label;
  }
View Full Code Here

TOP

Related Classes of org.apache.struts.util.MessageResources

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.