Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

olivier dutranoit

Ranch Hand
+ Follow
since Aug 20, 2011
olivier likes ...
IBM DB2 Eclipse IDE Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by olivier dutranoit


The error has nothing to do with your doctype...thats for you HTML.

don't you forget the *.tld extention?

<%@ taglib uri=""; prefix="bean" %>
should be
<%@ taglib uri=""; prefix="bean" %>

What is see in your jsp is the following :

String dist=(String)sess.getAttribute("distance");
String transport=(String)sess.getAttribute("service");
String amt=(String)sess.getAttribute("estimateamt");

First of all, your primitives "long" are put into session, trough autoboxing.

Further, you want to get them out. (code above)
You need to cast them back to long.
You cannot cast a primitive long to String
use String.valueOf(value) instead to get your string.

8 years ago

If you want tu use client-side validation, with javascript, the best way is to use regular expressions.
Plenty of examples on the web.

if you want use HTML5, you can use the build in validators (no script needed) :

BUT, html5 is not supported very well at hte moment :-)

Seems to me that it is not the java Mail, but the mail server that gives you problems.

You should check the mail server configuration (if possible).
Also your ISP could be the problem...
8 years ago

You will have to use some script for that.
Clicking the href, the value of username should be retrieved trought script, and be passed along with the href-url.

What don't you just let the user post his data, and just give an error, telling that the username exists? You just show the same page again with the same data, but with an error on top. You could even go further and suggest a username...

just a thought...
try seting your "Content-Length" in your response header.


response.setHeader("Content-Length", String.valueOf(lenght-of-your-file));

what happens?
8 years ago
I googled some.
Must say, its pretty new to me.

But one thing that comes up is, not to do it trough servlets that are keeping open the connection...

They all talk about java websockets.

for example i found this :

i will try to experiment with this too!
if you have a working example, can you share it?

8 years ago
maybe you should import the "doMarkDoneOutboundCall"
Just like the other imports.
8 years ago
Oh i see :-)

didn't see the html5-thing
Now i see what you are asking.
I got your question totaly wrong :-)
8 years ago

there are existing systems out there doing this stuff

for example, check COMET

8 years ago
try changing your

that should be enough i think...
it should be ignored by jsp and shown good in html
8 years ago
inside your dopost method you do first your consumedLO stuff
right after that , still in the same dopost,
you do a response.sendredirect(the_url_that_was_given);

nothing more...
8 years ago

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.

8 years ago

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.
8 years ago