Sunetra Sen

Ranch Hand
+ Follow
since Feb 17, 2005
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 Sunetra Sen

Thanks a lot Alan!!
It works now.
However I am not sure what difference the four back slashes make?
Can you please explain?
Thanks in advance,
Sunetra.
16 years ago
Thanks guys for sharing the info!
16 years ago
Hi,
I have to write a csv file for which the delimiter is to be picked up from a config file.
Now I am facing a problem if the delimiter is a special character like \t.
As the config file is read and values returned as Strings so the \t is getting printed as such without getting converted to a tab spacing.
Please let me know if any of you have an idea on how to tackle this situation. :roll:

Thanks,
Sunetra.
16 years ago
You should not need to unjar the cos.jar in the lib/classes folder.
But if the cos.jar has the class then I am not sure what the problem is?
Try putting the cos.jar in the tomcat's common/lib folder and see. :roll:
16 years ago
Hi,
Suppose I have a hashmap which holds 5 keys of type Integer and corresponding 5 Strings.
So in total I have 5+5+1=11 objects on the heap.
Now I clone one of the String objects in the HashMap.After that I set the HashMap to null.
At this point of time how many objects are elligilble for garbage collection?(assume that the other String/Integer objects are not referenced by any other code)

Please let me know?
Thanks in advance,
Sunetra.
16 years ago
coz i want to prevent the user from typing any fictitious file name!
Hi,
In my html form I have a input type=file.
I want the user to browse and search for a file but want to prevent him from manually entering a file name.
How is this possible?

Thanks and regards,
Sunetra.
Got it!
Should have seen the tutorial first

Thanks a lot!!
16 years ago
Hi,
I have a UI in which I have a input type=file to upload a file containing some words.I also have a text area in the same UI where the user can enter certain words.
Now in the servlet to which the request from this UI submits to, I want both the file contents and the text entered by the user in the text area.
I have defined my form as:
<FORM NAME="myForm" ENCTYPE="multipart/form-data" METHOD='POST'/>

But in the servlet the contents of the textarea comes as null.As My UI is rendered by using XSLT I cannot set the text entered by the user in session.

Please let me know how I can access the textarea contents?
I am using jakarta's file upload utility for uploading the files.

Thanks,
Sunetra.
16 years ago

Originally posted by HARI KRSNA:
SUBJECT: java.lang.NoClassDefFoundError

I am using Tomcat 4.1.31 on SuSE Linux 8.1 and Java 1.4

I have my application as following:

/local/tomcat/webapps/hari
/local/tomcat/webapps/hari/index.html
/local/tomcat/webapps/hari/WEB-INF/classes/util/BatchUpload1.class
/local/tomcat/webapps/hari/WEB-INF/classes/util/*.class
/local/tomcat/webapps/hari/WEB-INF/lib/cos.jar (this is Oreilly's predefined classes)
/local/tomcat/webapps/hari/WEB-INF/web.xml

I access my WEB application as http://us.hari.com/uhin/BatchUpload and get following error wonder why:
--------------------------------------------------------------------------------
description: The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error instantiating servlet class util.BatchUpload1
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:621)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

at java.lang.Thread.run(Thread.java:534)

root cause

java.lang.NoClassDefFoundError: com/oreilly/servlet/multipart/FileRenamePolicy

at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
at java.lang.Class.getConstructor0(Class.java:1930)
at java.lang.Class.newInstance0(Class.java:278)
at java.lang.Class.newInstance(Class.java:261)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:856)

-----------------------------------------------------------------------------------

I am using Oreilly's predefined classes which are stored in "cos.jar" file and under WEB-INF/lib/ directory... I have also added this to the CLASSPATH...


When I un-jar my cos.jar file I get follwing files...
com/oreilly/servlet/*.classes


Any pointer on this would be appreciated...

THANKS!

HARI OM




If you have added the jar to the applications WEB-INF/lib folder then there is no need to put it in the class path seperately.Every jar in the application's lib folder should be available for the servlet when running in the tomcat's servlet container.
16 years ago
untar the cos.jar and check if the said file is present there.
I can see the file present in the correct folder structure in the cos.jar that I am using.
16 years ago
Hi,
I want to read data from the database and write it as a csv file which can then be downloaded by the user.
Is there any API available to write a csv file?

Please let me know.
Thanks,
Sunetra.
16 years ago
Hi,

I have deployed a web application in Weblogic. When i am trying to access the
first page, i am getting the following exception:--

java.lang.IllegalStateException: Attempt to change ContentType after calling
getWriter() (cannot change charset from 'ISO-8859-1' to 'UTF-8')
at
weblogic.servlet.internal.ServletResponseImpl.setEncoding(ServletResponseImpl.java:873)
at
weblogic.servlet.internal.ServletResponseImpl.setHeaderInternal(ServletResponseImpl.java:699)
at
weblogic.servlet.internal.ServletResponseImpl.setHeader(ServletResponseImpl.java:664)
at
weblogic.servlet.internal.ServletResponseImpl.setContentType(ServletResponseImpl.java:272)
at
javax.servlet.ServletResponseWrapper.setContentType(ServletResponseWrapper.java:164)
at
org.apache.struts.action.RequestProcessor.processContent(RequestProcessor.java:508)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:233)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.aol.sns.Filters.SNSFilter.doFilter(SNSFilter.java:267)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724)

at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
---------------------------------------------

The application was running successfully on Apache+Tomcat but because of a
requirement change i had to deploy the same on Apache+Weblogic using the
standard connector.

I am using Apache 2.0.52 and Weblogic 8.1 (SP4) Server and mod_wl_20.so as
connector.

Please help me out as i am very new to Weblogic. :roll:

Thanks and regards,
Sunetra
16 years ago
Yeah the java API doesn't give any validation for csv files.
For Netscape/Firefox/IE the file content type for a csv file comes as application/octet-stream.
I am validating that the file uploaded by the user has this type and extension csv.
However as you might have guessed that if I intentinally save a bitmap file with a csv extention then also this validation succeeds.
So this is a *poor* way to validate csv files.
Any ideas on how this validation can be done in a better way?

thanks and regards,
Sunetra.
16 years ago
Hi,
I am supposed to upload a file which should be of type csv.
Now after I upload the file from my jsp I am using the jakrta file upload utility to write it to some specified folder.
But the functionality requuires me to verify that the file is truly a csv file before I write it to the specified directory.
Can anyone suggest how I can validate the type of a uploaded file to be csv?

Thanks in advance,
Sunetra.
16 years ago