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

What are stored procedures? How is it useful?

0 Answers  


Can constructor be used instead of init(), to initialize servlet?

0 Answers  


How does a jsp engine work?

0 Answers  


Differentiate between include directive and include action.

0 Answers  


Can we override the jspinit(), _jspservice() and jspdestroy() methods?

0 Answers  






Why use of scripting elements in jsp is discouraged?

0 Answers  


Are dialogue tags necessary?

0 Answers  


Differentiate between <jsp:include page=…> and <%@include file=…>.

0 Answers  


What is the use of jstl tags in jsp?

0 Answers  


Explain client and server side validation?

0 Answers  


What are actions and directives in jsp?

3 Answers   Ocwen,


Explain the jsp life cycle?

0 Answers  


Categories