Saturday, May 10, 2008

Medicine for foot corns

SALACTIN lotion is the good medicine.It took 2 weeks to get completely cured.

Friday, December 14, 2007

Replacing the pipe "|" symbol in in a string using java

If u want to replace pipe symbol "|" in a sentence with %7C using java code .U need to write the code like this

String s="google|yahoo";
s=s.replaceAll("\\|","%7C");

Now "|" will be replaced by %7C

Monday, September 3, 2007

Example of DynaActionForm in struts

struts-config.xml
----------------------


Action Class Example Which uses DynaActionForm
-----------------------------------------------------
package action;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;

public class Login extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
DynaActionForm loginForm = (DynaActionForm)form;
String username = (String)loginForm.get("userName");
String password = (String)loginForm.get("password");
System.out.println("user : "+username);
if(username == null || !username.equals("hari"))
return mapping.findForward("badusername");
else if(password==null || !password.equals("hari"))
return(mapping.findForward("badpassword"));
else
return(mapping.findForward("success"));
}
}