Dharmanand Singh

Greenhorn
+ Follow
since Oct 27, 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 Dharmanand Singh

Did you catch the exception and try to print the Stack-trace? If not, do so and see if it helps.

Originally posted by Monarch Bhojani:
Hello all
If i place the code of adding the entries to LDAP server into the servlet the thing happens is that from that line of code the execution stops
Yes but the code compiles successfully but there is a runtime exception
This runtime exception is not even shown just the execution stops

Please help

Thanks
Regards
Monarch

19 years ago
If I got you right, you are asking if the session attributes can be accessed after you have redirected the response. As per my knowledge, only the request object dies after response redirecting (and a new request object initiated). Session object is related to the user session and attributes in the session object will not die until the session expires or you explicitly remove that attribute. Hence compiling all these, the session attributes can be accessed after setting them even after redirecting the response.
[ April 07, 2005: Message edited by: Dharmanand Singh ]
19 years ago
Hope this link is useful:
http://forum.java.sun.com/thread.jspa?threadID=311728&tstart=15
[ March 22, 2005: Message edited by: Dharmanand Singh ]
There are many solutions. I have also listed the advantages of each.

Problem: javax.servlet.HttpServletRequest.getParameter(String) returns null when the ContentType is multipart/form-data

Solutions:

Solution A: (Advantage: Free Distribution & Widely used)

1. Download one of the versions of UploadFile from http://jakarta.apache.org/commons/fileupload/
2. Invoke parseRequest(request) on org.apache.commons.fileupload.FileUploadBase which returns list of org.apache.commons.fileupload.FileItem objects.
3. Invoke isFormField() on each of the FileItem objects. This determines whether the file item is a form paramater or stream of uploaded file.
4. Invoke getFieldName() to get parameter name and getString() to get parameter value on FileItem if it's a form parameter. Invoke write(java.io.File) on FileItem to save the uploaded file stream to a file if the FileItem is not a form parameter.

Solution B (Advantage: Easy to use)

1. Download http://www.servlets.com/cos/index.html
2. Invoke getParameters() on com.oreilly.servlet.MultipartRequest

Solution C (Restricted to those applications that use this framework):

Use Struts. Struts 1.1 handles this automatically.
19 years ago
JSP
All I could make out from your question is that you want to search a site and probably you have all the html, jsp files that lie there. There are 2 approaches that can be taken in order to search the documents of the site. First is to index all the display data of the html and jsp files on the site and secondly to index the data after crawling the whole site. Now I can give you some idea of using the former method. You will need to parse the html and jsp files and extract the display information from them by employing some logic. After getting the display data, you need to analyse and then index the content and store it. You can then search efficiently on these stored indices and keep on updating these indices whenever there is a change in the site. Now, there are many libraries which will help you to analyse and index the content and perform search on them. I have used one of such libraries: Lucene. You can download an lucene search web-application example from: Download. You can read about the details of this example here. There are certain others which also have a crawler that index the whole site by following the links (as indicated by me as second approach). I haven't used any such library personally but know of one whose documentation are not in English Regain. But I am sure we can find more and try them out. eg. htdig which probably runs on UNIX flavors.
[ December 02, 2004: Message edited by: Dharmanand Singh ]
19 years ago
JSP

Originally posted by Kunal Prakash Gandhi:
File Creation on a Particular Path of a Remote Machine in java


You can't write a file through a web-application to the desired path on the client machine. What you can do is send an output stream of a server file which can be prompted to the client for download to any desired path browsed by him on his machine.
19 years ago
JSP
Struts does not specifically provide any error handling for each and every form field like text box labels in your case. What it provides is a framework for error handling using the struts ActionError. You can add many such ActionError objects to an ActionErrors object in the Action class. Using saveErrors(request, ActionErrors) method provided in the action class, you can save the ActionErrors in the request. This can be accessed on the jsp by including the tag <html:errors/>. This will display all the errors that have been added via ActionErrors.
For your specific problem you might have to employ some logic to each of the form field labels and play on with their fonts. So, in the form bean you will probably need to keep the status of error for each of the form fields and then use that information to display the label in relevant font.
[ December 02, 2004: Message edited by: Dharmanand Singh ]
19 years ago

Originally posted by Tobi McFarland:
Is there a non-javascript way to pop up a small window using JSP/Servlets? So far my googling research has all suggested javascript only.

Thanks-



The answer lies in the fact that you cannot send a response without a request from the client. This is the basic principle of the request-response model. So, I think you better help yourself with javascript or other scripting stuff
19 years ago
JSP
JSP

Originally posted by Carol David:
My jsp page is taking lots of time to load on...My Webserver is IIS and the records to be loaded at a time is more than 5000. How to make it to be loaded in less timing.



Load few records at a time, say 100 records (which might be most useful for the user) and add 'Previous' and 'Next' links or buttons
19 years ago
JSP

Originally posted by Jeroen Wenting:
You can't push the data from the server to the client so you'll have to wait.
Only alternative would be to have the user enter an email address and use JavaMail to send them the PDF as an email attachment.



He means to say that you can't send the response without any request. So, either the user will have to wait for the response after placing the request or a thread can be spawned at server side that runs asynchronously and composes the PDF file and then send this file through email which can be taken as a input parameter from the user. In the later case, the user will not have to wait for the time that is used in composing the PDF as that task has been delegated asynchronously to an independent thread.
19 years ago
JSP

Originally posted by sailaja parepalli:
Hi all,
Does anybody know how to work with pop-up windows in a jsp?
...
Thanks.



On the pop up page, include a javascript function which will be called on submitting the pop up box. Now you can populate the fields of the parent window or populate the value of any hidden field on the parent window by the javascript statement:
window.opener.document.<object_name (or form_name)>.value = <value_on_pop_up_page>;

Basically, window.opener.document will give you the document object of the parent page, and then you can play on further.
[ November 18, 2004: Message edited by: Dharmanand Singh ]
You can refer one of the lucene examples http://dharmanand.tarundua.net/lucene_eg.war that parses pdf documents as well as text documents. This does not handle word documents, but you can definitely find a suitable library for that as well. You can read details about this example on http://dharmanand.tarundua.net/
[ November 09, 2004: Message edited by: Dharmanand Singh ]

Originally posted by Pradeep Chandrasekharan Nair:
i am submitting data from a form using enctype=multipart/form-data. i am not able to get the value of text field using request.getParameter() method. but i am able to save the file which is uploaded. is there any other methods to get the value of text field.



There are many solutions to your problem if you are ready to embrace some libraries. The solutions and their advantages are as follows:

Solution A: (Advantage: Free Distribution & Widely used)

1. Download one of the versions of UploadFile from http://jakarta.apache.org/commons/fileupload/
2. Invoke parseRequest(request) on org.apache.commons.fileupload.FileUploadBase which returns list of org.apache.commons.fileupload.FileItem objects.
3. Invoke isFormField() on each of the FileItem objects. This determines whether the file item is a form paramater or stream of uploaded file.
4. Invoke getFieldName() to get parameter name and getString() to get parameter value on FileItem if it's a form parameter. Invoke write(java.io.File) on FileItem to save the uploaded file stream to a file if the FileItem is not a form parameter.

Solution B (Advantage: Easy to use)

1. Download http://www.servlets.com/cos/index.html
2. Invoke getParameters() on com.oreilly.servlet.MultipartRequest

Solution C (Restricted to those appliaction that use this framework):

Use Struts. Struts 1.1 handles this automatically.
[ November 01, 2004: Message edited by: Dharmanand Singh ]
19 years ago