• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in coding

 
babita goyal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html>
<body>
<%@ page import="java.lang.*"%>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.String"%>
%@ page import="static java.lang.String"%>
<%! final static int min=4;
String newstr;
char[] rep;
boolean passlen(String password){
if(password.length()< min) return false;
return true;
}
boolean passdigit(String password){
for(int i=0;i<password.length();i++)
if(Character.isDigit(password.charAt(i)))
return true;
return false;
}
boolean passwordpolicy(String password){
if(passlen(password) && passdigit(password))
return true;
return false;
}
%>
<% String password=request.getParameter("pass"); %>

<% if(passwordpolicy(password)){%>
<p>thank you
<p>your password meets the security



<%} else {%>
<P> sorry
<p>your password doesnot meet the security policy

<% }%>
<%


int len=password.length();
if(len>4){
%><p>password=<%= password %><%


newstr=password.substring(0,3);
for(int i=0;i<=len;i++)
{
rep=password.charAt(i);
%><p>rep=<%=rep[i] %><%



%><p>newstr=<%= newstr %><%
}}%>


</body>
</html>
there is problem, it isnot showing the character ,error of in line rep=password.charAt(i);
plss help see the coding basically i want to do encoding so fetch every character from string password .
thanku
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rep is a character array and the charAt() method returns a single character. You are trying to assign a single character to a character array, hence the error

Try this
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!