rambabu desina wrote:Dear ranchers ,
i have UI field named area code and which is retrieved from database and populate those values in the area code depending on the area input field which is also taken from DB
so please give any solution to populate the area code depending on the value of area input field. :rolling: :confused:
Palak Mathur wrote:
rambabu desina wrote:Dear ranchers ,
i have UI field named area code and which is retrieved from database and populate those values in the area code depending on the area input field which is also taken from DB
so please give any solution to populate the area code depending on the value of area input field. :rolling: :confused:
You will ask the user to enter Area Input field and based on the Area Input field you need to fetch the Area code from the db. What is the issue with this? Where exactly is the problem? Are you not able to write a SQL query or you are not sure about your JSP?
ShowSomeEffort
Palak Mathur wrote:First thing first, you will need to show some effort. Go through a JSP book or online references.
Secondly, you will not like to query your DB from your JSP. Separation of Presentation and Persistence logic is must. So, from your JSP you may want to call a Servlet which may call your DB through some helper classes.
rambabu desina wrote:
Palak Mathur wrote:First thing first, you will need to show some effort. Go through a JSP book or online references.
Secondly, you will not like to query your DB from your JSP. Separation of Presentation and Persistence logic is must. So, from your JSP you may want to call a Servlet which may call your DB through some helper classes.
ok
but we did not know about area input field value to write the query in DAO classes. i.e., to write the helper classes
Palak Mathur wrote:
rambabu desina wrote:
Palak Mathur wrote:First thing first, you will need to show some effort. Go through a JSP book or online references.
Secondly, you will not like to query your DB from your JSP. Separation of Presentation and Persistence logic is must. So, from your JSP you may want to call a Servlet which may call your DB through some helper classes.
ok
but we did not know about area input field value to write the query in DAO classes. i.e., to write the helper classes
Your problem statement is not at all clear. Try to tell a little more. How are you representing them on screen - textfield, dropdown. What you expect the user to do? And what happens when the user do that? Any relevant info will be helpful.
Palak Mathur wrote:What code have you written? Can you please show us that? You have a clear problem statement in front of you and you know the solution. Try to work on it first.
rambabu desina wrote:
Palak Mathur wrote:What code have you written? Can you please show us that? You have a clear problem statement in front of you and you know the solution. Try to work on it first.
<select name="court_name" Onchange="getcase();getsubcourt();">
<OPTION VALUE="" SELECTED>Select</OPTION>
<c:forEach ....>
<option value=${courtCase.caseName}>${courtCase.caseName}</option>
</c:forEach>
</select>
i have populated the above court_name values by hitting the DB before coming to JSP
and after selecting the above value we have to populate the courtcase_number for the corresponding cour_tname
from DB
please provide the solution for the above issue
<select size="1" name="courtcase_number">
<option></option>
</select>
for that purpose how to retriving the data from DB using the above selected court_name
rambabu desina wrote:
Palak Mathur wrote:What code have you written? Can you please show us that? You have a clear problem statement in front of you and you know the solution. Try to work on it first.
<select name="court_name" Onchange="getcase();getsubcourt();">
<OPTION VALUE="" SELECTED>Select</OPTION>
<c:forEach ....>
<option value=${courtCase.caseName}>${courtCase.caseName}</option>
</c:forEach>
</select>
i have populated the above court_name values by hitting the DB before coming to JSP
and after selecting the above value we have to populate the courtcase_number for the corresponding cour_tname
from DB
<select size="1" name="courtcase_number">
<option></option>
</select>
for that purpose how to retriving the data from DB using the above selected court_name
Palak Mathur wrote:
rambabu desina wrote:
Palak Mathur wrote:What code have you written? Can you please show us that? You have a clear problem statement in front of you and you know the solution. Try to work on it first.
<select name="court_name" Onchange="getcase();getsubcourt();">
<OPTION VALUE="" SELECTED>Select</OPTION>
<c:forEach ....>
<option value=${courtCase.caseName}>${courtCase.caseName}</option>
</c:forEach>
</select>
i have populated the above court_name values by hitting the DB before coming to JSP
and after selecting the above value we have to populate the courtcase_number for the corresponding cour_tname
from DB
<select size="1" name="courtcase_number">
<option></option>
</select>
for that purpose how to retriving the data from DB using the above selected court_name
What are you doing to solve the part that I have marked in bold? You have to fetch the data from DB and show it. Also, you can fetch these details in the first DB call and depending on the selection, you can display the options. But it will all depend on your needs and requirements.
Junilu Lacar wrote:Why don't you check out this approach: Servlets + AJAX
Junilu Lacar wrote:You would have to use JavaScript to respond to the onChange event, then submit the form, again using JavaScript. That would cause a round-trip to the server and your page would be redrawn by the browser with the other field updated based on the previous selection. That causes the user to see the page "flash" as it is being refreshed after the round-trip and this can be disconcerting, especially if you have a long form that the user has to scroll through. AJAX is probably the best way to go at this time, at least that I know of.
Consider Paul's rocket mass heater. |