File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How i write the code so that at on submit as well as at onload we call same servlet i Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How i write the code so that at on submit as well as at onload we call same servlet i" Watch "How i write the code so that at on submit as well as at onload we call same servlet i" New topic
Author

How i write the code so that at on submit as well as at onload we call same servlet i

sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear ALL,
Suppose I have a jsp page which contains three radio buttons.Let say three fields are .ALL .NSE .BSE


When i click the link of jsp page the default of ALL(.ALL radio button) data mapped with servletpage will displayed automatically.

After click the jsp page link,also the user can choose the radio button(Either .ALL/.BSE/.NSE ) and click the submit button
respective data ((Either .ALL/.BSE/.NSE ) mapped with sevletpage and getting displayed.


I dont have facing any problem when i click submit button i will get the data according the radio button i choose.
But i am facing poroblem how automatically the .ALL radio button data(Which must connect to servlet for retrive data from database) will displayed when i click the jsp page link.


Thanks a lot in Advance.

Regards
Sumanta Panda
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

you keep mentioning "click the link of the jsp", but don't describe where that link is.

Anyways.. why not make this "link to the jsp" a "link to the servlet" instead?

I assume in your JSP somewhere, you have a form something like this:


And that in your /app/reloadWithChoice servlet, it eventually redirects to the jsp we just got submitted from?

So instead of linking to "choose.jsp", you'd link to "/app/reloadWithChoice?choice=.all"
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear All,
Please look at my code when I click the view at that time it will call submitForm() method and displaying the data properly(Send request to servlet and value will populated).

Similarly I also call the submitForm(buttonObj) method in function loadInitialValues() at the page load time but why didn�t the value populated automatically.

Could please rectify my code at loading time in function loadInitialValues() where I call submitForm (buttonObj).









[ December 12, 2008: Message edited by: Paul Sturrock ]
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear All,
Kindly i request all of you please suggest/advise me for my doubt.

Thanks a lot in Advance.

Regards
Sumanta Panda
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Thank you all.Now it is working.

Regards
Sumanta Panda
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How i write the code so that at on submit as well as at onload we call same servlet i