AJAX实现的电子相册功能

表现层:

<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>


电子相册



  


   
  
   
  
   
 
      
      
   
  

电子相册

上一张 下一张

  
  


<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
${photoUrl}

控制层

package com.dicorp.ajax.ajax_web.actions;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
*/
/*import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
 */
  

import com.dicorp.ajax.ajax_web.createXMLUtils.CreateCounterXMLUtil;
import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.webwork.interceptor.ServletResponseAware;
import com.opensymphony.xwork.Action;
import com.opensymphony.xwork.ActionContext;

import   javax.xml.transform.*;  
import   javax.xml.transform.dom.*;  
import   javax.xml.transform.stream.*;  
import   org.w3c.dom.*;  
import   java.io.*;  
import java.net.URI;

import   javax.xml.parsers.*;  
import   java.util.*;  

public class GetPhotoAction  implements Action ,ServletResponseAware,ServletRequestAware{
    private String selected;
 private HttpServletResponse response;
 private HttpServletRequest request;
    private String photoUrl ;
 
 /* (non-Javadoc)
  * @see com.opensymphony.xwork.Action#execute()
  */
 public String execute() throws Exception {
   String[] photos = {
     "/images/photo/photo1.gif",
     "/images/photo/photo2.gif",
     "/images/photo/photo3.gif",
     "/images/photo/photo4.gif",
     "/images/photo/photo5.gif",
   };
   System.out.println("&**&*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"+selected);
    int index = Integer.parseInt(selected);
    System.out.println("&**&*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"+ photos[index]);
    photoUrl = photos[index];
     return SUCCESS;
 }
 public String getPhotoUrl() {
  return photoUrl;
 }
 public void setPhotoUrl(String photoUrl) {
  this.photoUrl = photoUrl;
 }
 public String getSelected() {
  return selected;
 }
 public void setSelected(String selected) {
  this.selected = selected;
 }
 public void setServletResponse(HttpServletResponse response) {
   this.response  = response;
 }
 
 
 public void setServletRequest(HttpServletRequest request) {
  
  this.request = request;
   }
}

你可能感兴趣的:(ajax)