it displays everything and when clicked it opens the hyperlink but never go to the method. I create a test method that only displays message.
Any help is appreciated
basicaly, you will need a servlet.
That servlet can call your java method.
And the servlet can be "called" by your browser(html) trough href.
I need to do some actions when a learning object is selected before browsing the website. To be more clear a learning object will be considered consumed when clicked. So what is the way to combine these two actions?
Asume that your consumedLO object works with keys (a key matches an url), you can pass that key via your servlet, to your consumedLO instance.
You do your stuf you want to do.
Then, do a response-redirect to the url that matches the key.
this is what you want?
Nada Bajnaid wrote:Can I call a servlet that will call the java method then go to the website without any more clicks. In this case I will pass the address of the website to the server through the href.
Is this the right way?
or, indeed, you can pass the address of the website to the server through the href.
Nada Bajnaid wrote:Yes it external website. Can I call another servlet passing the address of the link through the href. then in the new servlet I call the java method passing to it this address. After that I use go to go to the link.
Is it right way?
its a solution.
But why 2 servlets?
1 servlet will do.
from your browser, after click, request with the url as parameter comes in the servlet.
you do your stuff with you java methods
and then you do a response sendredirect (from within your servlet of course) to the url that was send as parameter.
so , 1 servlet.
I will try it this way
out.println(name + " has consumed " + lo);
then the <body> tag contains other stuff that will call my method conumedLO with onClick
is this a correct code? if not how can I embeded a function as java script in a servlet and how to pass parameters to this function