Opening new child window - Running servlet (JSP and Servlet)

A

agapitolw

Hi

Currently , I have a javascript code that opens a child window. This
child window is a Java Server Page called showdata.jsp that uses some
data from the database.

I have used this function to open my page :

<script language="JavaScript">
function open_a_window(){
childwin = window.open("showdata.jsp","dataname",
"height=300,width=100");
</script>



Ideally, a servlet should be executed to do the business logic and
extract the data that will be displayed on showdata.jsp. Moreover, the
user may perform search in the child window, to filter or find the
results returned. My questions are as follows:

1. How to run servlet from Javascript that does the logic and then the
results are displayed in showdata.jsp (as a child window)?

2. How to go about filtering or finding results in showdata.jsp while
it is open ? what is the recommended method? because the results have
a check box next to them and when user choses and closes window they
are reported back to the main JSP which opened the child JSP.

Any suggestions, reading materials, code , etc is very appreciated.

Thanks in advance
Agapito
 
J

Joshua Cranmer

Ideally, a servlet should be executed to do the business logic and
extract the data that will be displayed on showdata.jsp. Moreover, the
user may perform search in the child window, to filter or find the
results returned. My questions are as follows:

1. How to run servlet from Javascript that does the logic and then the
results are displayed in showdata.jsp (as a child window)?

This question belongs more in the comp.lang.javascript newsgroup, but
I'll do must to answer.

The JavaScript should be as follows:
function showResultsInWindow(page) {
childwin.location.href = page;
}
2. How to go about filtering or finding results in showdata.jsp while
it is open ? what is the recommended method? because the results have
a check box next to them and when user choses and closes window they
are reported back to the main JSP which opened the child JSP.

Not sure I understand your question. The answer appears to be either
AJAX or table sorting. It depends on whether or not the information
returned by showdata.jsp is sufficient to do the client-side filtering
required.

This question also seems to belong more in the c.l.javascript newsgroup.

If needed, I can pull up two bouts of client-side filtering from one of
my projects. One of them is sorting a table, and the other one is
filtering divs based on their contents.
Any suggestions, reading materials, code , etc is very appreciated.

Try poking around c.l.javascript.
 
A

agapitolw

This question belongs more in the comp.lang.javascript newsgroup, but
I'll do must to answer.

The JavaScript should be as follows:
function showResultsInWindow(page) {
childwin.location.href = page;
Thank you very much for your reply . I have posted this question to a
Javascript forum .... Just wonder if you could tell me how to run a
servlet (and not a jsp page) from javascript.
> 2. How to go about filtering or finding results in showdata.jsp while

Not sure I understand your question. The answer appears to be either
AJAX or table sorting. It depends on whether or not the information
returned by showdata.jsp is sufficient to do the client-side filtering
required.

This question also seems to belong more in the c.l.javascript newsgroup.

If needed, I can pull up two bouts of client-side filtering from one of
my projects. One of them is sorting a table, and the other one is
filtering divs based on their contents.

Perhaps it will be clear with an example .... I have several text
boxes that should be filled from some values that are extracted from
database.

Suppose I have textbox sport and textbox player
Now if user clicks a link beside sport textbox, another window opens
(by running servlet , forwarding results to showdata.jsp) . Now user
will see list of options like basketball, football, etc. But the list
could be long and I don't want him to scroll down the page and look
for it. I would like to know if there is a good method to enable him
to search in the same form that is displaying data.

Thanks again
 
A

Andrew Thompson

...I would like to know if there is a good method to enable him
to search in the same form that is displaying data.

Yes. JavaScript is well suited to that type of task,
so your post over on c.l.js should get it sorted.

Of course, when posting to the JS group, it often pays to
ignore the entire Servlet/JSP source of the data, and
simply refer to it as a web page (HTML), since ultimately,
HTML (with embedded scripts, or references to external
scripts) is what is delivered to the browser.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
 
L

Lew

Thank you very much for your reply . I have posted this question to a
Javascript forum .... Just wonder if you could tell me how to run a
servlet (and not a jsp page) from javascript.

A JSP page /is/ a servlet!

You invoke a servlet by using its URL as the target of a form POST.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top