Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: jsp

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default jsp

    i am unable to upload image in my webpage using html and jsp .....plz. help me


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: jsp

    Quote Originally Posted by Norm View Post
    i have used this jsp code:
    InputStream in = request.getInputStream();
    System.out.println(in.available());
    FileOutputStream fos=new FileOutputStream("D:/a.jpg");
    int size=1024*1024;
    byte b[]=new byte[size];
    int y=0;
    while((y=in.read(b))!=-1)
    {
     System.out.println(b);
    if(y==100){fos.write(b);
    }
    else
    {
    for(int j=0;j<y;j++)
    fos.write(b[j]);
    }}
    response.sendRedirect("rf1.jsp?");
    %>
    Last edited by curmudgeon; February 9th, 2013 at 12:04 PM. Reason: code tags added.

  4. #4
    Member
    Join Date
    Oct 2012
    Posts
    35
    My Mood
    Fine
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default Re: jsp

    What errors are thrown? Also, can you format your code so that it is easier to read(i.e. tab things over, comment things out, etc.)?

    --- Update ---

    And use the code tags when posting chunks of code. You can find them under "Advanced Mode" the "Add Code Tags" button is on the right side, just hover over the buttons until you find it.

    --- Update ---

    By quickly glancing at your code, it doesn't look like there are any methods, not even the main() method. I believe that in order for any code to execute, it needs to be in a method.

Similar Threads

  1. pass parameters from jsp to another jsp
    By chathura in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: March 24th, 2012, 12:50 PM
  2. Parent JSP Page is not refreshing properly after modifying a child Jsp.
    By jay_84 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 14th, 2011, 09:59 AM
  3. how to open a jsp in a new jsp
    By ajincoep in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: February 7th, 2011, 05:45 AM
  4. saving the data of the child jsp into parent jsp
    By nrao in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: January 15th, 2011, 11:05 AM
  5. Jsp help
    By hussain4hunt in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: December 31st, 2010, 05:52 PM