venkatesh pendharkar

Ranch Hand
+ Follow
since Apr 29, 2006
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 venkatesh pendharkar

Thanks, this was helpful
10 years ago
I am just trying to do System.out.println(1024.235*100); & it prints 109123.49999999999 but if I do System.out.println(1023.235*100); then it prints 102323.5.
So can any one please explain why this is happening? I understand it is something with 1024 which is 2^10 but not sure why this is happening.

Thanks
10 years ago
Hi all,
I am trying to call a webservice using restTemplate.getForObject method. Following is the response that I am getting by this webservice:-
<orders>
<order>
<confirmationId>50001</confirmationId>
........
......
</order>
<order>
<confirmationId>52000</confirmationId>
......
.....
</order>
</orders>

I need to use addImplicitCollection method of xstream but i do not know how to use this in spring configuration. Following is my configuraion:-
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<constructor-arg ref="httpClientFactory"/>
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">

<constructor-arg>
<bean class="org.springframework.oxm.xstream.XStreamMarshaller">

<property name="aliases">
<props>
<prop key="orders">com.entertainment.epintegration.webservice.model.CPCFulfillmentModel</prop>
<prop key="order">com.entertainment.epintegration.webservice.model.CPCOrderFulfillmentModel</prop>
</props>
</property>
</bean>
</constructor-arg>
</bean>
</list>
</property>
</bean>

Can any one please help me to understand how to use addImplicitCollection in above configuration?


Thanks
Venkatesh Pendharkar
13 years ago
I am using 2 <form:select> tags on my jsp page, one for list of countries & other for list of states in that country. What I am doing is, once a country is selected, then through dwr I am calling my controller & getting back list of state objects. Each state object is populated with name & code of state. Now I want to add the state list names & code to the <form:select> related to state. I could not find any way to add this dynamically. Can anyone give me any suggestions or hints?

I have tried to use dwr API as follows:-
for(var i =0; i<data.length;i++){
dwr.util.addOptions(selectbox, [data[i].name]);
}
But this will add ><option> tag & not <form:option> tag.
13 years ago
HI all,
I want to do address validation in my website & while doing that I was doing analysis about USPS web tools. I found that the web service provided by USPS is useful only for address validation & not for address correction i.e. it will just add zip+4 code to address if address provided is correct but it will not make any correction if there are any spelling mistakes or abbreviations used.
There is another service called USPS AEC(Address element correction) which can do address correction but it is an offline service & hence not useful to me.
So can anyone tell me if there is any product provided by USPS which can be used for address correction? Please let me know just the product name so I can do research on that. Thanks in advance.
14 years ago
HI all,
I am using apche axis on Jboss 4.1. I have created a jws file called Calculator.jws in which i have writted a simple method as follows:
public Integer testing(Integer s) {
return s;
}

When I call this method using my client as follows:-
public class CalcClient {
public static void main(String[] args) throws Exception{
String endPoint = "http://localhost:8081/axis/Calculator.jws";
Integer i1 = new Integer(1);
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endPoint));
call.setOperationName("testing");
call.addParameter("op1",XMLType.XSD_INTEGER, ParameterMode.IN);
call.setReturnType( XMLType.XSD_INTEGER );
Integer ret = (Integer) call.invoke( new Object [] {i1});
System.out.println("Got result : " + ret);
}
}

when i run this code, i get following exception:-


- Exception:
org.xml.sax.SAXException: Bad types (int -> class java.math.BigInteger)
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:286)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at CalcClient.main(CalcClient.java:32)
Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Bad types (int -> class java.math.BigInteger)
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Bad types (int -> class java.math.BigInteger)
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:286)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at CalcClient.main(CalcClient.java:32)

{http://xml.apache.org/axis/}hostname:redDevil

org.xml.sax.SAXException: Bad types (int -> class java.math.BigInteger)
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.client.Call.invoke(Call.java:2470)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at CalcClient.main(CalcClient.java:32)
Caused by: org.xml.sax.SAXException: Bad types (int -> class java.math.BigInteger)
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:286)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
... 3 more

Can anyone help me in this???
14 years ago
Hi all,
I am developing currently an online shopping website. On this website, on some of the pages I want to disable the browser back button . If not disable, then at least I want show an alert on back button. I made a lot of search on google, but everywhere I found that it is not possible to disable back button or know the back button alert. Can anyone help me out with any suggetions?
Also I tried to clear the history for the pages for which I want to disable the back button. But my code works in IE & not in other browsers. So it will be great if someone can give me a code that will not save the current page in the history for all the browsers?
Thanks in advance.
Hi Ben Thanks for the reply,
I understood that it is not possible for me to send cookie from one domain to another domain.
So is there any way by which i can send some hidden values through window.open() function. Because i can not use cookies & i cant even attach the value that i want to send to the link using '?'. eg http://test:7010/login_validate.jsp?uid<>134994903 although im encrypting this value, if someone els copies this then he will be able to login to our system.
So i want to send the userId as hidden or secured field. can anyone suggest anything....
Hi all,
I am writing 1 jsp page in which there is a login button. When clicked on that it calls javascript method window.open("http://test:7010/login_validate.jsp") & opens login_validate.jsp page which is in a differnet context & different app server.
Now while before opening this link i want attach some cookie so that on login_validate.jsp I can validate the cookie & check if the user is valid or not. FOr attaching cookie I am using this function
setCookie("CSRWebsiteLoginCookie", '<%=sEncryptedUserId%>', expires, path);
& the funtions is


here when i run the code i see that cookie is created on the machine(cookies folder) from which login button was clicked, but on the machine where login_validate.jsp is saved , cookie is not received. That means although cookies is getting created it is not getting sent with link.
Can anyone tell me why this is happening & how to solve it??

[BSouther: Added UBB CODE tags]
[ September 21, 2007: Message edited by: Ben Souther ]
Hi all thanks a lot for the reply,
I understod what was the mistake I was doing. My context was shoppingCart folder in webapps, but in the logs it was showing as
ContextConfig[/phoneDir]: Missing application web.xml, using defaults only
that means it wasnt gettting web.xml file from phoneDir folder. When I chcked there was a folder phoneDir in which this file was missing.I think at the stratup tomcat checks for web.xml file for all the differnet contexts (or folders in webapps ).
Actually im creating an application in which I have written one servlet class but im not able to initialize class.Thats why I checked the logs. But anyways my web.xml is being read but still my issue isnt solved.
So my current problem is i have web.xml file:-
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<!-- Sample configuration file for using PhotoDB with the Tomcat JSP
container. Tomcat is available from http://jakarta.apache.org. -->

<web-app>

<display-name>PhotoDB</display-name>

<description>
Application to view and maintain a database of photographs.
</description>

<!-- Filter to support file upload. See "Filter code with Servlet 2.3 model"
http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters_p.html. -->
<filter>
<filter-name>MultipartFilter</filter-name>
<filter-class>com.oreilly.servlet.MultipartFilter</filter-class>
</filter>

<!-- Filter mappings. -->
<filter-mapping>
<filter-name>MultipartFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- PhotoServlet is used to initialize access to the database and to
keep track of shared initialization parameters. -->
<servlet>

<!-- Name of servlet. -->
<servlet-name>PhotoServlet</servlet-name>

<!-- Class that implements servlet. -->
<servlet-class>com.magiccookie.photodb.PhotoServlet</servlet-class>

<!-- JDBC driver class (required). Change this to your database's JDBC
driver. Examples are shown for PostgreSQL and MySQL using different
JDBC drivers. -->

<init-param>
<param-name>db.driver</param-name>

<!-- postgresql -->
<!-- <param-value>postgresql.Driver</param-value> -->

<!-- mysql (mm driver) -->
<param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>

</init-param>

<!-- JDBC URL (required). Value depends on the JDBC driver. Examples
are shown for PostgreSQL and MySQL using different JDBC drivers. -->
<init-param>

<param-name>db.url</param-name>

<!-- postgresql -->
<!-- <param-value>jdbc:postgresql:photodb</param-value> -->

<!-- mysql (mm driver) -->
<param-value>jdbc:odbc:photodb</param-value>

</init-param>

<!-- Account name with which to connect to database. -->
<init-param>
<param-name>db.user</param-name>
<param-value></param-value>
</init-param>

<!-- Password with which to connect to database.-->
<init-param>
<param-name>db.password</param-name>
<param-value></param-value>
</init-param>

<!-- Base URL for PhotoDB. Default is "/photodb". -->
<!--
<init-param>
<param-name>context.path</param-name>
<param-value>/photodb</param-value>
</init-param>
-->

<!-- Base URL to access image files. Default is the value of the
context.path parameter followed by "/photos". -->
<!--
<init-param>
<param-name>image.path</param-name>
<param-value>/photodb/photos</param-value>
</init-param>
-->

<!-- Directory containing image files. The servlet needs to be
able to access the image files so that it can load their width and
height. This directory must exist, otherwise PhotoServlet will
not startup. The default is to call the servlet's getRealPath
method on the string "/photos". -->
<!--
<init-param>
<param-name>image.directory</param-name>
<param-value>/photodb/photos</param-value>
</init-param>
-->

<!-- Password with which to login to PhotoDB. -->
<init-param>
<param-name>login.password</param-name>
<param-value>password</param-value>
</init-param>

<!-- Comma-delimited list of servers on which login is allowed.
If the list is empty then login on any server is allowed.
This is a crude way to limit write-access via the PhotoDB
application. Basically, I enter data into the database on my home
machine, then I upload the data to my webhost's server. I never
modify the database on my webhost's machine, so this is a one-way
data path. -->
<init-param>
<param-name>login.servers</param-name>
<param-value></param-value>
</init-param>
<!-- The servlet is loaded on startup so that it can setup the
database connection. -->
<load-on-startup>-1</load-on-startup>

</servlet>
</web-app>
So i hvae this servlet PhotoServlet in which i hvae written code for init & destroy method. In init method I have written the code for initialization of diff parameters. I think as far as I know my this servlet shud get initialized at the startup. But I have written some System.out.println() statements in init method but they arent getting displayed in console.
Also when I run my jsp through which I am calling this servlet, I find it is not initialized.
Can anyone help me out?? I hope im not making any silly mistake.
16 years ago
yes, it is in WEB-INF direcotry
16 years ago
When I am starting my tomcat server in the logs i am getting this thing:-
ContextConfig[/phoneDir]: Missing application web.xml, using defaults only
And beacause of this I am getting servletConfig object as null & I cant get the values defined in web.xml file.
In server.xml file I have done the following configuration
<ContextManager>
<Context path="/shoppingCart" docBase="C:\tomcat\webapps\shoppingCart" debug="9"/>
</ContextManager>

I am able to open the link in shoppingCart folder.Do i need to make any other configuration??
16 years ago
yes this is a fresh install, & from the beginning itself i started getting error. I have following jar files in my lib folder:-
commons-el.jar
jasper-compiler.jar
jasper-compiler-jdt.jar
jasper-runtime.jar
jsp-api.jar
naming-factory.jar
naming-factory-dbcp.jar
naming-resources.jar
servlet-api.jar

I first thought servlet.jar file might be missing thats why added it in lib folder but still its giving me the same error
16 years ago
HI all,
I am using Tomcat 5.5.23 & jre 1.5.0. I am able to start the tomcat server properly & am also able to access the tomcat home page using http://localhost:8080 . But when I execute any of the JSP examples which are given on homepage it gives the following error,:-

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: javax.servlet.jsp.PageContext.getVariableResolver()Ljavax/servlet/jsp/el/VariableResolver;
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.jsp2.el.basic_002darithmetic_jsp._jspService(basic_002darithmetic_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:809)


root cause

java.lang.NoSuchMethodError: javax.servlet.jsp.PageContext.getVariableResolver()Ljavax/servlet/jsp/el/VariableResolver;
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:929)
org.apache.jsp.jsp2.el.basic_002darithmetic_jsp._jspService(basic_002darithmetic_jsp.java:44)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:809)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.

someone please help me in this
16 years ago
HI all,
I am creating a Java application in which i want to open a popup which displays some message.Currentl i am using JOptionPane.showMessageDialog(this,"msg"); method which shows dialog with OK button. But I dont understand how to fire an event in the OK button of this window. Is there any method by which i will be able to execure some code when OK button is clicked. I tried using windowClose event but it doesnt work .
Someone please help me in this.
16 years ago