I am having a weird problem. I have a xsl and I need to call a servlet to get a value and use that value to call a java class for further processing. How can I do that? I have developed some code (which is bad), but I am struck on passing the servlet value as a parameter to java class.
Here is my code
Am I going in the right way? Is there any other alternate/better solution for this.
I don't really understand what that is supposed to do.
You have an XSL transformation which is generating HTML. The HTML which it generates contains an <input> element. And
you want to get data from that element??? That doesn't make any sense at all. The element doesn't contain any
data. When the HTML is rendered by the browser and the user looks at the form, the user might key something into
the element at that point, but that happens long after this transformation has finished.
And you want to "call a servlet"? And "get a value"? Does that mean you want to send a request to a server, where
that servlet will be invoked and return a response, and then extract some data from that response? It does help if
you call things by their real names. Also, as before, that form won't send a request until it is in front of a user.
So, I don't know what you are really trying to do there, but whatever it is, that isn't the right way to do it. You should
try to reframe your requirements in terms of XSLT generating HTML, the browser rendering it, the user clicking on
something which sends a request, and so on.
Joined: Feb 17, 2005
I know it was an ugly thing. OK, here is what I wanted to do.
I am writing a XSL channel (kind of portlet, this is for SunGard Luminis product), which onload should call a servlet (I need to use a servlet/jsp to get user information as they only have the request object). I need to use this user information to call another java class to get a string that needs to be displayed on the screen.
So as soon as the user login, he will see the result. What would be a good way to do this?
I read that what I am trying to do is not possible now, but is there an alternate for this.
that's just the tool for generating the HTML which you have the question about.
But wait... that was what you were doing in the first place. So just keep on doing that, only fix it so that the AJAX response changes
the HTML which you generated.
Joined: Feb 17, 2005
Thanks for the reply. I need to use the existing xsl, modify it so it gets the user information and gets data from database and display data according to the results which I got from the database.
To get the user information, I need servlet, then I need to access java class.
So the user information will come from AjaxServlet, I do not need to display that. So I might not be able to do what you suggested.
Anyways, I thought of another way of doing it,
1. xsl calling a java class without any parameters
2. call a servlet inside the java class
3. get the person details in servlet and send it to java class
4. use the person details and call the database and get the details and send it back to xsl.
I am struck in step 3. I am sending the value as objectstream and getting as objectstream in the java class, but I get "java.io.StreamCorruptedException: invalid stream header". I have posted this in the I/O forum.