Win a copy of Getting started with Java programming language this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Include servlet to read and print a file in html  RSS feed

 
sharjeel afzal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to read file name from a form text file and contents of the file from another text field
in one Servlet i want to write a file according to file name get by the form and save the contents.
now i want to include another servlet witch read that file and print in html formate

how it is possible
 
Ankit Garg
Sheriff
Posts: 9599
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to read file name from a form text file and contents of the file from another text field

Is it file or field?? If its field, then it shouldn't be much of a problem (its not a problem the other way too), you can use ServletContext.getRealPath("/path.ext") to write to the file and ServletContext.getResourceAsStream to read the file.
now i want to include another servlet witch read that file and print in html formate

Shouldn't it be which
 
Salil Vverma
Ranch Hand
Posts: 257
Hibernate Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sharjeel,

As ankit told, this is definitely possible. Kindly let us know the specific area where you are facing issues.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!