• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

passing variable value in xsl

 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

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.


Any help is appreciated.

Thanks.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul,

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.

Thanks again.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vjy chin wrote:which onload should call a servlet


So you'd put some Javascript into the HTML you generate, which would send an AJAX request to that servlet. Nothing to do with XSLT,
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.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul,

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.

Thanks for your help again Paul.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vjy chin wrote:I have posted this in the I/O forum.



Good idea, that question does fit better over there.

Although you might consider connecting to the servlet before you process the XSLT, and pass the servlet's response
into the XSLT as a parameter. That seems a bit less convoluted to me.
 
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic