Hi
I am making a web page where the user will enter a number such as "010383" and page should download a file and print it.

I have made the html page and the servlet. can you please show me where i have made mistake?

CgSkew.java

package cgSkewPackage;
 
import java.io.*;*
*import java.net.MalformedURLException;*
*import java.net.URL;*
*import javax.servlet.*;
import javax.servlet.http.*;
 
/**
 *
 * @author Owner
 */
public class CgSkew extends HttpServlet {
 
   public String getCgSkew; // Stroing the user input
   public String url1;  // Stroing the first part of the url.
   public String url2; //Storing the last part of the url.
   public String getURL; // Stroing the complete url
   private String docType;
 
   public void getUserValue(HttpServletRequest request,HttpServletResponse response)
    throws ServletException, IOException { {
 
    // Getting the user input 
        getCgSkew = request.getParameter("cgSkew");
 
 
    // Checking for null value    
        if ((getCgSkew == null) || (getCgSkew.trim().equals(""))){
 
           response.sendRedirect("http://wwww.x.com/x.html");}
        else {
            getCgSkew = getCgSkew.trim();
            calculation(getCgSkew);
        }
 
    } 
 
}// End of public void getUserValue
 
    public void calculation(String getCgSkew) throws IOException {
        throw new UnsupportedOperationException("Not yet implemented");
 
        url1 = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=genome&id=NC_";
        url2="&rettype=gb";
        //Creating complete URL
        getURL= url1+getCgSkew+url2;
 
        //Opening connection to download the file.
 
        try{
            URL geneBankLink = new URL(getURL);
	BufferedReader in = new BufferedReader(
				new InputStreamReader(
				geneBankLink.openStream()));
 
	String inputLine;
 
	while ((inputLine = in.readLine()) != null)
            docType ="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +"Transitional//EN\">\n";         
            out.println(docType+"<HTML>\n");
            out.pritln("<TITLE>"+"</TITLE>\n");
            out.println("<BODY>\n"+inputLine+"</BODY>\n");
            out.println("</HTML>");
 
	in.close();
    }
        catch(MalformedURLException e) {
 
         }    
        }
 
   public static void main(String args[]){
 
   }
 
}

Netbean is showing error in all

"out.println" statements. I am trying to print the value that is being stored. Is there any other way I can do this?

This article has been dead for over six months. Start a new discussion instead.