i am developing a web application.
i am getting a problem in event handing in jsp.
in this web application there is a file generic.jsp.
for this jsp page i am using a database name as “priyadarshaniDB” and in this database i am using a table “tblgeneric”.
the details of generic.jsp file is as follows :
there are three parts in this web page.
left part,center part,right part.
now here is the information regarding all these parts
left part : a list of labels(let say L1)
right part : same as left part but with different labels(let say L2).
center part : a table which retrieve on column from the table tblgeneric with all the values in this column.
now the problem is as follows :
in the center part, if i click on a particular row then it should retrieve the columns related to that row.
for example : if i click on the name “abc” then it should retreive the columns related to the name “abc”
so the point is that i want to retrieve those columns in L1 and L2.
that means i want to generate event on each row of retrieved row from the database.
Wow, there are some major problems here…
So, first off welcome.
JSP and JavaScript are different.
JSP is a server side technology that is used for rendering text (html, javascript, etc…).
JavaScript is used to add dynamic behavior to a rendered web page.
From what you’re describing, it sounds like you might need several different jsp files.
One to do the original rendering of your page.
And one or more other jsps used for returning data to your first page via a javascript http request.
Best of Luck.
hi,
it’s not a jargon of jsp pages here.
i am talking about only a single jsp page.
which is retrieving some values from the table and i want to implement event on the retrieved rows from the database.
its as simple as accessing a directory.
i am sending u link which has a snapshot of the created jsp page.
if u still have any doubt please ask me freely at anytime.
thanks and regards
Nishi Kishore
I still think there is a misunderstanding on how exactly jsp works.
So, this is my understanding of what you want to happen…
- A web page is displayed to the end user that has a some a list of database data displayed.
- The end user clicks on one of the items on the list and other information from the database will be displayed in another part of the original web page, but in a different list.
Is that close to what you’re looking to accomplish?
Bingo…!!!
u got my point exactly.
yes this is what i want to do in this web page.
Alrighty.
So, what was in my first post, in general, is what you need to do.
Have one jsp for displaying your first page request.
Use javascript to handle the user’s mouse click and make a secondary request back to your server to get the other data from the database. You will then most likely have a second jsp file for handling that specific request that will access your database to get that data, format it, and then return it to the user. Then the javascript will parse the returned data and enter it into the other part of the page.
Here are a couple of random thoughts that might help you out, nothing here is meant to be rude, but I’m getting the sense that there is a full understanding of how the web works.
Jsp is used for creating textual output (html, json, plain text, etc…) and shipping it to a web client of some sort. The web client could be a web browser, a soap client, a javascript client, etc…
A user viewing your jsp output is viewing that output on their local machine. Once the page is rendered to the user in their browser, there is no longer a connection to the server. The user’s browser will have to make a second request to the server to get anymore information from the server.
One other technique you could attempt, but would be ill-advised, is to read all the data from the database and store it somewhere in your output. Then use javascript to display the correct data based on a user’s selection.
Best of Luck.