Tuesday 16 December 2014
Monday 15 December 2014
Tuesday 9 December 2014
Populate Data to Select One Choice from Bean
Hello Fellas,
Today I'm Sharing my learning to how to populate data to select one choice Programitically
Steps Involded
1. In the managed bean create a property and make its accessor and mutators.
2. put this code in the getter method.
3 select the component i.e. select one choice on the page, use it's selectItems component,
use its value field, and put this code there.
Today I'm Sharing my learning to how to populate data to select one choice Programitically
Steps Involded
1. In the managed bean create a property and make its accessor and mutators.
private ArrayList<SelectItem> al=new ArrayList<SelectItem>();
public void setAl(ArrayList<SelectItem> al) {use javax.faces.model.SelectItem;
this.al = al;
}
public ArrayList<SelectItem> getAl() {
return al;
}
2. put this code in the getter method.
public ArrayList<SelectItem> getAl() {
al.add(new SelectItem("x1","India"));
al.add(new SelectItem("x2","China"));
al.add(new SelectItem("x3","Sri Lanka"));
al.add(new SelectItem("x4","Japan"));
return al;
}
3 select the component i.e. select one choice on the page, use it's selectItems component,
use its value field, and put this code there.
<f:selectItems id="si2" value="#{XBean.al}"/>
Bean
jspx
thank you :)
Monday 1 December 2014
Email Validation in ADF
Hello Fellas,
Today I'm sharing my learning to how to make a custom validation in Oracle JDeveloper,
Create a java class,
Lets take an example to create a e-mail validation,
Today I'm sharing my learning to how to make a custom validation in Oracle JDeveloper,
Create a java class,
Lets take an example to create a e-mail validation,
import java.io.Serializable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;import javax.faces.application.FacesMessage;import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
public class EmailValidator implements Serializable, Validator {
public EmailValidator() {
super();
}
public void validate(FacesContext facesContext, UIComponent uiComponent,
Object object) {
String value = (String)object;
if ((value == null) || value.length() == 0) {
System.out.println("null value found");
return;
//System.out.println("null value found");
}
//String expression="^[\\\\w\\\\-]([\\\\.\\\\w])+[\\\\w]+@([\\\\w\\\\-]+\\\\.)+[A-Z]{2,4}$";
String expression =
"^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
CharSequence inputstr = value;
Pattern pattern =
Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(inputstr);
if (!matcher.matches()) {
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Enter the proper Email Id",
null));
}
}
}
Go to faces-config.xml and open validators tab give a meaningful Id like EmailValidator
& class name
in this case it should be EmailValidator(along with the package)
in the input file just write
<af:inputText label="Enter EmailID" id="it1">
<f:validator validatorid="EmailValidator"/>
</af:inputText>
thank you :)
Subscribe to:
Posts (Atom)
A Guide to Installing Oracle HR Schema on an Existing Docker Container
Hi Reader, Today I want to share my learning on how to install Oracle HR schema on a existing docker container. Step 1: Download the verif...
-
Hello Fellas, today i'm sharing my learning to how to delete all files and folders in windows. rd /s/q FolderName thank you :)
-
Hello Fellas, Today I'm sharing my source code to find H.C.F. using Java. MyException.java TwoDigit.java Thank You :)
-
see who is the current user. whoami enter the command to change the password. passwd user_name enter the old password. enter the new p...