This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.

khushi paul

Greenhorn
+ Follow
since Feb 08, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by khushi paul

hi all,
i am using apache jakarta commons fileupload for uploading files.
everything goes well but i want to restrict my users to upload .doc file only.what shud i do for that?any suggestions?
if possible pls provide example code.
thanks & regards
Khushi
19 years ago
thanks sarath,
can you give a code snippet for that?
regards
khushi
19 years ago
i just tried another method.....
got the ascii value of each character of the mail-id,added some integer to it ensuring that value doesn't result in any character outside a-z and A-Z.
again formed a string and return that to the user.
it works fine for me as i have to just provide a temporary password which user will change then.....
19 years ago
hi,
i have to genetare password automatically when a user provides his mail-id and then encrypt that pass word and store it into database.

i have implemented the encryption part,but need help to generate the password automatically.Also as i have to supply this password to user it must be in string format not having special characters.
can any body suggest some solution??

regards
khushi
19 years ago
have you ever used servlets and JDBC API?
regards
khushi
19 years ago
thanks thomas,
yes i am developing a database oriented application but it is not possibel for me to rewrite all the pages.

actually there are two frames row wise.the upper frame contains alot of information which is fetched from 2-3 database tables and presented in a tabular form,moreover various links are also present on that page.
when any link is clicked the related information(page) appears in the lower frame.

i hope i am clear to you.
any other suggestion pls....

regards
khushi
19 years ago
I'll surely take care of that from next time Ben
BTW my problem got solved i donno how
19 years ago
hi rohit,i used this code on click event of a button,i get my frame printed but complete frame is not printed.
actually it is a scrollable frame and only the contents that are visible on the screen at a time are printed.
what might be the problem?
regards
khushi
19 years ago
hi all,
can any body tell me is there any java api or other open source code available so that i can have a print option on the html pages i generate through servlet.

actually some pages are divided into frames and i want to give a print button or clickable image on each frame so that when user click that the page get set in printable format.

is this thing possible and if yes pls guide me how.
thanks and regards
khushi
19 years ago
thanks for ur reply ben,
but as u can see in the code that i've posted,i am using
String field=item.getFieldName();
String value=item.getString();

to get name of field and its value,these functions are from fileupload class only.
i am facing a very strange problem...sometimes i get values and at other time i get null.i am neither able to find out the reason nor solve the problem.

however the file uploading part gets implemented succesfully in any case.
pls help me out,its pretty urgent.
19 years ago
i m using jakarta apache commons fileupload for uploading..
19 years ago
thanks,but can u pls give me some code so that i can understand it properly?
and why is it so that my code works some times?
19 years ago
here's the code

public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{
out.println("<form name=esubmit ENCTYPE='multipart/form-data' method=Post>");

some queries...............

out.println("<p> Div Initials: <INPUT TYPE=\"text\" NAME=\"dinitl\" value='"+rs.getString("r_divn_abrv")+"'> Sec Initials: <INPUT TYPE=\"text\" NAME=\"sinitl\" value="+rs.getString("r_secn_abrv")+"> Indentors Initials: <INPUT TYPE=\"text\" SIZE=\"5\" maxlength=\"5\" NAME=\"iinitl\" > Year: <INPUT TYPE=\"text\" SIZE=\"5\" maxlength=\"5\" NAME=\"year\" value="+pyear+"> Indent SrNo: <INPUT TYPE=\"text\" SIZE=\"5\" maxlength=\"5\" NAME=\"srno\"> <INPUT TYPE='file' NAME='document'> </p> ");
out.println("<INPUT TYPE='submit' VALUE='Save'>");

public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML><body>");
out.println("init="+req.getParameter("iinitl"));

DiskFileUpload upload = new DiskFileUpload();
try{

//Parse the request
List items = upload.parseRequest(req);

// Process the uploaded items
Iterator iter = items.iterator();

while (iter.hasNext()) {
item = (FileItem) iter.next();
if (item.isFormField()) {
String fld=item.getFieldName();
String value=item.getString();
if(fld.equals("dinitl"))
{di=value;}
if(fld.equals("sinitl"))
{si=value;}
if(fld.equals("iinitl"))
{ii=value;}
}
}
out.println(ii);
....

do you need any more explanation?
19 years ago
hi all,
i have written a HTML forms body in doGet method of a servlet and trying to retriev form element values in doPost method of the same servlet.my problem is that some times i get the values by using request.getParameter but many times it just returns null although value has been entered in the form elements.
can anybody pls tell me its reason and possible solution?
regards
khushi
19 years ago
thanks Ben,
there was some minor classpath error which i sorted out.
thanks for ur help
Now i can upload the file and write it in some directory but can you pls guide me wat should be done to write it into a database?
regards
Khushi
[ March 02, 2005: Message edited by: khushi paul ]
19 years ago