Servlet doing serialization

Hi all,
I'm designing a small app in order to perform compilation test on struts framework using flash tools. The project is organized this way: the user tells how many "compilation test" he wants to perform on the main page and then these informations are passed to a servlet which generates fake informations about the user and perform the compilation of a Flash animation. All these informations (first name, last name, mail, various informations and path to flash animation) are stored inside a separate class which also reads the content of the flash file and stores it into an attribute. This class implements the serializable interface. When things are done, I try to serialize the object.
Problems are beginning at this point: I'm not able to serialize my object. In fact, I generate a random filename and pass it to a FileOutputStream, so it is supposed to create my file. Despite of this, I get an *annoying* Error 500 which tells me the following:
java.io.FileNotFoundException: /var/lib/tomcat5/webapps/struts_test/WEB_INF/classes/objects/aGdsPhOboRJgf.ser (No such file or directory)
     java.io.FileOutputStream.open (Native Method)
     java.io.FileOutputStream.<init> (FileOutputStream.java:179)
     java.io.FileOutputStream.<init> (FileOutputStream.java:70)
     java.io.FileWriter.<init> (FileWriter.java:46)
     struts_test.IdentifyAction1.execute (IdentifyAction1.java:76)
     org.apache.struts.action.RequestProcessor.processActionPerform (RequestProcessor.java:421)
     org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:226)
     org.apache.struts.action.ActionServlet.process (ActionServlet.java:1164)
     org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:415)
     javax.servlet.http.HttpServlet.service (HttpServlet.java:709)
     javax.servlet.http.HttpServlet.service (HttpServlet.java:802)
     sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
     sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
     sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
     java.lang.reflect.Method.invoke (Method.java:597)
     org.apache.catalina.security.SecurityUtil$1.run (SecurityUtil.java:243)
     java.security.AccessController.doPrivileged (Native Method)
     javax.security.auth.Subject.doAsPrivileged (Subject.java:517)
     org.apache.catalina.security.SecurityUtil.execute (SecurityUtil.java:272)
     org.apache.catalina.security.SecurityUtil.doAsPrivilege (SecurityUtil.java:161)This stacktrace guides us to the idea that we don't have deployed the right security policy, but it isn't. My catalina.policy contains the following:
grant codeBase "file:${catalina.home}/webapps/struts_test/-" {
     permission java.io.FilePermission "/var/lib/tomcat5/webapps/struts_test/WEB-INF/classes/struts_test/flash/-", "read,write";
     permission java.io.FilePermission "/var/lib/tomcat5/webapps/struts_test/WEB-INF/classes/objects/test.ser", "write,read";
};So I've tried to tell it a nice permission java.security.AllPermission; and this results in the non-appearance of the error message, but the file is *NOT* created... It's going to drive me nuts... So if anyone has an idea, I'd be honoured to read it :)
Thanks!
System Configuration:
OS: Ubuntu Linux 7.04
Tomcat: version 5.0
Java: JDK1.6.0_02
SE with some Ant and Struts-related libraries and

Are you sure the path is correct?
ava.io.FileNotFoundException: /var/lib/tomcat5/webapps/struts_test/WEB_INF/classes/objects/aGdsPhOboRJgf.ser (No such file or directory)
Should it not be "WEB-INF" instead of "WEB_INF"?

Similar Messages

  • Package javax.servlet does not exist - settings appear to be correct

    laugh as I write this post...it's hardly a "new topic."...but everything seems set just as it should be...
    Okay...I'm a seasoned programmer in every language but JAVA. Here's the issue...every time I try to use the Core Servlets book/website by Marty Hall and Larry Brown I get hung up on the packages. This time, I downloaded and followed step by step what the website said to do...it was even preconfigured for me! Alas...I am getting the following compliation errors on a "simple packagless" program with NetBeans:
    Compiling 1 source file to C:\Servlets+JSP\HelloServlet\build\classes
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:13: cannot find symbol
    symbol: class HttpServlet
    public class HelloServlet extends HttpServlet {
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:14: cannot find symbol
    symbol : class HttpServletRequest
    location: class HelloServlet
    public void doGet(HttpServletRequest request,
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:15: cannot find symbol
    symbol : class HttpServletResponse
    location: class HelloServlet
    HttpServletResponse response)
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:16: cannot find symbol
    symbol : class ServletException
    location: class HelloServlet
    throws ServletException, IOException {
    6 errors
    BUILD FAILED (total time: 0 seconds)
    These are my environment settings (note that the JAVAX package is located under the src folder in Java)
    Catalina Home:
    C:\apache-tomcat-6.0.10
    CLASSPATH:
    C:\apache-tomcat-6.0.10\lib\servlet-api.jar;
    C:\apache-tomcat-6.0.10\lib\jsp-api.jar;
    C:\apache-tomcat-6.0.10\lib\el-api.jar;
    C:\Servlets+JSP;..;..\..;
    C:\Program Files\Java\jdk1.6.0_03\src
    JAVA_HOME
    C:\Program Files\Java\jdk1.6.0_03
    Path:
    C:\Program Files\Java\jdk1.6.0_03\bin;%PATH%
    Any ideas (excluding the one that maybe I should let my hair grow out, put on some tackey shorts and sandles and start palying an instrument in the streets of Austin for living?)

    cabkats wrote:
    You are then suggesting that I make the corrections directly to the files in apache using notepad instead of using the envir. variables?No I am not suggesting that. I am suggesting that you need to read the documentation about the product(s) and set them up the way they require, rather than blindly think that the CLASSPATH environment variable is some magical entity.
    I will try this, but I was hoping that since my IDE auto configured (with exception to java_home) that I would not have to do this. I wil give it try....thanks for the suggestion.See, you're using an IDE. Like I mentioned, IDEs do not use the CLASSPATH environment variable. You need to set up your project in your IDE in such a way that it knows what the dependent jars are. I'm sure there's a way to add jars to your project's dependencies.

  • Javax.servlet does not exit

    hello all,
    i m new and have recently started using java, servlets, jsp with netbeans and Tomcat.
    There are some servlet examples in Tomcat5.5\webapps\servlets-examples\WEB-INF\classes\...
    Using the //localhost:8080/....... , i can easily get these servlets working in the browser.
    When i opened one of the java file say: HelloWorldExample.java in Netbeans, there area lot of red circles with exclamation mark in it.
    it says: "package javax.servlet does not exist"
    in this line: import javax.servlet.*;
    i am surprised why such errors are there and with such errors also the program runs...i want to get rid of such red circles and the error it is showing.
    I have jdk1.6.0_10 , jre1.6.0_05 , Netbeans IDE 6.0.1 , Tomcat 5.5 installed in my Windows Vista OS
    i have set my classpath as
    .;C:\root\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar;C:\root\jakarta-tomcat-5.5.9\common\lib\jsp-api.jar;
    JAVA_HOME : C:\Program Files\Java\jdk1.6.0_10
    any help is appreciated....
    Thank you.
    Edited by: kuchu on Jun 26, 2009 12:00 PM

    The servlet API is included in the application server implementation which you're going to use (in this case Tomcat). You need to associate the application server with the Netbeans project. Check the project properties.
    I cannot tell the detailed steps how to do it in Netbeans as I already uninstalled it after 5 minutes of trying some years ago, but in Eclipse you can select and add the application server during the 'create dynamic web project' wizard. It is smart enough to include the appserver's libraries in the project's build path. From what I heard and read about Netbeans is that it is also able to do so.

  • ANT script genrated error: package javax.servlet does not exist

    Hi there,
    I am running ANT and confronted this message:
        [javac] Compiling 1 source file to C:\eclipseProjects\tomcat_test
        [javac] C:\eclipseProjects\tomcat_test\WEB-INF\src\WebTest.java:4: package javax.servlet does not exist
        [javac] import javax.servlet.ServletException;
        [javac] ^I googled around and found this solution:
    servlet-api.jar is the jarfile that contains javax.servlet.ServletException and javax.servlet.http.* which are imported by WebTest.java and must therefore be found in the classpath. If javac doesn't find this jar (or the javax.servlet packages), it will say (or shout, depending on my and javac's mood): [the error message]
    well...I set in the classpath the location of the servlet-api.jar
    (found at: C:\Tomcat\common\lib)
    I set it with the environment variable (windows xp)
    Just as it's shown here: http://www.cs.usask.ca/~wew036/latex/env-env.jpg
    NOTHING :-(
    could anyone assist, thanks

    Hi..seems u r new to J2ee.. dont worry its a very small problem:
    Here is the solution.. yes u have to edit the environment variables:..
    I am using J2EE sdk 1.4 and running on xp
    This is the classpath setting:
    C:\Sun\AppServer\lib\j2ee.jar;
    This is the PATH setting
    C:\Sun\AppServer\bin;
    Good Luck :)

  • It seems mapproxy servlet does not work in 11.1.1.2

    Dear Masters,
    I used mapproxy?rtarget= to access mapviewer in JDeveloper 11.1.1.1 and everything was OK but when I switched to 11.1.1.2 mapproxy servlet does not return anything.
    Is there any changes about mapproxy servlet?
    Regards.

    Hi,
    in my web.xml file I see
    <servlet-mapping>
    <servlet-name>MapProxyServlet</servlet-name>
    <url-pattern>/mapproxy/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    Frank

  • Servlet does not recognize Arabic letter "Feh"

    I use a JSP file to upload file with "action=../servlet/ ".
    My servlet does the work by saving the arabic characters in database quit well EXCEPT the Feh character which appears
    like in "black-bordered square" with "?".
    In my laptop with Vista O/S the problem does not exists.
    Any idea to solve this Problem please.
    Thanks in advance.
    Edited by: a.Tebar on Jan 31, 2010 11:53 AM
    Edited by: a.Tebar on Jan 31, 2010 11:56 AM

    Thank u Sir.
    Let say, problem still going on.!
    Please let give you extra information about an environment:
    - PC O/S windows XP sp2 .
    - Java 1.5.0_08 .
    - TomCat 5.5 .
    - mySql 5.0 .
    My web application works fine; I mean all Arabic characters saved successfully in database "you know I used UTF-8 encoding"
    But when I call the servletf rom JSP file by <form name="form2" action="../servlet/mcc.NameOfServlet" method="post" enctype="multipart/form-data" >
    all Arabic characters were saved successfully Except "Feh" as I told you before.
    Let assure you that there is NO problem at all with servlet in my laptop which run Vista O/S.
    I'm confusing about that. Please Help.

  • ATMTag.java:5: package javax.servlet does not exist

    My j2ee jdk1.4.2 is not supporting javx package.
    i already set all pathh and class path.
    anybody can help me.
    details are given below ::
    C:\AVA\J2EE Programs\JSP\JSPCustomTag>javac ATMTag.java
    ATMTag.java:5: package javax.servlet does not exist
    import javax.servlet.*;
    ^<br>
    ATMTag.java:6: package javax.servlet.http does not exist
    <br>
    import javax.servlet.http.*;
    <br>
    ATMTag.java:18: cannot resolve symbol
    symbol : class TagSupport
    location: class ATMTag
    public class ATMTag extends TagSupport{
    <br> ^
    ATMTag.java:29: cannot resolve symbol
    symbol : class JspTagException
    location: class ATMTag
    public int doStartTag() throws JspTagException{
    <br> ^
    ATMTag.java:31: cannot resolve symbol
    symbol : class JspWriter
    location: class ATMTag
    <br> JspWriter out =pageContext.getOut();
    ^
    ATMTag.java:31: cannot resolve symbol
    symbol : variable pageContext
    location: class ATMTag
    <br> JspWriter out =pageContext.getOut();
    ^
    ATMTag.java:56: cannot resolve symbol
    symbol : variable pageContext
    location: class ATMTag
    pageContext.getOut().write(str);
    <br> ^
    ATMTag.java:60: cannot resolve symbol
    symbol : variable EVAL_PAGE
    location: class ATMTag
    return EVAL_PAGE;
    ^
    8 errors

    When compiling servlets etc, you need to include in your classpath a jar file with all the javax.* classes defined in it.
    For Tomcat this is called servlet.jar and is in (I think) [TOMCAT_HOME]/shared/lib or /common/lib
    For J2EE 1.4 Server, the jar is [J2EE_HOME]/lib/j2ee.jar
    Where the _HOME directory is the directory where you installed J2EE.
    Include this jar file in your classpath when compiling.
    Good luck,
    evnafets

  • Package javax.servlet does not exist, package javax.servlet.http does not

    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    I tried locating these packages, but in vain. I also tried setting the CLASSPATH to many values, still it did not work.
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    Thank you very much.

    davidgoodman wrote:
    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    What servlet/JSP engine do you plan to deploy to? Tomcat, perhaps?I think it's Tomcat (C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14). Are there other engines that come with NetBeans IDE 6.0 (when I downloaded NetBeans, I chose ALL)
    >
    If so, you'll need to put the servlet JAR in your CLASSPATH. (servlet-api.jar for Tomcat 5.5 and earlier, servlet.jar for 6.0 >and later.)
    I tried locating these packages, but in vain.
    You won't find them until you realize that you have to deploy that servlet someplace.How to deploy?
    I also tried setting the CLASSPATH to many values, still it did not work.
    See above. What were you planning to set CLASSPATH to?First I set to:
    C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\lib (because I found jar named servlet-api.jar in this folder)
    Later I added this:
    C:\Program Files\Java\jdk1.6.0_04\lib (out of trial-and-fail)
    Finally I added some paths that lead to a library such as
    C:\Program Files\glassfish-v2\lib
    C:\Program Files\glassfish-v2\lib\ant\lib
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    You have to get a servlet/JSP engine. Step 1.Thank you for your help

  • Package javax.servlet does not exists - Cannot resolve symbol

    Hello,
    I am using JDK 1.3.1.06 version. I wanted to compile a simple servlet using this. But I am getting plenty of errors for all javax package. Why it is not able to find javax package classes?
    The following is the program I have tried to compile.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class TestServlet extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    process(request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    process(request, response);
    private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    PrintWriter out = response.getWriter();
    out.println("Hello World !");
    I am getting errors like this :
    Package javax.servlet does not exists.
    cannot resolve symbol
    symbol : class HttpServlet
    Please advice me some solutions fast.
    Thanking you,
    ForumAns.

    javax.servlet doesn't come with the standard jdk. It's part of J2EE.
    If you have tomcat, you can use the server.jar that comes with tomcat.
    Or you can just download J2EE sdk instead.
    I am getting errors like this :
    Package javax.servlet does not exists.
    cannot resolve symbol
    symbol : class HttpServlet

  • Package javax.servlet does not exists ?

    Hello,
    I am using JDK 1.3.1.06 and trying to compile a simple Servlet. But getting errors as javax package classes does not exits and cannot resolve symobol.
    The following is the program I am trying to compile:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class TestServlet extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              process(request, response);
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              process(request, response);
         private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              PrintWriter out = response.getWriter();
              out.println("Hello World !");
    I am getting errors such as :
    Package javax.servlet does not exists.
    cannot resolve symbol
    symbol : class HttpServlet
    Please advice me of any solution asap. Deep trouble.
    Thanking you,
    Forumans.

    Just a guess...
    JDK 1.3.1.06 This represents the Java language in the form of a JVM and the Java API (like java.lang.String.)
    ServletThis is in J2EE, which if you look above was not mentioned.
    If you look in the java docs for the JDK you will also find that javax.servlet does not exist.
    I would guess however that you could start here - http://java.sun.com/j2ee/
    However, keep in mind that your servlet still needs to run in something, so you better make sure that you are compiling against the correct J2EE server for what you are doing.

  • Package java.servlet does not exists

    I am getting this error:
    c:Program Files\Java\jdk1.6.0_10\bin>javac -Xlint HelloServlet.java
    HelloServlet.java:2:package java.servlet does not exists
    import java.servlet.;
    ^
    HelloServlet.java:4; cannot find symbol
    symbol: class GenericServlet
    public class HelloServlet extends GenericServlet
    ^
    5 errors
    i am using jdk1.6.0_10. i tried to locate the servlet.jar file in the \lib directory, but the jar file was not there. how can i download one and include it in \lib?
    import java.io.*;
    import java.servlet.*;
    public class HelloServlet extends GenericServlet {
    public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter pw=response.getWriter();
    pw.println("<B>Hello!");
    pw.close();
    }

    jatilau wrote:
    forgive my ignorance.That's ok, we're all here to learn; but while (most) people on the forums are smart, they're (unfortunately) not all-knowing. They can't possibly know something about you or your environment unless you tell them.
    it is because i have no one to look up at for help with java, except for the book (The Complete Reference, Java 2, 3rd Edition, Naughton & Schildt) and, of course, some times this forum.There's the whole Internet available to you. Remember, Google is your friend.
    please, will anyone tell me how to find out what server type and version does JDK 1.6.0_10 provide? It doesn't. Java comes in three 'editions':
    Micro (JME, earlier J2ME which is meant for mobiles and other similar platforms)
    Standard (JSE, earlier J2SE which is what you're using, it's meant for core Java applications, like the sort you might use on your desktop.)
    Enterprise (JEE, earlier J2EE which is for server side code. This includes JSPs, Servlets, EJBs etc)
    i did not find any information about this in the book.Probably because it's a Java 'Standard' Edition (JSE or J2SE) book
    What you need, to learn about servlets, is a JEE book. I'd suggest Head First Servlets and JSP from O'Reilly. Otherwise, follow the link I gave earlier to find tutorials.
    To get started, you'll need a JDK, which you say you already have and a server. I'd suggest you get Tomcat. You will also find the servlet-api.jar after you setup Tomcat. This is an implementation of the JEE specification for servlets. This contains the javax.servlet.* packages you'll need to compile. Beyond this, the scope of what servlets are and how to deploy etc is rather large and best left to one of the afore-mentioned tutorials.

  • Javac -- javax.servlet does not exist

    I have j2sdk1.4, j2re1.4 installed on rhat7.1
    and CLASSPATH=/j2sdk1.4/lib/tools.jar
    PATH=/j2sdk1.4/bin
    when I run javac (or /j2sdk1.4/bin/./javac) test.java
    it issue: test.java: package javax.servlet does not exist
    import javax.servlet.*;
    any suggestion?
    Thanks in advance.

    try {
    javac -classpath /your/path/to/j2ee.jar *.java
    }catch(WrongAnswerException e) {
         System.exit(1);
    }

  • Javax.servlet does not exist  (please help)

    i was going to try my first example nad follwing head first
    package com.myweb.trying;
    import  javax.servlet.*;
    import  javax.servlet.http.*;
    import  java.io.*;
    public class Serv1 extends HttpServlet {
         public void doPost(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException{
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("Shutup and see this");
              String c = request.getParameter("color");
              out.println("<be>the color selected is"+ c);
    }on giving the command
    C:\project1\app1>javac -classpath c:\Tomcat6\lib\servlet-api.jar:classes:. -d classes src\com\myweb\trying\Serv1.java
    this is what i got
    src\com\myweb\trying\Serv1.java:3: package javax.servlet does not exist
    import  javax.servlet.*;
    ^
    src\com\myweb\trying\Serv1.java:4: package javax.servlet.http does not exist
    import  javax.servlet.http.*;
    ^
    src\com\myweb\trying\Serv1.java:7: cannot find symbol
    symbol: class HttpServlet
    public class Serv1 extends HttpServlet {
                              ^
    src\com\myweb\trying\Serv1.java:8: cannot find symbol
    symbol  : class HttpServletRequest
    location: class com.myweb.trying.Serv1
           public void doPost(HttpServletRequest request,HttpServletResponse respon
    se)throws IOException,ServletException{
                              ^
    src\com\myweb\trying\Serv1.java:8: cannot find symbol
    symbol  : class HttpServletResponse
    location: class com.myweb.trying.Serv1
           public void doPost(HttpServletRequest request,HttpServletResponse respon
    se)throws IOException,ServletException{
                                                         ^
    src\com\myweb\trying\Serv1.java:8: cannot find symbol
    symbol  : class ServletException
    location: class com.myweb.trying.Serv1
           public void doPost(HttpServletRequest request,HttpServletResponse respon
    se)throws IOException,ServletException{
                         ^
    6 errors please help what im doing wrong
    i have latest ver.6 of tomcat installed

    exchange the : in your classpath with a ;
    windows, in its infinite wisdom, uses a semi-colon as the path separator. the colon is what you would use if you were on unix, macosx, or linux.
    == eldrich

  • Begginers Problems - Servlet does not get the "Request property".

    I'm just beginning to learn about Servlet because fo my work. I have to do a servlet and a simple java file to interact with the servlet.
    The only problem i have is that when i'm trying to send some Request property to the servlet does not get that property.
    Thank in advancing to anyone who can help.
    /** The Servlet code */
    package com.sigmatao.gde;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.lang.String;
    public class test extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    PrintWriter out = response.getWriter();
    //ServletInputStream in = request.getInputStream();
    response.setContentType("text/html");
    out.println("<html>");
    out.println("<body>");
    out.println("Hello World via get!!!");
    out.println("</body>");
    out.println("</html>");
    out.flush();
    out.close();
    public void doPost(HttpServletRequest req, HttpServletResponse res)throws IOException, ServletException {
    String men = req.getParameter("Valor");
    res.setContentType("text/html");
    // ServletInputStream in = request.getInputStream();
    PrintWriter out = res.getWriter();
    out.println("<html>");
    out.println("<body>");
    out.println("Hello World via post!!!");
    out.println(men);
    out.println("</body>");
    out.println("</html>");
    out.flush();
    out.close();
    /** The java file */
    import java.net.*;
    import java.io.*;
    import java.net.HttpURLConnection.*;
    import java.lang.String;
    public class testpost{
    public static void main(String[] args) throws Exception {
    // create instance of url
    URL url = new URL(args[0]);
    HttpURLConnection con = (HttpURLConnection)(url.openConnection());
    // set a request property with it�s value
    con.setRequestProperty("Valor","Recibi Parametro");
    // specify that the default request method is post
    con.setRequestMethod("POST");
    con.connect();
    // get an input stream for reading
    InputStream in = con.getInputStream();
    // create a buffered input stream for efficency
    BufferedInputStream bufIn = new BufferedInputStream(in);
    // repeat until end of file
    for (;;){
    int data = bufIn.read();
    // check for EOF
    if (data == -1)
    break;
    else
    System.out.print((char)data);
    /* The result of execution **/
    C:\Temp\URL>java testpost http://localhost:8080/gde/test.do
    <html>
    <body>
    Hello World via post!!!
    null
    </body>
    </html>

    Thanks for the advice, but unfortunalety I need to do it with a java file because it is a specific requirement for the project I am working in.
    Thanks for your time.

  • Package javax.servlet.http does not exist & package javax.servlet does not

    Hello!
    I am trying to compile this file:
    /* serv2.java 29 Sep 04 */
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class serv2 extends HttpServlet
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
                                  throws ServletException, IOException
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              out.println("<HTML><HEAD><TITLE>Sample Servlet</TITLE></HEAD>"+'\n'+
                                  "<BODY BGCOLOR='lightgreen'>"+'\n'+
                                  "<H1 ALIGN=CENTER>Heading</H1>" + '\n' +
                                  "<P><H2 ALIGN=CENTER>Message</H2");
              out.println("</BODY></HTML>");
    }And I am getting this error message:
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:4: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:5: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:7: cannot resolve symbol
    symbol : class HttpServlet
    location: class serv2
    public class serv2 extends HttpServlet
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:9: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class serv2
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:9: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class serv2
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:10: cannot resolve symbol
    symbol : class ServletException
    location: class serv2
                                  throws ServletException, IOException
    ^
    6 errors
    Tool completed with exit code 1
    I have tried setting CLASSPATH lib/servlet.jar but it still will not work.
    Please help me!!!

    Please check this page,
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    and also
    serv2 -> set it to Serv2
    another nice to read :-)
    http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
    +"Class names should be nouns, in mixed case with the first letter of each internal word capitalized"+
    Another thing,
    Put your class in a package, thanks =)
    regards and goodluck,
    jie

Maybe you are looking for

  • How do you download an older version of iTunes?

    I recently purchased a new laptop, running on Windoes Vista 32bit home premium, and immediately downloaded iTunes onto it with no problems. Then there was a new version of iTunes - 9.0 and subsequently 9.0.1. When it came to installing the upgrade, I

  • ACR 5.x and Canon EOS 5D Mark II with FW 1.0.7 sRAW1/2

    Hi, is there a ACR update in the line for the Canon EOS 5D Mark II loaded with the new Firmware 1.0.7? With the new Firmware 1.0.7 sRAW1 files and sRAW2 files will apparently show a magenta shift in darker areas. Info to the new Firmware: http://web.

  • Footnotes in iCloud Beta

    Can't figure how to add footnotes in iCloud beta, have tried it in IE, Firefox and Chrome.

  • Moving from BSP to WD ABAP technology

    Hi experts , Does any body know the key benefits of moving the BSP application to WD ABAP technology. Also, please let me know  how much can we re-use from existing BSP application. Regards, Amit Saini

  • RV042 Shrew soft client NAT-t new mapping

    Hi everyone, Since I had Quick VPN issue, so I tried the Shrew soft client hoping to get the IPSec tunnel with router RV042 in Client2gateway mode. On Shrew client, I got "Tunnel is activated" but got establised failed errors. On RV042 IPSec log, it