Subha Rangu

Greenhorn
+ Follow
since Jul 23, 2004
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 Subha Rangu

Thanks for the reply...
19 years ago
Hi,
I have a question in JSP. I am trying to send the byte[] to outputstream and show it on the browser.
Following is my code:
**************************************************************

resp.setContentType("application/pdf");
ServletOutputStream outstream=resp.getOutputStream();
outstream.write(barray);
outstream.flush();
outstream.close();

***************************************************************

I was neither getting an Exception nor displaying the pdf document on the browser. I had printed the size of the byte[] just before giving it to the output stream and it is not null.

Please help me with me..What could be the reason?
Thanks in advance,
Subha
19 years ago
Hi,
My application is search engine. If it finds only one result it should display that particular document directly otherwise it should list out all the document names and few parameters in a table. And when the user clicks on one of the records,it should display that document.

I have written a Java Servlet which gets the document and displays it on the browser.

Code fragment:
1.jsp:

<% if (noofhits == 1) %>
<jsp:forward page="/dispImageServlet"></jsp:forward>

<% else if(noofhits>1) %>
<table>
<a href="/dispImageServlet?getDoc=<%=b%>" target="_blank">
<tr>
<%for (int c = 0; c < colSize; c++) {%>
<td><%out.print(strResult[c]);%></td>
<%}%>
</tr>

</table>

Now my question is:
When I run with having noofhits>1, it is going to "page cannot be found" error page and at the console I get the following message:

9/28/04 13:20:44:402 EDT] 5180cf8c OSEListenerDi E PLGN0021E: Servlet Request Processor Exception: Virtual Host/WebGroup Not Found : The web group /dispImageServlet has not been defined


< jsp:forward> works fine where as <a href> doesn't. It says "broken link"

But both of them are in the same file one in if and the other in else. I didn't find the reason why it is not finding the path.
I am using WSAD.
Please help me out.
Thanks
19 years ago
Hi,
I need a suggestion here.
In a JSP page, I call a method of a Javaclass and get a file dynamically. That file could be any format like, pdf,tif,afp,gif,jpeg etc. I need to show that on the browser.

I tried using <IMG> tag and <EMBED> tag but both of them don't support all the file types.

I was told by someone that I can use JavaScript window.open(file). But I have never done Javascripting so not sure if that could be achieved for dynamic programming.

I have file name as a string.

Please suggest me the best way to show it on the browser and also, that should be having a form which contains a close button as well.

Thanks in advance,
19 years ago
JSP
Hi,
I need a suggestion here.
In a JSP page, I call a method of a Javaclass and get a file dynamically. That file could be any format like, pdf,tif,afp,gif,jpeg etc. I need to show that on the browser.

I tried using <IMG> tag and <EMBED> tag but both of them don't support all the file types.

I was told by someone that I can use JavaScript window.open(file). But I have never done Javascripting so not sure if that could be achieved for dynamic programming.

I have file name as a string.

Please suggest me the best way to show it on the browser and also, that should be having a form which contains a close button as well.

Thanks in advance,
19 years ago
JSP
Hi,
I have been trying to delete a file using File class's delete method.
In my application, I am creating files using File.write method dynamically.after some point I would like to delete the same file which can be captured by the user's action. I am suing delete of File class and it seems to be not working. Can someone help mein this regard.
My code:
In jsp page:
-----------------------------------------------------------------
<%
File fname=(File)session.getAttribute("opFile");
String str="c:/onDemand/"+fname.getName();
File fname1=new File(str);
System.out.println(fname1);
System.out.println("isdelete?"+fname1.delete());
%>
--------------------------------------------------
and output I got @console:
-----------------------------------------------------------------------------
c:\onDemand\xxAlH414kHOgUn9FACSs27z00489568.tif
isdelete?false
-------------------------------------------------
But I can see the file ,its neither getting deleted nor throwing an exception.
Please help me....Thanks
19 years ago
Thanks for all your advices. I will go ahead and try and will get back to you if anything works out or not
Thanks
19 years ago
JSP
Hi,
I am developing an application which searches for a particular document in some kind of database and returns the results and when the user clicks on one of the results, it should show the corresponding document from the db. Now I could get that functionality in my app. But my question is right now I am planning to store the document in temp folder and giving it back to the user for a particular session and am going to use a file name specific to the session and particular document for storing the docs.
My questions:
I want to delete the file after the session times out/user closes the window.How do I do that?

And also please advise me if the whole thing is the right approach to achieve the functionality of the application considering the performance issues. I am using JSP and java classes right now.

I am completely a beginner and was asked to develop this application on my own.
Please help me out.
Thanks
19 years ago
JSP
Hi,
I am getting the following Exception. I was not able to trace out what the problem could be.
C:\workspace\onDemand\odwekTest\JavaSource\com>javac Test.java

C:\workspace\onDemand\odwekTest\JavaSource\com>dir *.class
08/25/2004 01:03 PM 683 Logon1.class
08/25/2004 01:32 PM 716 Test.class
2 File(s) 1,399 bytes
0 Dir(s) 23,850,209,280 bytes free
C:\workspace\onDemand\odwekTest\JavaSource\com>java Test

Exception in thread "main" java.lang.NoClassDefFoundError: Test (wrong name: com
/Test)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

Please let me know if anyone came thru this exception. I have strong feeling that some problem with classpath but I did set the path as well.
Please suggest me
Thanks
19 years ago
Thanks for the replies. I could solve the problem
19 years ago
JSP
I have an array of submit buttons.Not like there is one button and to check if that is pressed or not. I want to know the index of the submit in that array which has been pressed.
Thanks
19 years ago
JSP
Hi,
I am having trouble in dealing with JSP pages.
I have a JSP page which has a set of submit buttons which were generated by using a for loop. Now I have set it up to go to the next JSP page.But I do want to know the index of the button which was clicked.
Its a simple problem for the ones who has been doing it for a while.
Please help me in this regard,
Thanks
19 years ago
JSP
I was not sure where to post this query.
Hi,
I have a question regarding trasferring an application from WAS5 to WAS3. I am working on WSAD5.0.My boss wants me to deploy that on Dev m/c whihc is using WAS3.5. I am not familiar with deployment. Please tell me how do I do deployment and do I have to take any additional steps as I am deploying it on lower version.
Please help me in this regard,
Thanks
Hi,
I could write the byte[] to a file.But I want to have that with a particular extension. Like "tif". the code I wrote:

File f=new File("c:/temp/od/test.tif");
FileOutputStream fout = new FileOutputStream(f);
fout.write(b);//b is byte[] obtained..
fout.close();
return f;

My question is:
Is this the right way to specify the file extension?. I could open the file from ie,paint etc. But the problem is I was not able to include it in <img> tag using HTML. I appreaciate if someone could help me out.
Thanks
19 years ago
I was working with WSAD.I want to use <img:image> tag lib. I have to import it from somewhere. I could n't figure out which jar file has this tld.Iam using WSAD 5.1.2.If it doesn't have it, where could I download?I appreciate if anyone can help me.
Thanks
19 years ago