Nika Gudge
asked on
How do i set a boolean transient variable
im using a transient variable as below:
private transient boolean vaultallowedccterm=false;
im setting it in my java code as below:
if(terminalDto.isCCTermina l()){
terminalDto.vaultallowedcc term(true) ; <<<<---- is this right way to set a transient boolean variable?????
}
im using it my JSP code to test a condition as below :
<c:if test="${terminal.vaultallo wedccterm= ='true'}"> </c:if>
private transient boolean vaultallowedccterm=false;
im setting it in my java code as below:
if(terminalDto.isCCTermina
terminalDto.vaultallowedcc
}
im using it my JSP code to test a condition as below :
<c:if test="${terminal.vaultallo
Without seeing the code of terminalDto, we have to guess. Maybe use
terminalDto.setVaultallowe dccterm(tr ue);
terminalDto.setVaultallowe
My code will of course only work where the private scope is not a problem. Otherwise, it should have a normal mutator (which should be used) and accessor
ASKER
TerminalDTO is just a data transfer object. I has variables declared and respective getters and setters for it.
public class TerminalDTO{
private transient boolean vaultallowedccterm = false;
//how to declare the getter setter for the above property ????
}
im not able how to figure out how to get the value of it in EL?
${terminal.vaultallowedcct erm == 'true'}
public class TerminalDTO{
private transient boolean vaultallowedccterm = false;
//how to declare the getter setter for the above property ????
}
im not able how to figure out how to get the value of it in EL?
${terminal.vaultallowedcct
how to declare the getter setter for the above property ????
Same as any other bean property
public boolean getVaultallowedccterm() {
return this.vaultallowedccterm;
}
public void setVaultallowedccterm(boolean vaultallowedccterm) {
this.vaultallowedccterm = vaultallowedccterm;
}
but you'd do better to ensure that your variable names are in camel case (beginning lower case)
>im not able how to figure out how to get the value of it in EL?
>${terminal.vaultallowedcc term == 'true'}
Please try using
<c:if test="${terminal.vaultallo wedccterm} ">
>${terminal.vaultallowedcc
Please try using
<c:if test="${terminal.vaultallo
The variable can be accessed the same as any other variable you declare and is restricted by normal scoping rules. Hence, a private variable is only accessible internally to the class that declares it while a public one (BAD idea) is accessible to anyone. The 'transient' keyword indicates to Java that the variable should not be serialized when using Java's built-in Serialization mechanisms.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<<<<---- is this right way to set a transient boolean variable?????
Not sure how the accepted answer applies to that question ..?
No. It would be
Open in new window