suresh sai

Ranch Hand
+ Follow
since Jul 16, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by suresh sai

Hi all.,

I have a small ( or big) problem with BigDecimal. While dividing ,especilly with double values ,it`s giving the values that is rounded. Let us suppose, I have the following code.

BigDecimal amount = new BigDecimal(0.1);
BigDecimal size = new BigDecimal(1);

If I divide amount by size its giving 0.12 rather 0.1. Please help me How can I get rid of this..?

Thanks in Advace
15 years ago
Hi Raf.,
Thanks for the reply.Could you please tell me what is the suitable service provider for the above code.There are lot of service providers like RMI, LDAP,CORBA etc.I have already configured RMIRegistry.jar.Is this enough?
....?
Hi Raf.,

Thanks for the reply.Could you please tell me which service provider Do I need to use? There are lot of service providers ..RMI,CORBA,LDAP etc.Which one is suitable to the above code .I have already configured RMIRegistry.jar. Is this not enough?
Hi all .,

I am trying to execute a simple JNDI example. The code is as shown below.

try{
Context initialContext=new InitialContext();
initialContext.bind("name", "Suresh Sai");
Object stringObject= initialContext.lookup("name");
System.err.println("the string object..... "+stringObject.toString());
}
catch (NamingException ne)
{
System.err.println("naming exception was thrown... "+ne.getMessage());
}


Its compiling,But while running its throwing NamingException ..,

Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

Is there any wrong with the code? My main aim is , to creat a name for an object and to access that object through that name.

Please halp me.And also suggest me some good books and resources for JNDI.

Thanks in Advance
Hi All.,

I have written a simple JNDI program in IBM RAD.While running its showing
"Cannot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory " Exception. After that I have downloaded and included fscontext.jar in the libraries. But it`s showing another exception...

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jndi/toolkit/chars/CharacterEncoder

Here I am giving complete code.

package mypackage;

import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class NamingExample {

public static void main(String []l){
Hashtable environment=new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
try{
Context intialContext=new InitialContext(environment);
String name="D:\\sureshsai";
Object object=intialContext.lookup(name);
System.err.println("the name ... "+name+" is bound to "+object);
}catch (NamingException ne) {
System.err.println("naming exception was thrown... "+ne.getMessage());
}

}
}

Please help me to make the code runnable.
hi Jeanne .,
Thanks for your immediate response.Now I have resolved the problem.But I did nothing.Last day, I shutdown my system after getting the error and today I have executed again. Now it is working fine. But I am again telling ,I didn`t do any thing. If it is possible ,could you please trace the problem where went wrong.

Thank u
16 years ago
JSP
hi all.,

I am getting the following excpetion while loading my jsp page.

An exception has occurred in the compiler (1.4.2). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.

java.lang.ClassFormatError: com/sun/tools/javac/v8/comp/Gen (Illegal constant pool index)at java.lang.ClassLoader.defineClass0(Native Method)

I have tried very much to find the cause of exception. But I can`t.
Please tell me the solution for this exception.
I hope my JSP doesn`t contain any errors.

Thanks in Advance
16 years ago
JSP
Dear All.,
I am trying to execute a simple MESSAGE DRIVEN BEAN from a simple java application in RAD 7.0 tool with Application Server 6.0. But, While executing the application I am getting the following exception.

WARNING: jndiGetObjInstNoop
java.lang.ClassCastException: javax.naming.Reference incompatible with javax.jms.QueueConnectionFactory
Hi all.,

I have a hidden property in my JSP. This is the string array property in the action form of the struts.Before loading this JSP I am initializing this property. I am calling one java script function on page load.But in this java script the length of this property is coming as 1.It was resetted to 1. I am sure I am not reinitialinzing the string array to 1 after initializing it in the action class.After submitting the JSP also I am getting the length as 1.

Is there any way to regain the length of the string array property as how I am initializing in the action class..?

Thanks
Hi all
could please you tell me what is the best book for java script that would tell each and everything about javascript like difference between document.getElementByID('styleID') and document.forms[formName]['styleID'].
Thanks in advance
wowwwwww merill its working........thank you
16 years ago
Hi all.,
I have a multibox in my JSP and I am displaying it through display tag.I have corresponding String array property in my form.But the deselection of the checkboxes is not refelcting once the form is submitted...that means I have selected 2 of 5 checkboxes and submitted.And again I went to the same page deselected and submitted.But this time,the string array is not changing.Once the selection is made ,the deselection is not working.For this I have written javascript code. I am calling javascript function upon each selection and deselction of the checkbox.In that function if it is selected..I am putting the value as rownumber+1 ,if deselected I am putting an Empty string.After setting ,I have displayed the values through alerts.They are showing the correct values.But in the reset(),validate() methods old values are coming..means, once the selection is made that particular index is updated,but its not updating afterwards.
Here I am showing the code for java script...

function setCheckBoxes(rowNum,formName)
{
mBox= document[formName]['mycheckbox'];
var checked=false;
if(mBox)
{
if(typeof mBox.length != 'undefined')
{
if(!mBox[rowNum].checked)
{
alert('you are not selected....');
document.getElementById("selectCheckBox["+rowNum+"]").value="";
alert("document.getElementById(selectCheckBox ["+rowNum+"]).value==="+document.getElementById("selectCheckBox ["+rowNum+"]").value);
}
else
{
document.getElementById("selectCheckBox ["+rowNum+"]").value=rowNum+1;
alert("document.getElementById(selectCheckBox["+rowNum+"]).value==="+document.getElementById("selectCheckBox["+rowNum+"]").value);
}

}
else
{
alert('mbox length is one.....');
if(!document.forms[formName]['mycheckbox'].checked)
{
selectCheckBox="";
alert('you are not selected....');
alert('the value...is'+selectCheckBox);
}
}


}
}

and in the JSP...

html:multibox property="selectCheckBox[${rowNo}]" value="${rowNo+1}"
title="click the check box to select" styleId="mycheckbox" on_click="setClientAccounts(${rowNo},'myForm')"

bean:write name="checklist_rowNum" /

/html:multibox
I have removed the angular brackets...I hope you can understand...
Please tellme the soluiton for reflecting the checkbox values....
16 years ago
Hi All.,
Could you please tell me how can we nullify an object in the javascript.
I need to nullify the value of a particular index of a string array.

Thanks in advance..
hi.,
Thank you for your solutions and suggestions.I have broken my confusion.
Once again thanks to darshan....
hi.,
I have a small confusion in the execution of the methods in the java script. I have two functions with same name but different functionalities.one is in my JSP page and another one is in common.js file,which contains all java script functions.I am including this common.js in my jsp.I am calling my jsp function on page load.But the function which is in the common.js calling.I have included this file after my javasript function..as follows...
<script type="text/javascript">
function setThePageDetails(mode,formName){
}
</script>
<script language="JavaScript" type="text/javascript" src="common.js"> </script>
could you please tell me the order of execution of the functions....
Thanks in advance...
[ July 02, 2008: Message edited by: Bear Bibeault ]