Ajith Anand

Ranch Hand
+ Follow
since Aug 30, 2004
Gandhi Seva Sadan, Pathiripala, Kerala, India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ajith Anand

In addition to what Ulf mentioned, I also see that fos.close() is also missing in your code.....
11 years ago
Why dont you try setting the response.setContentLength.....before streaming the response....
15 years ago
Inside the HTML you could do something like this

Here the SRC points to a servlet. It goes to the servlet with the appropriate details which helps the servlet retrieve the image from the database.

you can have DAOs or JDBC to access the database retrieve the BLOBs using the information provided in the query string to QUERY the database.
Once you have the image BLOB retrieved from the database , you need to set the content-type of the response to the appropriate image type eg: "image/jpg" . Write the content of the blob to the response stream of the servlet....
15 years ago
1. you may use JAXB for the first step of reading xml into java objects.



2. you may need to write a mapper class to map the attributes in these XML-Java Objects to parameters of an Insert PreparedStatement....
You may do like this if the references are made from a JSP.....


[ November 16, 2004: Message edited by: Ajith Anand ]
15 years ago
I would cross-check the configuration of the context path in this case.
15 years ago
Jakarta commons httpclient would be an option...if you are keen on timeouts..etc
15 years ago

Originally posted by Kishore Dandu:


There should be other easier way to do this.

HppUrlConnection is not very reliable(it can lock ur threads and need extra programming to take care of releasing the threads) and is bi-directional, which is not necessary in cases.




In what sense is not reliable ??? I dont understand about the threads that you are talking about...locking and releasing ???

I dont think there is another way to do a post from one servlet to another....
15 years ago
Hi,
Are you sure you are looking for the Exceptions at the right place ???
I would suggest you replace the doGet Exception Handler from


to


Just to make sure that the exceptions are not getting drowned elsewhere....
Replace

"/images/banner_master_new_01.jpg"

with

"images/banner_master_new_01.jpg" ( The forward slash before the images is removed )

This would resolve your references relative to the context...and would work in both your development and production environments without any changes....

15 years ago
You may use a java.net.HttpURLConnection to do the Post....
15 years ago
I use a server-side XML / XSLT based solution to build such explorer / tree interfaces. I have the metadata for building the explorer / tree interface in an XML file. Using XSLT I transform the Interface to react to the user interaction.

Client-side java scripts werent a good idea for me, because I have seen how messy it can get when it comes to cross browser issues and the hacks you have to incorporate. Even after all this you can hardly be sure that it works the way you want it.

Unlike client-side "validations", where round-trips can at times prove costly or unwarranted; With these interfaces , along with the change in the "VIEW" of the interface, the client would most of the times require to fetch new content from the server as a response to the change in the tree / explorer view, so it is anyways making a roundtrip.....
[ November 11, 2004: Message edited by: Ajith Anand ]
15 years ago
JSP
Pluggable implementations are normally designed around Interfaces.

Servlets are no different. They are pluggable implementations with a predefined lifecycle.
Create/Service/...../Destroy.

Servlet-Container considers for Servlets only those classes which implements javax.servlet.Servlet Interface. Each Servlet
implements this interface indirectly. We normally dont come across "implements javax.servlet.Servlet"
because it is already done for us up in the inheritance hierarchy.
We make use of the helper implementations of either the abstract java.servlet.http.HttpServlet by way of extending it in our
servlet implementation; which in turn extends javax.servlet.GenericServlet.
if you look at the class signature of the javax.servlet.GenericServlet , you will find that this abstract
class implements the javax.servlet.Servlet Interface, and tells the Servlet-container that I'm a Servlet.

Once the servlet-container knows something is a servlet. it knows what to do with it , because of the contract between the Servlet-container and
the implementing class established using the Interface.

While defining the interface there is no way for the designers to know what would be the signature of the
constructor of the implementing Servlet classes, and in turn enforce the contract , and make the Servlet-container call these constructors.
( Unless it resorts to reflection API to find out the constructor signature
and call them, at a drastic loss in performance )

So you have predefined methods for the lifecycle of the servlet, which the Servlet-container calls appropriately
during various stages of processing of the servlet.

As for the constructor the default constructor is anyways called.

You can create a constructor for the servlet with
ServletConfig as the parameter. But you have NO WAY way of telling the servlet container to call this method because it
does not happen to be part of the contract, and would be ignored.
15 years ago
Hi Bear,

Update me also if you have any cleaner possibilities...I could not use RequestDispatcher include mechanism because it does the inclusion runtime.There is no way I could snoop for the JSP; compiled and executed output.

We had a requirement where we were doing a passive jsp compilation, and execution of the compiled class and collection of the output in a buffer. A proprietary templating mechanism would then use this buffer along with other content-types from a database, dynamically and publish....goes without saying that the publishing server isnt J2EE ...

it might be helpful to me also..
15 years ago
Hi Bear,


I do something like this ...
After reading the jsp snippet from a stream, in your case from the jar file, I HTTP POST the jsp snippet to a servlet. it is passed as a request parameter called "jsp". The code of the interpreter servlet is reproduced below....Works for me.


Interpreter.jsp



[ November 03, 2004: Message edited by: Ajith Anand ]
[ November 03, 2004: Message edited by: Ajith Anand ]
15 years ago