i have one jsp page. inside this,
String s=req.getParameter("raja");......
now we want to remove duplicate characters and o/p will be
like "rj".... what is the logic?

Answer Posted / sajin dhas

Please check below jsp code.

<% String message= "saajin";
for (int i = 0; i < message.length(); i++){
for (int j = i + 1; j < message.length(); j++){
if (message.charAt(i) == message.charAt(j)){
message = message.substring(0,(j - 1)) +
message.substring(j + 1, message.length());
out.println("Servlet Communicate Messge\n"+message);
}
}
}
%>

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is it not necessary to configure standard jsp tags in web.xml?

497


What do you know about writing custom jsp tags?

489


What is application in jsp?

462


What do you know about jsp tags?

522


Why are jsp pages the preferred api for creating a web-based client program?

540






How do I use a scriptlet to initialize a newly instantiated bean?

548


What is in jsp?

620


What are the types of jstl tags?

547


What is full api?

508


How do you pass control from one jsp page to another?

507


Explain jsp technology?

527


Is jsp technology extensible?

657


What is a scriptlet in jsp and what is its syntax?

481


What are the differences between get and load methods?

511


Is jsp better than servlet?

486