www.pudn.com > JSP2Struts.rar > LookupAction.java


package com; 
 
import java.io.IOException; 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpSession; 
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; 
 
import com.LookupForm; 
 
public final class LookupAction extends Action 
{ 
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException 
    {  
        LookupForm lookupForm = (LookupForm) form; 
 
	String bookName = lookupForm.getBookType(); 
 
        String target = new String("failure"); 
 
        if(bookName.equals("literature")) 
        { 
            target = new String("lit"); 
        } 
        if(bookName.equals("novel")) 
        { 
            target = new String("nov"); 
        } 
        if(bookName.equals("essay")) 
        { 
            target = new String("ess"); 
        } 
        if(bookName.equals("poetry")) 
        { 
            target = new String("poe"); 
        } 
        return(mapping.findForward(target));  
    } 
}