---
title: "success"
author: "Joy.zhang"
date: "2010-11-10T00:42:05Z"
tags: ["Ajax", "Apache", "Bean", "Servlet", "Struts"]
categories: ["非技术"]
slug: "success"
draft: false
lastmod: "2010-11-10T00:42:05Z"
id: 807166
url: "https://joy-zhang.iteye.com/blog/807166"
---

&lt;%-- Document : success Created on : Dec 15, 2008, 4:08:53 AM Author : eswar@vaannila.com --%&gt; &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&gt; &lt;%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&gt; JSP Page

# Login Success. Welcome

 ------------------------------------- package com.vaannila; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; public class ExecuterAction extends Action{ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("ExecuterAction.execute()"); String timeId = request.getParameter("timeId"); if("".equals(timeId)){ } response.getWriter().print("sdfsdafdsaf"+timeId); return super.execute(mapping, form, request, response); } private String getC(){ // db operator return "C"; } } --------------------------------- /* * To change this template, choose Tools | Templates * and open the template in the editor. \*/ package com.vaannila; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.LabelValueBean; import org.apache.struts.util.MessageResources; /\** * * @author eswar@vaannila.com \*/ public class LoginAction extends org.apache.struts.action.Action { /* forward name="success" path="" \*/ private final static String SUCCESS = "success"; private final static String FAILURE = "failure"; /\** * This is the action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception * @return \*/ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { LoginForm loginForm = (LoginForm) form; MessageResources messageResources = getResources(request); String s1 = messageResources.getMessage("t"); String\[] strList = s1.split(","); List valueBeans = new ArrayList(); for (String key : strList) { System.out.println("key : "+key+" value : "+messageResources.getMessage(key)); valueBeans.add(new LabelValueBean(messageResources.getMessage(key),key)); } request.setAttribute("mtypelist", valueBeans); if (loginForm.getUserName().equals(loginForm.getPassword())) { return mapping.findForward(SUCCESS); } else { return mapping.findForward(FAILURE); } } }