Mary Joe

Greenhorn
+ Follow
since Jun 17, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mary Joe


Can some one please explain the meaning <xs:restriction base="xs:decimal"> ...</xs:restriction> in the pasted xsd snippet

I want to create a new element of jaxb javatype java.math.Bigdecimal

How will I determine xs:totalDigits value="?"/>
<xs:fractionDigits value="?"/>
<xs:minInclusive value="?"/>

The data that comes in the xml format get persisted to a database table column of type NUMBER(13,2)

<xs:element name="salaryamount">
<xs:annotation>
<xs:appinfo>
<jaxb:property name="SalaryAmount"/>
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:appinfo>
<jaxb:javaType name="java.lang.Double" parseMethod="valueOf" printMethod="toString"/>
</xs:appinfo>
</xs:annotation>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="10"/>
<xs:fractionDigits value="2"/>
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Thank you that was helpful
11 years ago
Hi,

I have two methods which are being called form UI to display 2 different values.

These two methods have the same code apart form one additional condition in one of them.

Is there any efficient way of refactoring them to avoid the duplication ?

First Method
---------------

private Double getTotalSum(List amounts) {
double totalToPay = 0.00;

Iterator amountsIterator = amounts.iterator();
while (amountsIterator.hasNext()) {
Amount amount = (Amount) amountsIterator.next();
if (!cancelstatuses.contains(amount.getStatus())) {
totalToPay += amount.doubleValue();
}
}
return new Double(totalToPay);
}

Second Method
=----------------


private Double getTotalSumExcludeCancelAmount(List amounts) {
double totalToPay = 0.00;

Iterator amountsIterator = amounts.iterator();
while (amountsIterator.hasNext()) {
Amount amount = (Amount) amountsIterator.next();
if (!amount.getIsToCancel()) { // Additional condition comparing to the first method.
if (!cancelstatuses.contains(amount.getStatus())) {
totalToPay += amount.doubleValue();
}
}
}
return new Double(totalToPay);
}

Thanks
M
11 years ago
Following is the pattern specified for a simpletype in an xsd with, what does it mean?
Any one know of a good site where you can learn how to decipher patterns?

<xs:pattern value="[A-Z]{1}[0-9]{1,2}" />
13 years ago
Thanks Joshua that helped a lot.

All issues resolved
13 years ago
I have overcome the issue firt mentioned in my post using BigDecimal.

Now I have a different one.


Bigdecimal one = 2948.0
Bigdecimal one = 2948 (this is being returned from a jdbc query of Double value new BigDecimal(resultRow.getFee().toString());)
Again failing on comparison, anway to impose the decimal ?
13 years ago
What I didn't understand though was the same logic was used to calculate the header total as well, which didn't present with the same issue.

total += row.getFee().doubleValue();
13 years ago
Thanks what I was trying to do was importing a file.

The header had a total which was giving the value 2098700.03
which will be compared against the total of the relevant filed(of Numeric(5,2)) which is a double in the body
which can be from upto a total of 50000 rows.
This total also represented as a double was returning as 2098700.0300000003 and hence it was throwing an error beacuse the values didn't match.
I will try using BigDecimal

Any example you have on addition on BigDecimal
13 years ago

Printing out as
d1 + d2 : 2098700.0300000003
while I expect 2098700.03, can anyone explain the reason?
13 years ago
Hi,

I am using JSF1.1, I have got the following components a radio slection group and an input Text in my page,
The radio has the following 6 options,

Divorced
Living with partner
Married
Separated
Single
Widowed


if only Married option is selected then Only the inputText should be enabled, for all other options it should be disabled, that part is working fine.

If Married is selected and an invalid date is entered in the inputText, it raises validation error,
if the user then selects another option it disables the text field with the data entered but the validation error still arise,
I want to clear out the InpuText field when any other option other than Married is selected, so that the validation error doesn't arise.
I am trying to use javascript to identify which option is checked, the issue is individual radio options doesn't seem to generate any Id
for me to identify which one is checked. Can you please identify the reason. Any help would be much appreciated.
<h:selectOneRadio
id="maritalStatus"
value="#{DetailsPage.maritalStatus}"
valueChangeListener="#{DetailsPage.formatOptionChangeListener}"
style="autowidth"
immediate="true"
required="'false'"
layout="pageDirection"
onclick="submit()"
validationLabel="#{pageMsg.maritalStatusLabel}"
disabled="#{DetailsPage.readOnly}">
<f:selectItems id="statusId" value="#{lea:getEnumSelectItems('my.data.enum.MaritalStatusEnum', 'enum', 'false')}" />
<lea:enumConverter enumClass="my.data.enum.MaritalStatusEnum" />
</h:selectOneRadio>

<td colspan="2">
<label for="marriageDate">#{pageMsg.dateOfMarriageLabel}</label> </td>
<td class="#{DetailsPage.formInputClass}">
<h:inputText value="#{DetailsPage.marriageDate}"
id="marriageDateId"
maxlength="10"
size="12"
disabled="#{DetailsPage.dateReadOnly}">
<lea:dateConverter pattern="dd/MM/yyyy" invalidDateMessage="#{pageMsg.invalidMarriage}" />
</h:inputText>
</td>
13 years ago
JSF
Hi,
I am using JSF 1.1, I need to enable and disable <h:commandbutton /> using Javascript, can anyone provide an example.

Thanks nad Regards
MJoe
13 years ago
JSF
Hi

I am new to JSF using JSF 1.1

what does the getAsObject vs getAsString do in a converter.

I would like to write a converter for a h:selectOneMenu,
where the list is driven by an Enum (String valued), and the value to be persisted is a String not an Enum

How to write a converter for this ?
13 years ago
JSF
This following resolved my issue


<t:inputTextarea value="#{testBean.testString}"
onkeyup="limitTextArea(this,100);"
onkeydown="limitTextArea(this,100);"
cols="30"
rows="2" />

<script>
function limitTextArea(element, limit) {

if (element.value.length > limit) {
element.value = element.value.substring(0, limit);
}

}

</script>

13 years ago
JSF
Hi,

I have got an <h:inputTextarea
id="looking" cols="30" rows= "2"
value="#{LookingPage.lookingDetails}"
required="false"
onkeyup="this.value = this.value.substring(0, 100);" >
</h:inputTextarea>

I want to try and limit the number of characters entered, this is working fine with the onkeyup="this.value = this.value.substring(0, 100);" , the issue is if I try to edit any character it jumps to after the last existing character...any idea as to how to resolve this?

Thanks
13 years ago
JSF
I have got <h:inputText field,
I need to raise a validation message if the value entered is not Numeric and and the length should be exactly 6,
how best to do this?
13 years ago
JSF