Two Laptop Bag*
The moose likes JSP and the fly likes Reading parameter from JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Reading parameter from JSP page" Watch "Reading parameter from JSP page" New topic
Author

Reading parameter from JSP page

shivashankar matam
Greenhorn

Joined: Mar 28, 2009
Posts: 11
HI

I want to read the filename from the jsp by pressing the particular button for a particular file...and pass it on to servlet. This is not working. The code given below

JSP page:





Im calling this function on clicking the button




My servlet file reading as

String filename = request.getParameter("param1");


im could not able to read the file name in servlet ...please let me know..No errors, file name is null


Thanks & Regards
shiva
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Please use code tag to post your code.and Coming to your question how you submit your form and do you get any error?
shivashankar matam
Greenhorn

Joined: Mar 28, 2009
Posts: 11
I made some correction in my code as above....but its still not working
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575



look it in your code above.you should get class cast exception right? . and do you think your javascript function is correct?
shivashankar matam
Greenhorn

Joined: Mar 28, 2009
Posts: 11
Im reading filelist from another servlet. It works if i use a text boxt to enter the file name as below:




but requirement is pass the variable of the button clicked

how could i pass the fileName parameter in my display() function to the servlet "DisplayLog"

function display(fileName) {

//response.sendRedirect("/DisplayLog?param1=fileName");
//return false;
}


Thanks and regards
shiva
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
If this was my problem I would be carefully examining the actual HTML being written with the browser "view source" capability.

Even better, use Firefox plugin that can show exactly the DOM being constructed.

Bill
sima karia
Greenhorn

Joined: Feb 09, 2009
Posts: 12
[Edit: thread hijack removed. Please ask your own questions in a new topic.]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Reading parameter from JSP page
 
Similar Threads
Display the Selected DropDown Value to another JSP Page
Image preview with upload
How to display InputSream dynamically on a JSP page?
Hit Counter
Checkbox Isuue