Null value in OA shuttle bean
Hi,
Can a shuttle have a null value.
ie the VO query attached to the shuttle returns null value.
and whenever we attach that particular shuttle to the page,on clicking on any LOV it gives the error
You are trying to access a page that is no longer active.The referring page may have come from a previous session. Please select Home to proceed.
when I put a where clause to restrict the query (in this case it does not return any null value) I am not getting any error.
Any thought as what could be the issue.Issue is resolved...but would like to know the reason.
Thanks
Thanks Reetesh.
Actually, on page 1 itself the parameter value is null. After issueing a commit, the parameter has a correct value but without a commit, the parameter has a null value.
We are on 11.5.10 / RUP7.
Thanks,
Naga
Similar Messages
-
Struts ActionForm bean retuning null values
Hello friends,
I am new to struts framework, I am trying a simple application which gets form details from user store it in ActionForm and showing in a jsp. Now the problem is when i try to get the bean values form the Action form it is returning only null values. but the values i entered in <html:form> is getting stored in the ActionForm.
I am very much confused with this problem.Your help is greatly appreciated
regards,
Muthur035198x wrote:
I'm not too sure about this but I think struts questions are not all that welcome in this forum.
Better try the dedicated struts forum at Apache.They're not per definition forbidden here, but it's just merely that you will have more chance to meet real Apache Struts experts at a Apache Struts forum instead of a general Sun Servlet forum, let alone Sun JSP/JSTL or Sun JSF forum. -
Is it possible to filter a table for NULL values in a column? (11g)
I am using the out-of-the box table filtering provided by ADF Faces RC, but cannot figure out how to filter on Null value that are in the table.
I have tried "IS NULL" and "= NULL", but nothing works.
I have a backing bean that intercepts the filtered values before the filter is applied, and I can't set it there either.
Does anyone know how this is accomplished?No, it is not. Worse, many people will view this in any old PDF viewer, most of which won't have overprint preview at all.
You need to send very clear instructions about this, with specific screen shots - or better, avoid tools and constructions that require it. Probably some wording about "need to view with suitable professional tools" will make the message more palatable. -
How to post null values from h:inputText?
Hello,
I have a form made of h:inputText fields that map to an entity class as the backing bean. Whenever I post the form from a web page, all the fields that I did not fill out and that are mapped to String fields in the entity class are set to "" (empty string) instead of null.
However, I would like to post null values to my entity, because that would indicate that the user did not fill out the field. In other contexts (outside of the web app) it is possible to set the fields to empty strings, but from the web app it should always be null. How can I get JSF to do this correctly?
Also, when reading entitys with null values from the database, these are converted to empty h:inputText fields, so this direction works as expected.
UlrichI haven't seen a solution for this as far.
This is how I do it:
public void action() {
if (isEmpty(inputValue)) {
// do your thing
} else {
// do your thing
public static boolean isEmpty(Object value) {
if (value == null) {
return true;
if (value instanceof String && ((String) value).trim().length() == 0) {
return true;
if (value instanceof Collection && ((Collection) value).size() == 0) {
return true;
// And go so on .. make it an utility method.
return false;
} -
HELP NEEDED !! Null values in Database
Hi there !!
I need help with EJB 3.0 passing null values to database. The situation looks like that :
I have created EJB entity class called "Osoba.java", it is in relation
with "Rola.java" (one to many). Each Object of class Osoba can have
many Roles. Then I created "OsobaServiceBean.java " I included it with
metod "CreateUnregisteredOsoba(Osoba , Boolean)". From "flex" level I
call this bean - call is accepted, and as a result new object of class Osoba is added to database. Problem is that only one column is filled in table,
dispite that in service bean I enforce it to fill all columns (see
source code - file OsobaServiceBean.java , method
createUnregisteredOsoba() )
I provided source code here :
FILE Rola.java
package test.granite.ejb3.entity ;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@Entity
public class Rola extends AbstractEntity {
private static final long serialVersionUID = 1L;
@Basic
private String login = new String("");
@Basic
private String rola = new String("");
@Basic
private String roleGroup = new String("");
@Basic
private Boolean zatwierdzony = new Boolean(false);
@ManyToOne(optional=false)
private Osoba osoba;
public Boolean getZatwierdzony() {
return zatwierdzony;
public void setZatwierdzony(Boolean zatwierdzony) {
this.zatwierdzony = zatwierdzony;
public String getLogin() {
return login;
public void setLogin(String login) {
this.login = login;
public String getRola() {
return rola;
public void setRola(String rola) {
this.rola = rola;
public Osoba getOsoba() {
return osoba;
public void setOsoba(Osoba osoba) {
this.osoba = osoba;
public String getRoleGroup() {
return roleGroup;
public void setRoleGroup(String roleGroup) {
this.roleGroup = roleGroup;
FILE Osoba.java
package test.granite.ejb3.entity ;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
@Entity
public class Osoba extends AbstractEntity {
private static final long serialVersionUID = 1L;
@Basic
private String imie;
@Basic
private String nazwisko;
@Basic
private String login;
@Basic
private String haslo;
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER,
mappedBy="osoba")
private Set<Rola> role = new HashSet<Rola>();
@Basic
private String email;
@Basic
private String nrTelefonu;
@Basic
private int rokStudiow;
public String getPelneImie() {
StringBuilder sb = new StringBuilder();
if (imie != null && imie.length() > 0)
sb.append(imie);
if (nazwisko != null && nazwisko.length() > 0) {
if (sb.length() > 0)
sb.append(' ');
sb.append(nazwisko);
return sb.toString();
public String getImie() {
return imie;
public void setImie(String imie) {
this.imie = imie;
public String getNazwisko() {
return nazwisko;
public void setNazwisko(String nazwisko) {
this.nazwisko = nazwisko;
public String getLogin() {
return login;
public void setLogin(String login) {
this.login = login;
public String getHaslo() {
return haslo;
public void setHaslo(String haslo) {
this.haslo = haslo;
public Set<Rola> getRole() {
return role;
public void setRole(Set<Rola> role) {
this.role = role;
public String getEmail() {
return email;
public void setEmail(String email) {
this.email = email;
public String getNrTelefonu() {
return nrTelefonu;
public void setNrTelefonu(String nrTelefonu) {
this.nrTelefonu = nrTelefonu;
public int getRokStudiow() {
return rokStudiow;
public void setRokStudiow(int rokStudiow) {
this.rokStudiow = rokStudiow;
FILE OsobaServiceBean.java
package test.granite.ejb3.service;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.Query;
import org.jboss.annotation.security.SecurityDomain ;
import test.granite.ejb3.entity.Osoba;
import test.granite.ejb3.entity.Rola;
@Stateless
@Local(OsobaService.class)
@SecurityDomain("other")
public class OsobaServiceBean extends AbstractEntityService implements
OsobaService{
private static final long serialVersionUID = 1L;
public OsobaServiceBean() {
super();
public List<Osoba> findAllOsoba() {
return findAll(Osoba.class);
@SuppressWarnings("unchecked")
public List<Osoba> findAllOsoba(String name) {
Query query = manager.createQuery (
"select distinct p from Osoba p " +
"where upper(p.imie) like upper('%" + name + "%')
or upper(p.nazwisko) like upper('%" + name + "%')"
return query.getResultList();
public Osoba createOsoba(Osoba person) { // pozwalamy
tworzyc zeby niezalogowany
return manager.merge (person); //
uzytkownik utworzyl osobe
} // ale
osoba ta i tak nie bedzie jeszcze
// zatwierdzona
@RolesAllowed({"unregistered"})
public Osoba createUnregisteredOsoba(Osoba person, boolean
zatwierdzony) {
Rola niezarejestrowany = new Rola();
niezarejestrowany.setRola("user");
niezarejestrowany.setOsoba(person);
niezarejestrowany.setRoleGroup("Roles");
niezarejestrowany.setLogin(person.getLogin());
niezarejestrowany.setZatwierdzony(zatwierdzony);
Set<Rola> role = new HashSet<Rola>();
role.add(niezarejestrowany);
// Arrays;
Object a[] = role.toArray();
Rola temp;
temp = (Rola)a[0];
System.out.println("Login = " + temp.getLogin() + //
added only for check !!
"Rola = " + temp.getLogin() +
"Zatwierdzony = " +
temp.getZatwierdzony() +
"Rolegroup = " + temp.getRoleGroup());
person.setRole (role);
return manager.merge(person); //
uzytkownik utworzyl osobe
} // ale
osoba ta i tak nie bedzie jeszcze
public Osoba modifyOsoba(Osoba person) {
return manager.merge(person);
@RolesAllowed({"admin"})
public void deleteOsoba(Osoba person) {
person = manager.find(Osoba.class, person.getId());
manager.remove(person);
public void deleteRola(Rola rola) {
rola = manager.find(Rola.class, rola.getId());
rola.getOsoba().getRole().remove(rola);
manager.remove(rola);
DATABASE LISTING :
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
| id | ENTITY_UID | version | rola |
zatwierdzony | osoba_id | login | RoleGroup |
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
| 1 | | NULL | unregistered |
| 0 | unregistered | Roles | NULL |
| 33 | eee91bd9-8c5f-4154-8260-3cac9a18eb97 | 0 | user |
| 34 | NULL | NULL |
| 32 | a7ed4e8d-a1ba-473a-921c-73c8f8f89efb | 0 | user |
| 33 | NULL | NULL |
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
The row numer 1 is added by hand and it works. row number 33 and 32
are added to database by method CreateUnregisteredOsoba. As you can
see fields login as well as Roles and RoleGroup are empty (NULL). What
Im doing wrong ?
Thanks for your help -
Roman Kliś
PS. Table Osoba works fine - everything is added as I want.I solved problem.
The reason why EJB had not added anything to database NULL was becouse wrong names of class. Ive refactored whole class Rola.java to RolaClass.java and suddenly it worked.
True reason is still unknown but most importent is that it works.
Thanx for reading topic - hope next time someone will answer my questions.
By !! -
Setting null values to view.attributes
Hi all, I am getting following NPE posting form to server. Below I m writing snippet of code which causes the issue:
SEVERE: value is null for a not available property: test
java.lang.NullPointerException: value is null for a not available property: test
at javax.faces.component._ComponentAttributesMap.put(_ComponentAttributesMap.java:303)
at javax.el.MapELResolver.setValue(MapELResolver.java:90)
at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:69)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:180)
at org.apache.el.parser.AstValue.setValue(AstValue.java:158)
at org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
at org.apache.jasper.el.JspValueExpression.setValue(JspValueExpression.java:85)
at javax.faces.component.UIInput.updateModel(UIInput.java:287)
at javax.faces.component.UIInput.processUpdates(UIInput.java:214)
at javax.faces.component.UIForm.processUpdates(UIForm.java:99)
at org.ajax4jsf.component.AjaxViewRoot$2.invokeContextCallback(AjaxViewRoot.java:424)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:240)
at org.ajax4jsf.component.AjaxViewRoot.processUpdates(AjaxViewRoot.java:440)
at org.apache.myfaces.lifecycle.UpdateModelValuesExecutor.execute(UpdateModelValuesExecutor.java:33)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:151)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)My Jsp Page code snippet:
<t:selectOneMenu value="#{view.attributes['test']}">
<f:selectItems value="#{myController.listValues}"/>
</t:selectOneMenu>MyController.java bean property:
public List<SelectItem> getListValues() {
listValues.clear();
SelectItem si = new SelectItem("", "-Select-");
SelectItem si2 = new SelectItem("1", "1");
SelectItem si3 = new SelectItem("2", "2");
listValues.add(si);
listValues.add(si2);
listValues.add(si3);
return listValues;
}When user selects nothing, I need to set NULL value for this drop down. Kindly suggest if there is any other way or best practice to do the same.I am using Myfaces 1.2.5 for JSF 1.2. This thing was working fine in Myfaces 1.1.5 for JSF 1.1.Any suggestions?Give this a try:
<t:selectOneMenu value="#{view.attributes['test']}">
<f:selectItem itemLabel="-Select-" />
<f:selectItems value="#{myController.listValues}"/>
</t:selectOneMenu>
public List<SelectItem> getListValues() {
listValues.clear();
listValues.add(new SelectItem("1", "1");
listValues.add(new SelectItem("2", "2");
return listValues;
}Note: I cleaned up your getListValue() a bit - most of the changes are cosmetic except for removing you '-Select-' selectItem. Also, why do you use a class level variable if you are generating it on each call? Either generate the list on constructor call (or when needed) and just return it from getListValues(), or simply use a local variable. -
Component binding return null value
I'm migrating a JSF 1.2 application to JSF 2.1, specificly I'm currently using mojorra 2.1.24.
The application consists of request scoped beans, and in order to pass data between requests, it embeds the data inside UI components.
The following behaviour works well with JSF 1.2, but not with JSF 2.1.
The application has the following configuration:
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
The page contains the following snippet:
<h:form prependId="false">
<h:inputHidden binding="#{bean.inputHidden}" />
<h:panelGroup rendered="#{bean.rendered}">
<h:commandLink value="onAction" action="#{bean.onAction}" />
</h:panelGroup>
</h:form>
The bean is the following:
@ManagedBean
@RequestScoped
public class Bean {
private UIInput inputHidden;
private AItem item;
public setInputHidden(UIInput inputHidden){
this.inputHidden = inputHidden;
if(item != null){ this.inputHidden.setValue(item); }
public AItem getItem(){
return (AItem) getInputHidden().getValue();
// other getter/setter
public String onNavToPage(AItem item){ this.item = item; return "page"; }
public String onAction(){ //... do something return ""; }
public boolean isRendered(){ return getProcessItem() != null; }
The steps are the following:
to navigate to page page the method bean.onNavToPage is invoked from within another page;
upon page rendering the bean.item is set as bean.inputHidden value;
after the page is diplayed, the command link is pressed.
At this point no command link is invoked, because the bean.inputHidden.getValue() returns null, and the command link is not processed.
I noticed that the inputHidden parameter passed to the setInputHidden method during restore view phase has, inputHidden.getValue() == null, no value has been saved previously in the view.
I would guess that something has changed in the component state management, but debugging the JSF code I didn't find what.
Debugging JSF code I found that the component state has been masked before the state has been saved in the view, so the ComponentStateHelper.saveState saves the deltaMap and not the defaultMap, where all the state has been put.
public Object saveState(FacesContext context) {
if (context == null) {
throw new NullPointerException();
if(component.initialStateMarked()) {
return saveMap(context, deltaMap);
else {
return saveMap(context, defaultMap);
is this a bug?
If not, how can I restore JSF 1.2 behaviuor and save the defaultMap?
Thanks in advance for the help.0.10: Saved session state: 6385226710016200 "P327_OU_NAME" changedValue="test"
0.10: ...P327_FK_ORGUNIT session state saving same value: "%null%"
0.15: Saved session state: 6388922235040486 "P327_OU_DESC" changedValue=""
0.15: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
0.15: Branch point: BEFORE_COMPUTATION
0.15: Computation point: AFTER_SUBMIT
0.15: Perform Branching for Tab Requests
0.15: Branch point: BEFORE_VALIDATION
0.15: Perform validations:
0.16: Branch point: BEFORE_PROCESSING
0.16: Processing point: AFTER_SUBMIT
0.16: ...PLSQL (AFTER_SUBMIT) INSERT INTO INDIT_PS_ORGUNIT ( OU_ID, FK_ORGUNIT, OU_NAME, OU_DESC ) VALUES ( INDIT_PASS_SEQ_GENERIC_ID.NEXTVAL, :P327_FK_ORGUNIT, :P327_OU_NAME, :P327_OU_DESC )
0.16: Show ERROR page...
0.17: Processing point: AFTER_ERROR_HEADER
0.18: Processing point: BEFORE_ERROR_FOOTER
ORA-01722: invalid number
the table was created with:
CREATE TABLE INDIT_PS_ORGUNIT (
OU_ID NUMBER(15) PRIMARY KEY,
FK_ORGUNIT NUMBER(15) NULL,
OU_NAME VARCHAR2(30) NOT NULL,
OU_DESC VARCHAR2(30) NULL,
OU_DELETED DATE NULL
what i see is that the status is "%null%" and not really "" (NULL, nothing, ...).
so what can i do to insert a null value from a select list?
i gave up RTFM. because i found nothing (NULL) ?!?! -
UI Component (h:selectOneMenu) showing old value not matching backing bean
Mojarra 2.1.7-jbossorg-1
I'm out of my wits trying to figure out what is going on here.
I have broken down the problem that I am seeing to something smaller test case that is easily reproducable.
Two <h:selectOneRadio> ( Approved and Notified )
One <h:selectOneMenu> wrapped in a <h:panelGroup>
One <h:commandButton>
The list of contents of the <h:selectOneMenu> is dependent on the value of the "Approved" <h:selectOneRadio>, and the list is obtained from the viewBean.
Apart from the "required" attribute, the only other validation is a validator method in the bean that:
If "Approved" radio button is Yes, and "Notified" radio button is No, then a ValidatorException is thrown and is shown on the <h:messages>
Now the issue:
1) Select Approved "Yes"
2) Select Notified "No"
3) Select dropdown to PEND
4) Select Submit button
5) <h:messages> show "Notified must be true when action is PEND". All good.
6) Change Approved to "No" ... Note that there is a listener on change of Approved ... and the listener will always set the value of the dropdown to null.
Because I changed the value of the Approved radio button, the dropdown selection is then changed to the "- Select- " item, which is what I am expecting as that is what the listener method does ... and the dropdown is re-rendered.
7) Change Approved back to "Yes" ... dropdown changes back to PEND ... This is what I do not understand.
Why was it being changed back to PEND when:
A) The listener on the Approved radio button always sets the value of the dropdown to null in the backend.. and
B) The Approved render attribute always re-render the dropdown
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head></h:head>
<body>
<h:form>
<h:outputLabel value="Approved:"/>
<h:selectOneRadio id="approved" value="#{viewBean.approved}"
required="true"
requiredMessage="Approved is required.">
<f:selectItem itemValue="true" itemLabel="Yes"/>
<f:selectItem itemValue="false" itemLabel="No"/>
<f:ajax
event="valueChange"
execute="@this"
render="nextActionPanel"
listener="#{viewBean.triggerApprovedChange()}"/>
</h:selectOneRadio>
<h:outputLabel value="Notified:"/>
<h:selectOneRadio id="notified" value="#{viewBean.notified}"
required="true"
requiredMessage="Notified is required."
validator="#{viewBean.validateNotified}">
<f:selectItem itemValue="true" itemLabel="Yes"/>
<f:selectItem itemValue="false" itemLabel="No"/>
<f:ajax
event="valueChange"
execute="@this"
render="@none"/>
</h:selectOneRadio>
<h:panelGroup id="nextActionPanel">
<h:selectOneMenu id="nextAction"
required="true"
requiredMessage="Next Action is required."
value="#{viewBean.nextAction}">
<f:selectItem itemValue="" itemLabel="- Select -" />
<f:selectItems
value="#{viewBean.availableNextActions}" var="target"
itemValue="#{target.value}"
itemLabel="#{target.label}"/>
<f:ajax
event="valueChange"
execute="@this"
render="@none"/>
</h:selectOneMenu>
</h:panelGroup>
<h:commandButton id="submit" value="Submit"/><br/>
<h:messages/>
</h:form>
</body>
</html>
package test;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
@ManagedBean
@ViewScoped
public class ViewBean implements Serializable {
private static final long serialVersionUID = 1L;
private Boolean approved;
private Boolean notified;
private String nextAction;
private List<NextAction> availableNextActions;
public Boolean getApproved() {
return approved;
public void setApproved(Boolean selection) {
this.approved = selection;
public Boolean getNotified() {
return notified;
public void setNotified(Boolean selection2) {
this.notified = selection2;
public String getNextAction() {
return nextAction;
public void setNextAction(String nextAction) {
this.nextAction = nextAction;
public void triggerApprovedChange() {
changeAvailableNextActions();
setNextAction(null);
public List<NextAction> getAvailableNextActions() {
return availableNextActions;
private void setAvailableNextActions(List<NextAction> availableNextActions) {
this.availableNextActions = availableNextActions;
public void changeAvailableNextActions() {
List<NextAction> nextActions = new ArrayList<NextAction>();
if( Boolean.TRUE.equals( getApproved() )) {
nextActions.add( new NextAction("PEND", "Pend"));
nextActions.add( new NextAction("REQADVICE", "Request Advice"));
nextActions.add( new NextAction("FIN", "Finish"));
setAvailableNextActions(nextActions);
@PostConstruct
public void init() {
changeAvailableNextActions();
public void validateNotified(
FacesContext context,
UIComponent toValidate,
Object value)
throws Exception
List<FacesMessage> messages = new ArrayList<FacesMessage>();
Boolean isNotified = (Boolean) value;
if( Boolean.FALSE.equals( isNotified ) && "PEND".equals( nextAction )) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Notified must be true when action is PEND", null);
messages.add( message );
if( messages.size() > 0 ) {
throw new ValidatorException(messages);
public class NextAction implements Serializable {
private static final long serialVersionUID = 1L;
private String label;
private String value;
public NextAction(String aValue, String aLabel) {
value = aValue;
label = aLabel;
public String getLabel() {
return label;
public String getValue() {
return value;
}gimbal2 wrote:
jmsjr wrote:
Ok .. I am confused by what you just said .. as I did say that the same problem STILL exists in Mojarra 2.1.22.
ergo .. It is not an issue with the usage of JSF but appears to be a bug in the implementation.I meant a bug in the old version that JBoss ships with. But I also mean in general; as you can see JSF 2.x is already on release 22 - the chance of you finding such an easy to trigger bug has become relatively slim. So no, I must assume it is actually a problem with not understanding how JSF ticks properly. Which is understandable since after using it for 5 years it still surprises me occasionally.
The bug you link to is about values staying the same, not reverting back to a previous state.OK .. Maybe this will be more convincing (?). I change the xhtml so that it also displays ( via h:outputText ) .. the value of the backing bean that is the same value used for the h:selectOneMenu.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head></h:head>
<h:body>
<h:form>
<h:outputLabel value="Approved:"/>
<h:selectOneRadio id="approved" value="#{viewBean.approved}"
required="true"
requiredMessage="Approved is required.">
<f:selectItem itemValue="true" itemLabel="Yes"/>
<f:selectItem itemValue="false" itemLabel="No"/>
<f:ajax
event="valueChange"
execute="@this"
render="nextActionPanel"
listener="#{viewBean.triggerApprovedChange()}"/>
</h:selectOneRadio>
<h:outputLabel value="Notified:"/>
<h:selectOneRadio id="notified" value="#{viewBean.notified}"
required="true"
requiredMessage="Notified is required."
validator="#{viewBean.validateNotified}">
<f:selectItem itemValue="true" itemLabel="Yes"/>
<f:selectItem itemValue="false" itemLabel="No"/>
<f:ajax
event="valueChange"
execute="@this"
render="@none"/>
</h:selectOneRadio>
<h:panelGroup id="nextActionPanel">
Backing Bean value for nextAction is '<h:outputText value="#{viewBean.nextAction}"/>'<br/>
<h:selectOneMenu id="nextAction"
required="true"
requiredMessage="Next Action is required."
value="#{viewBean.nextAction}">
<f:selectItem itemValue="" itemLabel="- Select -" />
<f:selectItems
value="#{viewBean.availableNextActions}" var="target"
itemValue="#{target.value}"
itemLabel="#{target.label}"/>
<f:ajax
event="valueChange"
execute="@this"
render="nextActionPanel"/>
</h:selectOneMenu>
</h:panelGroup>
<h:commandButton id="submit" value="Submit" render="@form"/><br/>
<h:messages/>
<ui:debug/>
</h:form>
</h:body>
</html>All I changed was
1) Added the following:
Backing Bean value for nextAction is '<h:outputText value="#{viewBean.nextAction}"/>'<br/>.. which is in the same panel ( <h:panelGroup id="nextActionPanel"> ) as the <h:selectOneMenu>
2) Changed the render attribute of the h:selectOneMenu so that instead of @none, it is now:
<f:ajax
event="valueChange"
execute="@this"
render="nextActionPanel"/>3) Repeated the same steps as before ... and after step [6]:
3a) The h:outputText says:
Backing Bean value for nextAction is ''3b) But the h:selectOneMenu still has the PEND option selected. -
Geting null values from request
hi!
i m producing this code through out.println() method in my page and then using java script
i am submiting this page to another page
<td width="56%"><textarea name="question_no_1"></textarea></td>
<input name="question_no_1_radio1" type="radio" value="radio"></td>
<td width="59%"> <textarea name="question_no_1_ans1"></textarea></td>
<input type="radio" name="question_no_1_radio2" value="radio"></td>
<td><textarea name="question_no_1_ans2"></textarea></td>
<input type="radio" name="question_no_1_radio3" value="radio"></td>
<td><textarea name="question_no_1_ans3"></textarea></td>
<input name="question_no_1_radio4" type="radio" value="radio"></td>
<td><textarea name="question_no_1_ans4"></textarea></td>
but when i submit it to the other page and try to retrieve value of parameter "question_no_1"
through the bellow statement it shows a null value but i have given a value previously by
typing a question in it
System.out.println("the Body Of The First Question Is "+request.getParameter("question_no_1"));
can anybody help me what is going on here.
also if i try to normaly submit first page (ie <form="form1" method="post" action="other_jsp_page.jsp"> ) then the statement in the next page gives me the correct value but
i have to submit the first paper through java script.
if u want to see full detail of my code then go to the following link
http://forum.java.sun.com/thread.jsp?thread=309254&forum=45&message=1237097
thanx in advanceOK, your problem is that you are not submmiting the values to the other page. When you do the
--> document.forms[0].submit();
in JavaScript, the form has to action defined
--> <form name="form1" method="" action="">
So, the page does nothing. The line following the submit just changes the location of the page, IT DOES NOT POST the values.
One solutions is the following:
1.- define an action for your form:
<form name="form1" method="POST" action="'save_paper.jsp">
2.- Then create a JavaScript function that validates the fields and simply return "true" if the form is correct, and false if there is a problem (just a little modification of the one you have).
3.- Then modify your submit button:
Instead of:
<input type="button" name="Save" value="Save" onClick="validateField()">
Try:
<input type="SUBMIT" value="Save" onclick="validateField();"> -
Not to display the null values from data base
Hiiii.
In a jsp file i have ten check boxes.The jsp file is mapped to a servlet file for parameter requesting and to
store it in DB.
The unchecked box values has null values.All the values are store in a Mysql DB table.
Again i have to display it in a jsp page from table.
The problem am facing was,how can i display only the values in a row.it must not display the null values and the crresponding column name.
Or any other way is their like below
How i can retrieve only the selected check boxes from tht jsp file.and store in backend.
Thanks in Advance
regards,
satheesh kannanHere is a rough example that may give you some ideas:
On the JSP page:
<%if(myData.getFirstName()!=null){%>
Your First Name'
<input type="text" name="firstName" value="<%=myData.getFirstName()%>">
<%}%>
In the servlet:
String firstName= request.getParameter("firstName");
if(firstName!=null){
//write it to the database
} -
JDBC MS Access--- cannot extract entry with null value with data type Meta
I'm trying to extract a data entry with null value by using JDBC. The database is MS Access.
The question is how to extract null entry with data type memo? The following code works when the label has data type Text, but it throws sqlException when the data type is memo.
Any advice will be appreciated! thanks!
Following are the table description and JDBC code:
test table has the following attributes:
Field name Data Type
name Text
label Memo
table contents:
name label
me null
you gates
Code:
String query = "SELECT name, label FROM test where name like 'me' ";
ResultSet rs = stmt.executeQuery(query);
while (rs.next())
String name = rs.getString("name");
rs.getString("val");
String label = rs.getString("label");
System.out.println("\t"+name+"\t"+label);
catch (SQLException ex)
System.out.println(ex.getSQLState());
System.out.println(ex.getErrorCode());
System.out.println("in sqlexception");
output:
C:\Temp\SEFormExtractor>java DBTest
yet SELECT name, label FROM test
null
0
in sqlexceptionThe question is how to extract null entry with data type memo?Okay, what you need to do is this:
if (rs.getString("val") == null)
// do something
}This way, when it's a null value, you can check it first, and then handle it how you want, rather than getting an exception. -
Index (or not) for excluding NULL values in a query
Hello,
I have table that can become very large. The table has a varchar2 column (let's call it TEXT) that can contain NULL values. I want to process only the records that have a value (NOT NULL). Also, the table is continuously expanded with newly inserted records. The inserts should suffer as little performance loss as possible.
My question: should I use an index on the column and if so, what kind of index?
I have done a little test with a function based index (inspired by this Tom Kyte article: http://tkyte.blogspot.com/2006/01/something-about-nothing.html):
create index text_isnull_idx on my_table(text,0);
I notice that if I use the clause WHERE TEXT IS NULL, the index is used. But if I use a clause WHERE TEXT IS NOT NULL (which is the clause I want to use), a full table scan is performed. Is this bad? Can I somehow improve the speed of this selection?
Thanks in advance,
FransI build a test case with very simple table with 2 columns and it shows that FTS is better than index access even when above ratio is <= 0.01 (1%):
DROP TABLE T1;
CREATE TABLE T1
C1 VARCHAR2(100)
,C2 NUMBER
INSERT INTO T1 (SELECT TO_CHAR(OBJECT_ID), ROWNUM FROM USER_OBJECTS);
BEGIN
FOR I IN 1..100 LOOP
INSERT INTO T1 (SELECT NULL, ROWNUM FROM USER_OBJECTS);
END LOOP;
END;
CREATE INDEX T1_IDX ON T1(C1);
ANALYZE TABLE T1 COMPUTE STATISTICS
FOR TABLE
FOR ALL INDEXES
FOR ALL INDEXED COLUMNS
SET AUTOTRACE TRACEONLY
SELECT
C1, C2
FROM T1 WHERE C1 IS NOT NULL;
3864 rows selected.
real: 1344
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=59 Card=3864 Bytes=30912)
1 0 TABLE ACCESS (FULL) OF 'T1' (Cost=59 Card=3864 Bytes=30912)
Statistics
0 recursive calls
0 db block gets
2527 consistent gets
3864 rows processed
BUT
SELECT
--+ FIRST_ROWS
C1, C2
FROM T1 WHERE C1 IS NOT NULL;
3864 rows selected.
real: 1296
Execution Plan
0 SELECT STATEMENT Optimizer=HINT: FIRST_ROWS (Cost=35 Card=3864 Bytes=30912)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'T1' (Cost=35 Card=3864 Bytes=30912)
2 1 INDEX (FULL SCAN) OF 'T1_IDX' (NON-UNIQUE) (Cost=11 Card=3864)
Statistics
0 recursive calls
0 db block gets
5052 consistent gets
3864 rows processed
and just for comparison:
SELECT * FROM T1 WHERE C1 IS NULL;
386501 rows selected.
real: 117878
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=59 Card=386501 Bytes=3092008)
1 0 TABLE ACCESS (FULL) OF 'T1' (Cost=59 Card=386501 Bytes=3092008)
Statistics
0 recursive calls
0 db block gets
193850 consistent gets
386501 rows processedHence you have to benchmark you queries with and w/o index[es] -
Null values passed into the servlet
Hi all,
I keep getting null values for all the params that I pass into the servlet i.e. sqltype, producttype, process, instance etc....I have attempted to print some of them out on the screen but I keep getting the 'NullPointerException' error message...can anyone tell me what it is that I have down wrong in the below code?
If I run the servlet with method calls that have hardcoded arguments in them it works but not when I pass in the params from the URL...I am absolutley puzzled!
Help!
package blotter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.db.util.WriteToLogFile;
import blotter.cache.*;
Servlet to extract an object that has already been placed
in the cache by GetBondPrices servlet from the cache.
public class ExtractSecurityObject extends HttpServlet
String sqlType = "";
String productType = "";
String instance = "";
String process = "";
String asOfDate = "";
String currencyCode = "";
String curveId = "";
String results = "";
private String debug;
private PrintWriter out;
private WriteToLogFile logFile;
// called when servlet first initialised
public void init(ServletConfig config) throws ServletException
super.init(config);
// method called for each get request
public void doGet( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
String toWrite = " ";
// Get the object identifier from the parameters passed in
sqlType = request.getParameter("sqltype");
productType = request.getParameter("producttype").toUpperCase();
instance = request.getParameter("instance");
process = request.getParameter("process");
asOfDate = request.getParameter("asofdate");
curveId = request.getParameter("curveid");
currencyCode = request.getParameter("ccy").toUpperCase();
out.println(currencyCode);
if ( request.getParameter("debug") !=null)
debug = request.getParameter("debug");
else
debug ="";
// set the mime type to html
response.setContentType( "text/html" );
out = response.getWriter();
out.println("<HTML>");
try
// write some parameters to a log file
toWrite = toWrite + "<li>" + getServletInfo() + " at " + new Date() + " " + sqlType + " " +
productType + " " + instance + " " + process + " " + asOfDate + " " + curveId + " " +
currencyCode;
CachedObject o1 = (CachedObject)CacheManager.getCache("EB_" + currencyCode + productType + asOfDate);
if(o1 == null){
CacheSecurityObject cso = new CacheSecurityObject();
if((request.getParameter("sqltype") == null) && (request.getParameter("instance") != null)){
results = (String)cso.putSecurityinCache(null, request.getParameter("producttype"), request.getParameter("instance"), request.getParameter("process"), request.getParameter("asOfDate"), request.getParameter("curveId"), request.getParameter("currencyCode"));
//results = (String)cso.putSecurityinCache(null, "yc", "frafu", "official", "20011105", "baceod", "sek");
out.println(results);
} else {
//results = (String)cso.putSecurityinCache("bondtypes", "bond", null, "official", "20011105", "baceod", "eur");
results = (String)cso.putSecurityinCache(request.getParameter("sqltype"), request.getParameter("producttype"), null, request.getParameter("process"), request.getParameter("asOfDate"), request.getParameter("curveId"), request.getParameter("currencyCode"));
out.println(results);
else{
out.println(((String)o1.object).toString());
// general catch for all exceptions
catch(Exception exception)
out.println( "Exception: The item that you requested was not found in the cache" + "<BR>" );
toWrite = toWrite + "Exception : " + exception.getMessage() + "\n" ;
finally
// write to logfile
logFile = new WriteToLogFile();
logFile.setSourceDirName("blotter");
logFile.setQuery(request.getQueryString());
logFile.setServletPath(request.getServletPath());
if (toWrite!=null)
logFile.writeLog(getServletInfo(),toWrite);
out.println("</HTML>");
out.close();
// need the class name for log file
public String getServletInfo()
return this.getClass().getName();
}That section of the code references a cache to extract an item that has been requested by the user. If the item is not in the cache i.e. if(o1 == null) then it will call a class that generates that object and places that object into the cache. The second time the user makes the same call then they will be handed a cached copy of that object which is aimed to make the whole servlet call faster.
That section of the code works fine coz I have tested that separately. It is the reading in of the arguments that is causing the problem. -
How to validate if a column have NULL value, dont show a row with MDX
Hello,
I have this situation, I have a Result from MDX that return rows with values NULL on columns, I tried with NON EMPTY and NONEMPTY but the result is the same. That I want to do is validate if a column have a Null value discard the row, but I dont know how
to implement it, could somebody help me?, please.
Thanks a lot.
Sukey Nakasima
Sukey NakasimaHello,
I found the answer in this link https://social.technet.microsoft.com/Forums/sqlserver/en-US/f9c02ce3-96b2-4cd6-921f-3679eb22d790/dont-want-to-cross-join-with-null-values-in-mdx?forum=sqlanalysisservices
Thanks a lot.
Sukey Nakasima
Sukey Nakasima -
How to differentiate the EMPTY Records and Null Values in DSO
Hello....how is everyone here?? Ehehehe!
I try to load some data from the flat file which contains some EMPTY data and Null Values for the records. The data type for the InfoObjects of the fields "Quantity" is "number". The sample data from the flat file (CSV) are as below:
Food Quantity
Hamburger - 12
Cheese - 0
Vegetable - (Empty)
When I try to load the above sample data to the DSO, I get the results of the data as follow:
Food Quantity
Hamburger - 12.000
Cheese - 0.000
Vegetable - 0.000
In this case, how can the user differentiate whether the records is contain empty value of null values in DSO? This is kinda of hard to differentiate the both scenarios above. Is there any way to differentiate the scenarios described here?
Thanks alot =)Hi Fluffy,
It depends on the initial values of the data type
The inital values For quantity/Currency/ Numbers it takes spaces as 0
for char it is SPACE
We cannot differeniate between space and null values.
IF you have to force this then define quantity as char and load the data. we will not have units and aggregation in this case.
Hope this helps.
PV
Maybe you are looking for
-
I am at a loss: bcc removal and messages appearing on other POP3 accounts!
Greetings! 2 problems with Mail (version 4.2 1077 - Mac OS Snow Leopard 10.6.2) 1. For the life of me, I do recall at some point recently making my mail bcc to myself (I just wanted to make sure of what some attachments looked like to their destinati
-
HT204365 Unable to open PDF document saved on ibooks.
Saved a downloaded pdf document on iBooks, and now I am unable to open it. The original is NLA so redownloading is not an option. Any way to recover the document? Any recommendations are welcome.
-
Thumbnail View in DPS Folio Producer: Editor
Hi, When will the thumbnail view for PDF folios become available in the DPS Folio Producer: Editor? This feature is waiting since a very long time to be implemented. Or switch at least the behavior so the list view opens by default. Or remove the thu
-
How to install the metadata cache invalidation tool
Hi, I have a problem in using JCO destinations for Adaptive RFC models. I went through the below pdf and they mentioned metadata cahce invalidation tool and it is not installed in the portal https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/lib
-
hi all, when the database writer writes to the datafiles which process reads the data? thanks.