Posts

Showing posts from July 23, 2010

check valid URL for sitemaps in java code examples

How to check valid URL for sitemaps in java code, Examples

private boolean isValidMyUrl(String input) {
        Pattern p = Pattern.compile("[^A-Za-z0-9. ,@_$-]+");
        Matcher m = p.matcher(input);
        boolean result = m.find();
        if (result) {
            return false;
        } else {
            return true;
        }
    }

equals and equalsIgnoreCase in String java example

how to use equals and equalsIgnoreCase in String java example

public class Test {
        public static void main(String[] args) {       
            String st = new String("Test String Here");
            String st1 = new String("test string here");

            System.out.println(st.equals(st1));
            System.out.println(st.equalsIgnoreCase(st1));

        }
}

What is different type of indexOf() method in String java example

What is different type of indexOf() method in String java example

public class Test {
        public static void main(String[] args) {       
            String st = new String("test string test here");

            int index = st.indexOf((int)'t');
            System.out.println(index);

            index = st.indexOf((int)'t', 5);
            System.out.println(index);

            index = st.indexOf("test");
            System.out.println(index);

            index = st.indexOf("test", 10);
            System.out.println(index);
        }
}

BeanUtils.populate IllegalArgumentException: array element type mismatch

type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: BeanUtils.populate org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495) org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:627) javax.servlet.http.HttpServlet.service(HttpServlet.java:729)root cause
java.lang.IllegalArgumentException: array element type mismatch java.lang.reflect.Array.set(Native Method) org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:464) org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:986) org.apache.commons.beanut…

Recent Post

Recent Posts Widget