Subha Garg

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

Recent posts by Subha Garg

Take the Certification exams on these technologies and go on to develop skills that you think you might lack.
17 years ago
How can i convert Pdf to doc using java api's.Ot can i have some good api which can be used to create word docs in java.I have used iText's RtfWriter2.but it creates a rtf file which although is viewable in word but has a huge size compared to *.doc documents.Apache POI i suppose is not efficient to add stuff like pagenumbers and TableOfContents
Hello Ranchers

Do i have any way to convert a Pdf file doc file in servlets.I mean through some api etc
17 years ago
Mocks would help only if you are conceptually clear.Have clear concepts and then solve lot of mocks
Have a strong conceptual framework from kathy sierra and then solve lots of mockm exams and resolve all your doubts.
Hello Ranchers


Can someone explain me in regex a . (dot) is considered a metacharacter without preceding \\ but.(d->digit,s->space,w->word character) are considered metacharacter by putting preceding \\ i.e \\d \\w \\s

Why is it so?
Hello

You are creating two different objects at line a and line c

You are changing value of a it for object created in line a and not for object created in line c.
split function splits the string into tokens which it identifies by expression given as parameter to split (in your case ,).The whole string as a single token still remains even if there is no separating char in it.
Study it from Kathy Sierra Book.Understand the concept from there.And then post your queries to java ranchers.


Subha Garg

SCJP 1.5
Hello Ranchers

Managed to clear SCJP with 91%.Thanks for resolving my queries.
17 years ago
Given this code

public class Test {
public static void append(List list)
{
list.add(42);
}
public static void main(String args[])
{
List<String> intList = new ArrayList<String>();
intList.add("Hello");
append(intList);
System.out.println(intList.get(1));//line 11
}

}

I get A class cast exception in line 11

but if reverse the situation by

->having intList of Generic Type Integer
->adding integer to it before calling append
->adding string to list inside append

then i get a valid output
Here is the reversed code that works.I want to know the explanation for it

//code with reversed situations

public class Test {
public static void append(List list)
{
list.add("Hello");
}
public static void main(String args[])
{
List<Integer> intList = new ArrayList<Integer>();
intList.add(10);
append(intList);
System.out.println(intList.get(1));
}

}
But isn't there a rule that says the runnable object that is passed to the thread gets its run method called.
Given Notice the use of anonymous inner class)


What is the answer:
A. Cat
B. Dog
C. Compilation fails.
D. The code runs with no output.
E. An exception is thrown at runtime.
What other alternative do i have for the following situation:



on file1.jsp

i have a button with caption download file

on the click of the button request is submitted to downloadfile.java servlet

downloadfile.java servlet sends doc file to browser by opening separate (open ,save as) dialog box

during this event my file1.jsp is visible in its own window on client side while client gets an (open saveAs) popup dialog for doc file.

i want my downloadfile.java servlet to send the download file to servlet (which it is doing perfectally well) and also refresh the file1.jsp which i cannot do because servlet cannot send two responses?
17 years ago
Hello

I want to send a file to browser and then want to send control to another jsp.
i am sending a file to browser through following command which is opening in a new window.after that i want to forward the page to a jsp how can i do it

response.setContentType("application/doc");
response.setHeader("Content-Disposition", "attachment;filename=\""+ "FullElementReport"+ ".doc\";");
17 years ago