{声明:不得转载}
当时好像使用DJ Java Decompiler反编译iCarnegie给的.class文件,然后抄了一点代码,我给出的代码好像不能编译,各位仔细咯
/**
* Author:
* Date: 05-09
* Description: exercise6
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class OOGallery extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
/**
* Indicate the content type (for example, text/html),
* being returned by the response
*/
/* Add your code here */
response.setContentType("text/html");
/**
* Retrieve an output stream to use to send data to the client
*/
/* Add your code here */
PrintWriter out = response.getWriter();
/**
* Get the user input from the form
*/
/* Add your code here */
String ThemePicture1 = request.getParameter("theme")+"One";
String ThemePicture2 = request.getParameter("theme")+"Two";
String BackgroundImage = "/"+request.getParameter("bgrnd")+".gif";
String Bgcolor="#FFF8DC";
/**
* Create an instance of the HtmlPage class
*/
/* Add your code here */
HtmlPage htmlPage = new HtmlPage();
/**
* Create an instance of the HtmlImage class for the first image
*/
/* Add your code here */
HtmlImage htmlImage1 = new HtmlImage("/" + ThemePicture1 + ".jpg", ThemePicture1);
/**
* Create an instance of the HtmlImage class for the second image
*/
/* Add your code here */
HtmlImage htmlImage2 = new HtmlImage("/" + ThemePicture2 + ".jpg", ThemePicture2);
/**
* Set the attributes of the HtmlPage object
*/
/* Add your code here */
htmlPage.setTitle("OOGalleryPage using HtmlPage and HtmlImage classes");
htmlPage.setBackgroundImage(BackgroundImage);
htmlPage.setBackgroundColor("Bgcolor");
/**
* Add the images
*/
/* Add your code here */
String picture1=htmlImage1.buildHtml();
String picture2=htmlImage2.buildHtml();
htmlPage.addText(picture1);
htmlPage.addText("<BR>");
htmlPage.addText("<BR>");
htmlPage.addText(picture2);
/**
* Finish building the Web page
*/
/* Add your code here */
out.println(htmlPage.buildHtml());
}
}
当时好像使用DJ Java Decompiler反编译iCarnegie给的.class文件,然后抄了一点代码,我给出的代码好像不能编译,各位仔细咯
/**
* Author:
* Date: 05-09
* Description: exercise6
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class OOGallery extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
/**
* Indicate the content type (for example, text/html),
* being returned by the response
*/
/* Add your code here */
response.setContentType("text/html");
/**
* Retrieve an output stream to use to send data to the client
*/
/* Add your code here */
PrintWriter out = response.getWriter();
/**
* Get the user input from the form
*/
/* Add your code here */
String ThemePicture1 = request.getParameter("theme")+"One";
String ThemePicture2 = request.getParameter("theme")+"Two";
String BackgroundImage = "/"+request.getParameter("bgrnd")+".gif";
String Bgcolor="#FFF8DC";
/**
* Create an instance of the HtmlPage class
*/
/* Add your code here */
HtmlPage htmlPage = new HtmlPage();
/**
* Create an instance of the HtmlImage class for the first image
*/
/* Add your code here */
HtmlImage htmlImage1 = new HtmlImage("/" + ThemePicture1 + ".jpg", ThemePicture1);
/**
* Create an instance of the HtmlImage class for the second image
*/
/* Add your code here */
HtmlImage htmlImage2 = new HtmlImage("/" + ThemePicture2 + ".jpg", ThemePicture2);
/**
* Set the attributes of the HtmlPage object
*/
/* Add your code here */
htmlPage.setTitle("OOGalleryPage using HtmlPage and HtmlImage classes");
htmlPage.setBackgroundImage(BackgroundImage);
htmlPage.setBackgroundColor("Bgcolor");
/**
* Add the images
*/
/* Add your code here */
String picture1=htmlImage1.buildHtml();
String picture2=htmlImage2.buildHtml();
htmlPage.addText(picture1);
htmlPage.addText("<BR>");
htmlPage.addText("<BR>");
htmlPage.addText(picture2);
/**
* Finish building the Web page
*/
/* Add your code here */
out.println(htmlPage.buildHtml());
}
}