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?



i have one jsp page. inside this, String s=req.getParameter("raja");...... now we want ..

Answer / 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

More JSP Interview Questions

How to make a “new line in html” in jsp?

0 Answers  


Why is _jspservice() method starting with an '_' while other life cycle methods do not?

0 Answers  


Can we override jsp service method?

0 Answers  


What are the different types of jsp tags?

0 Answers  


Can jsp run without server?

0 Answers  






What is jsp in javascript?

0 Answers  


What is an api with example?

0 Answers  


Why does jcomponent have add() and remove() methods but the component does not?

0 Answers  


What are jsp and servlets?

0 Answers  


What is the difference between jsp and php?

0 Answers  


What is jsp standard tag library, provide some example usage?

0 Answers  


What is session tracking in jsp?

0 Answers  


Categories