ABAP Webdynpro - Populating second table based on data selected on first
Hi Experts,
I am new to ABAP Webdynpro. I have a requirement to show a search area, one table for header info, and second table for populating item level information.
I was successful building a search area and populating first table when the 'Search' button is pressed.
Now, I like to populate the second table with item details if a row on first table is selected. I tried to bind the OnSelect Event of first table to a method and try to get the results and bind to second table.. However, I am unsuccessful in this attempt.
Here are my questions/challenges.
1. When I select a row on first table, how can I extract the key information?
2. Is it sufficient to create a context attribute and populate it with FM and bind that with second table?
I appreciate your help in answering this question.
Thanks,
SG
Hi,
Regarding...
1. When I select a row on first table, how can I extract the key information?
When you select any row in table, a lead selection will be set in the node which bound to the table.
To read this selected record you need to use the following code. Here the name of context node is "FLAGS". And the structure ls_flags contains all the attributes defined in the node.
DATA lo_nd_flags TYPE REF TO if_wd_context_node.
DATA ls_flags TYPE wd_this->element_flags.
lo_nd_flags = wd_context->get_child_node( name = wd_this->wdctx_flags ).
CALL METHOD lo_nd_flags->get_static_attributes
IMPORTING
static_attributes = ls_flags.
Regarding....
2. Is it sufficient to create a context attribute and populate it with FM and bind that with second table?
Based on the data that you got in the first step, you can fill an internal table with data that needs to be displayed in 2nd table.
To bind the internal table you need to define the internal table of type context node. Use the following code to bind the internal table to context node which bound to 2nd table. Here name of the context node is "OVERVIEW".
DATA: lo_nd_overview TYPE REF TO if_wd_context_node,
lt_overview TYPE wd_this->elements_overview.
<<<< Fill lt_overview with data >>>>>
lo_nd_overview = wd_context->get_child_node( name = wd_this->wdctx_overview ).
CALL METHOD lo_nd_overview->bind_table
EXPORTING
new_items = lt_overview.
Alternatively you can use the Supply Function Method.
Vikrant Trivedi
Similar Messages
-
How to fill setup table based on date???
Hi Experts,
I need to do repair full request for 2lis_11_vaitm datasource, I want to load from 1st Apr 2008 to 31st March 2009, but in OLI7BW t-code i am unable to find date field in selection screen.
1) How can I fill setup table based on date?
2) In RSA7 containing records even though is it possible to fill setup table ?
Helpful answer will be appreciated with points,
Thanks in advance,
Venakt.Venkata,
1) How can I fill setup table based on date?
--> If date not possible then try to setup with available options/characteristics.
--> While pulling into BW, extract data selectively. Give date selection at infopcakge.
2) In RSA7 containing records even though is it possible to fill setup table ?
--> Yes, you can do it.
Srini -
Querying a table based on a selection criteria
Hi Gurus,
Could you please help me in creating a function module that picks records from the table based on certain selection criteria.For eg, If contract number(a primary field) is an import parameter and I want the Function module to export all the records with contract number starting with 1 or may be ending with 303.How could I query this??
Thanks,
AshwiniHello,
Creation of Function Module
Goto TCode SE37
Click on the Menu Goto->Create Function Group
Create Z (ZPTP) function group and Activate Function Group even if the error occurs
Create Function module Namely Z (ZTEST) assign to the function group (ZPTP)
Go to the Import parameters (EBLEN TYPE EKKO-EBELN)
Go to the Tables ( itab type ekpo)
Goto the Source code
tables ekpo.
Select * from ekpo into table itab
where ebeln eq ebeln.
Activate the function module and run the function
regards
suresh nair -
Need to fetch value from a table based on data range
Hello there,
I was hoping that the community could give me a hand with this little puzzle I got.
I am currently creating a Time Dimension for a data wharehouse, and I have the requirement to populate a column named SEASON (e.g: Summer, Winter, Spring, Autumn) for each date row. So for the 20/Dec/2013, the Season column must say Winter.
Here is now my Time Dimension table looks like, without the Season information (which I yet have to load):
DimTime Table
TIMEID
FULLDATE
YEAR
SEASON
MONTH
MONTHDAY
WEEK
WEEKDAY
274
02-MAR-10
2010
3
2
9
2
275
03-MAR-10
2010
3
3
9
3
276
04-MAR-10
2010
3
4
9
4
277
05-MAR-10
2010
3
5
9
5
278
06-MAR-10
2010
3
6
9
6
279
07-MAR-10
2010
3
7
9
7
This entire table is being populated using Oracle functions to manipulate a date field from another table, named PDATE:
My ETL Code
INSERT INTO DimTime(timeid, fulldate, year, month, monthday, week, weekday)
SELECT tim_seq.NEXTVAL, pdate, year, month, monthday, week, weekday
FROM (SELECT DISTINCT pdate, EXTRACT(year from pdate) year, EXTRACT(month from pdate) month,
EXTRACT(day FROM pdate) monthday, to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
TO_CHAR(pdate, 'D') weekday
FROM Performance PER
ORDER BY pdate);
NOTE: Code considers the table DimTime to be truncated every time it loads (i.e.: I don't need to consider additional loads).
As you can see, Season wasn't populated. Since the solstices and equinoxes vary for each year, I can't just say that Summer start at a given date (e.g: 21 of June) because one year it could be the 19/Jun, another the 22/Jun, etc. So in order to solve this problem, I have a table named Season which defines the START and END dates for the seasons:
Season Table
SEASON#
SEASONNAME
YEAR
DATEFROM
DATETO
1
Spring
2010
01-MAR-10
30-MAY-10
2
Summer
2010
31-MAY-10
29-AUG-10
3
Autumn
2010
30-AUG-10
28-NOV-10
4
Winter
2010
29-NOV-10
27-FEB-11
5
Spring
2011
28-FEB-11
29-MAY-11
6
Summer
2011
30-MAY-11
28-AUG-11
7
Autumn
2011
29-AUG-11
27-NOV-11
8
Winter
2011
28-NOV-11
26-FEB-12
9
Winter
2009
30-NOV-09
28-FEB-10
This is the bit I don't know how to do. How can I make sure that I populate the correct Season in my DimTime table based on the season specified in the Season table?
Thanks in advance for your help!
Regards,
P.Just join to table Season:
INSERT
INTO DimTime(
timeid,
fulldate,
year,
month,
monthday,
week,
weekday,
seasonname
SELECT tim_seq.NEXTVAL,
pdate,
year,
month,
monthday,
week,
weekday
FROM (
SELECT DISTINCT pdate,
EXTRACT(year from pdate) year,
EXTRACT(month from pdate) month,
EXTRACT(day FROM pdate) monthday,
to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
TO_CHAR(pdate,'D') weekday,
seasonname
FROM Performance PER,
season
WHERE pdate between datefrom and dateto
SY. -
To select from database table based on date range
hi
i have a selection screen in which date range is being given
say eg 23/06/07 to 23/12/08
based on this date i want to select data from a ztable
eg i want to select a field amount from table
and three is a field date range on the table
for this particular field i want to select all records for amount field and factual field falling wiithing this date range and sum it
eg
based on date range as in selcetion screen
select amount( field1) factual ( field2) from ztable into it_ztable where date = ?....
please give me code for it and how to sum all values as i will get from the ztable into internal table the two values as fetched from the ztable
please suggest asap
regards
arorahi
i am using
sELECT field1 field2 FROM Ztable INto it_matu
where DATE GE sl_dat-low
AND DATE LE sl_dat-high.
i am getting data in internal table but
say i have twelve records now i want to sum it the both the columns into and use that sum final amount to display
let me know how to use sume in the intrranal tabl do i need to use control statement
how to use the sum for two columns and take into a serperate variable to display
regards
aRora -
How to select data in setup tables based on date
hello gurus,
I have a question . I want to fill the setup tables but not complete historical data. I need to fill it based on some date selection.Can anyone help me the process. I went to oli9bw but i cannot see any option like date range for data selection...... i.e., I need to extract a subset of data from ecc to bw.
Thanks a lotHi Sandeep,
While filling Setup tables we won't have any selection(It loads all historical data), when you run the IP to load data to BW.follow the below 2 cases.
1)If you require further delta loads on this, run the full load based on your date selections.then create another IP for delta,run "init without data transfer" as option in Update tab of IP.
2)If you don't require any delta further, simply run Full load with date selections.
Hope this helps.
Regards,
Venkatesh. -
Updating tables based on Dates
In my application I use some tables with a date field.
table: employee
period date (e.g. 01-01-2004, 01-02-204, 01-03-2004)
target money
result money
table: project
date date (e.g. 15-01-2004, 20-01-2004, 03-02-2004)
revenue money
If I book a new project the table employee should be updated with result = result + revenue. If there is a new project on 15-01-2004 the record in employee where period = 01-01-2004 should be updated.
Can someone help me with a sample code for this problem?Assuming you have a block in the form call PROJ with fields DATE, REVENUE and EMP_NO. Also that a record exists for the employee and period date.
Create PRE-INSERT and PRE-UPDATE triggers on the block PROJ containing
begin
update employee
set result=result+:PROJ.REVENUE
where period_date=trunc(:PROJ.DATE,'Mon')
and emp_no=:PROJ.EMP_NO;
end -
Filter one table based on user selection
Hi all ,
I am creating simple employee data application in VC. It consists of roadmap. On first step user searches for employee by giving first name , last name then he searches for employee and all the data related to employee's is fetched out at one shot through BAPI_EMPLOYEE_GETDATA. Now after step one no of employee comes.
When I select one record I want that for the selected rows employee's personal data should be fetched out from another table (which is populated during first BAPI call). so I want to pass the selected key value and filter that table based on passed value to table and filter the table .
Kindly give a solution as to implement filter on a table without making another BAPI call .
Thanks in advance
AbhayHi Abhay,
There's a trick to get a 'dynamic' filter (i.e. a filter that filters on a value that can change) out of the normal static filters:
Just click on the output of your data source, then 'configure' and on the '+' - sign in the lower right corner. Add a boolean field called 'condition', for example. Then, you write the condition that filters out the row(s) that you need. In the filter that comes next in the dataflow you just filter on this 'condition' - field being true.
Hope that helps,
Sincerely,
Florian -
ABAP Webdynpro: Creating a table on webdynpro screen to enter new data.
Hello Experts,
Does anyone know, how to create a table on webdynpro screen that can be used to enter new data in database?
I have tried to create a Table UI element (with Standard Cell Editor as Input Field) but it is "Display only" if there is no data in the table. This means, while you can use it to modify the data if some data already exist, but you cannot use it to enter new data if no data already exist. What I am looking for is something similar to a Table Control (or Step-Loop) functionalty of a traditional (non webdynpro) SAP screen. How to achieve this in Webdynpro for ABAP?
Thanks in advance.
ABAPerEven if no data is not there, you can pass blank work areas to table, so now table will blank rows where you can enter the data even if previous data is not there.
below is the sample code to get blank rows in table in order to enter data.
DATA LO_ND_N_EDUCATION1 TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_N_EDUCATION1 TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_N_EDUCATION1 TYPE WD_THIS->ELEMENT_N_EDUCATION1.
navigate from <CONTEXT> to <N_EDUCATION1> via lead selection
LO_ND_N_EDUCATION1 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_N_EDUCATION1 ).
DATA: ET_DATA TYPE WD_THIS->ELEMENTS_N_EDUCATION1,
EW_DATA TYPE WD_THIS->ELEMENT_N_EDUCATION1.
DO 10 TIMES.
APPEND EW_DATA TO ET_DATA.
ENDDO.
get element via lead selection
LO_EL_N_EDUCATION1 = LO_ND_N_EDUCATION1->GET_ELEMENT( ).
LO_ND_N_EDUCATION1->BIND_TABLE( NEW_ITEMS = ET_DATA SET_INITIAL_ELEMENTS = ABAP_FALSE ).
now table will have 10 rows, here node name is N_education1.
Thanks and REgards
Srinivas -
RFC data into WebDynpro Table based on Page selected by user in Portal
Hi All
I am new to webdynpro. we are developing an application in which we are supposed sent two parameters to RFC to retrive data. Two parameters are Role (plant) and page names(Sub - plant).
Finally there should only one RFC for whole application which takes parameters when user selects a role and page inside a role.
How can I do this. Please help me.Hi,
1. Develop an RFC at the backend SAP system, which takes in 2 input ( plant and sub-plant) and gives the list of results as a table.
2. Create a model in the WD Java application to call the RFC.
3. call the rfc, get the output and print the result in a table designed in the view.
There is a sample application which can be found here
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/creating%20a%20web%20dynpro%20application%20accessing%20abap%20functions.pdf
This does a similar application which you are trying to do. This takes in 2 input parameters from the user 'Departure city' and 'Arrival city' and prints the list if flights. If you go thru this sample application, you can develop urs very easily.
You can even get the source code of this project in the following link
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#15 [original link is broken]
Click 'download from SDN' in the link above.
Hope this helps you
Regards,
Sharadha -
Problem Outputting Data From Second Table Based On ID in FIrst Table
Hi Everyone: I have been stuck for a couple of days on a
couple of issues. Here is one:
I have a COURSES table. I also have a COURSES Summary page
that displays all of the courses and related info.
When a user clicks on a specific course it takes them to a
courses detail page for that specific course. PROBLEM: Everything
is working ok except: I have a separate table that has the teachers
information in it. The two tables are related by The Primary Key
(PERSONNEL_ID) in the Teachers table (Called PERSONNEL_LISTS) and
MT_ID in the COURSES TABLE. I don't want the MT_ID to be displayed
on the details page: I want the teachers first and last name.
Here are the two tables:
http://www.coolflasher.com/Courses_table.gif
http://www.coolflasher.com/Personnel_table.gif
The SQL that is currently being used on the Course Details
page is:
<cfparam name="URL.COURSE_ID" default="-1">
<cfparam name="URL_COURSE_ID"
default="#URL.COURSE_ID#">
<cfparam name="SESSION._Insert_COURSES" default="-1">
<cfquery name="COURSES"
datasource="SCHEDULING_TRACKER">
SELECT *
FROM COURSES
WHERE COURSE_ID = <cfqueryparam value="#URL.COURSE_ID#"
cfsqltype="cf_sql_numeric"> OR ( -1= <cfqueryparam
value="#URL_COURSE_ID#" cfsqltype="cf_sql_numeric"> AND
COURSE_ID=<cfqueryparam value="#SESSION._Insert_COURSES#"
cfsqltype="cf_sql_numeric">)
</cfquery>
And I'm outputting the MT_Code:
<cfoutput>#COURSES.MT_ID#</cfoutput>
I tried adding the PERSONNEL_LISTS table to the query, but I
can't figure out how to get it to output the FIRST_NAME and
LAST_NAME column that correspond with the MT_ID in the COURSES
table.
Courses
TableSomething like this maybe?
(NOTE: you should explicitly list column names from both
tables instead of using *)
<cfquery name="COURSES"
datasource="SCHEDULING_TRACKER">
SELECT t.FIRST_NAME,
t.LAST_NAME,
c.COURSE_NAME,
c.COURSE_ID,
---whatever other fields that you want to select
FROM COURSES AS c
INNER JOIN PERSONNEL_LISTS AS t ON c.MT_ID = t.PERSONNEL_ID
WHERE c.COURSE_ID = <cfqueryparam value="#URL.COURSE_ID#"
cfsqltype="cf_sql_numeric">
OR ( -1 = <cfqueryparam value="#URL_COURSE_ID#"
cfsqltype="cf_sql_numeric">
AND c.COURSE_ID=<cfqueryparam
value="#SESSION._Insert_COURSES#" cfsqltype="cf_sql_numeric">)
</cfquery>
Also, not sure what you are expecting -1 = <cfqueryparam
value="#URL_COURSE_ID#" cfsqltype="cf_sql_numeric"> to do.
Phil -
Loop through tables based on data dict values
Hi,
I working on an old v7.3.4 database that I'm not familiar with and I want to loop through the tables and count the occurrence of a field value based on table names i've retrieved from the data dictionary. None of the tables have relational keys defined.
In a cursor I can loop thru all_tab_columns and load variables with the table, column names, and the datatype, but then I want to use these values in a second nested cursor to loop through each table found by the first cursor.
When I do :
Select var_colname from var_tabname
i get
The following error has occurred:
ORA-06550: line 23, column 10:
PLS-00356: 'V_TABNAME' must name a table to which the user has access
ORA-06550: line 22, column 5:
PL/SQL: SQL Statement ignored
ORA-06550: line 22, column 12:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 27, column 7:
PL/SQL: SQL Statement ignored
so it would seem I can't use a variable to substitute the table name in the 'from' clause. Does anyone know of a way round this ?
Thanks in advanceHi,
You will have to use dynamic sql to create your second cursor.
DECLARE
v_sql_query VARCHAR2(400);
TYPE cur_typ IS REF CURSOR;
c1 cur_typ;
mYRec MyTable%rowtype;
BEGIN
v_sql_query := 'select * from MyTable';
OPEN c1 FOR v_sql_query;
LOOP
FETCH c1 INTO mYRec;
EXIT WHEN c1%NOTFOUND;
EXIT WHEN c1%NOTFOUND IS NULL;
/*processing here*/
END LOOP;
CLOSE c1;
END;
Regards -
Display a count of data in a single report table based on date
Hello, I need a report that will display the name of the SOURCES, and compare the number of sources received TODAY and YESTERDAY
My table CELLS holds the name of the SOURCE, and their SAMPLED_DATE so I need to distinguish how many I reveived today and yesterdat.
eg.
SOURCE|TODAY|YESTERDAY
A | 10 |8
B | 7 |4
I am thinking of something like the below:
SELECT DISTINCT source, COUNT(source) TODAY, COUNT(CASE
WHEN sampled_date = TO_CHAR(SYSDATE-1, 'DD/MM/YY')
THEN 1 END) YESTERDAY
FROM cells
WHERE sampled_date = TO_CHAR(SYSDATE, 'DD/MM/YY')
GROUP BY.... CUBE
Any help will be much appreciated.drbiloukos wrote:
Hello, I need a report that will display the name of the SOURCES, and compare the number of sources received TODAY and YESTERDAY
My table CELLS holds the name of the SOURCE, and their SAMPLED_DATE so I need to distinguish how many I reveived today and yesterdat.
eg.
SOURCE|TODAY|YESTERDAY
A | 10 |8
B | 7 |4
I am thinking of something like the below:
SELECT DISTINCT source, COUNT(source) TODAY, COUNT(CASE
WHEN sampled_date = TO_CHAR(SYSDATE-1, 'DD/MM/YY')
THEN 1 END) YESTERDAY
FROM cells
WHERE sampled_date = TO_CHAR(SYSDATE, 'DD/MM/YY')
GROUP BY.... CUBE
Any help will be much appreciated.Regardless of your final solution, if "sampled_date" is a character string, I'd convert it to a DATE (use TO_DATE) to compare against SYSDATE, rather than convert SYSDATE to a string for the comparison. -
Query on populating existing table using denormalized data
Hi All,
struck in a bad situation :(
Please see if you can assist..
Scenario:
I have data in a flat file which needs to be imported to oracle.. I am doing it using external table.. working fine..
the data is like:
cust1~currency1(e.g USD)~interest(e.g. 10)~2009
cust2~currency2~interest~year
cust1~INR~interest~2009
i need to populate 2 tables using this:
tab1(cert_id,custno, currency)
tab2(cert_id, interest, currency) .. cert_id is a foreign key referring to tab1
cert_id is a existing sequence which i am using
Now the issue is if i directly load data in these two tables by fetching through a cursor..
it creates two rows in tab1 with different certificate ids for a particular year which is incorrect..
it should be one tax certificate per customer per year..
Can anyone please just provide a hint or something.. (data volume is aroun 100,000)
please let me know if you are unable to understand the scenario....No four digit Oracle version was included: too much work.
No platform was included: too much work
The erroneous code was not included: too much work
The request consists basically of 1 line: It does't work. pls suggest.
Yet another request, where the requestor wants maximum help with no effort on his side.
How can anyone understand this 'scenario'?
We are not in a chat room, your webcam is not switched on, and no one is looking over your shoulder.
Sybrand Bakker
Senior Oracle DBA -
Dynamic population of second list box based on the selection of first list
Hai Friends,
I have the code like this.
Here my issue is: when the user accesses this page he will get the topic and related categories in the drop down boxes. but when the user changes the topic it needs to populate the categories from the database and kept the topic same for the respective categories. so how can i do this?
<form name="questionForm" method="post" action="listQuestions.lgs">
<table bgcolor="F8D8D8" cellspacing="2" cellpadding="2" align="center"
style="margin-top: 100px">
<tr>
<td>Topics:</td>
<td><select name="topic">
<c:forEach items="${model.topics}" var="topic">
<option value="<c:out value="${topic.topicId}" />"><c:out
value="${topic.topicName}" /></option>
</c:forEach>
</select></td>
<td>Categories:</td>
<td><select name="category">
<c:forEach items="${model.categories}" var="category">
<option value="<c:out value="${category.categoryId}" />"><c:out
value="${category.categoryName}" /></option>
</c:forEach>
</select></td>
<tr>
<td><a
href="addQuestion.lgs?categoryId=2<c:out value="${category.categoryId}"/>">Add
New Question</a></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Questions under this Category:</td>
<td><c:if test="${model.questions} == null">
<c:out value="no questions found" />
<br>
</c:if> <c:if test="${model.questions} != null">
<c:forEach items="${model.questions}" var="question">
<table>
<tr>
<c:out value="${question.questionDesc}" />
</tr>
</table>
</c:forEach>
</c:if></td>
</tr>
<tr>
<td colspan="2"><input type="submit" /></td>
</tr>
</table>
</form>
regards,
phani.Hi Rahul,
I followed the link what you have mentioned and i need clarification in regarding this....
function getResponseAction(){
// Verifying State & Status
if(verifyReadyState(xmlhttp) == true){
// Building a DOM parser from Response Object
var response = xmlhttp.responseXML.documentElement
// Deleting all the Present Elements in the Drop-Down Box
drRemove()
// Checking for the Root Node Tag
var x = response.getElementsByTagName("option")
var val;
var tex;
var optn;
for(var i = 0;i < x.length; i++){
optn = document.createElement("OPTION")
var er
// Checking for the tag which holds the value of the Drop-Down combo element
val = x.getElementsByTagName("val")
try{
// Assigning the value to a Drop-Down Set Element
optn.value = val[0].firstChild.data
} catch(er){
// Checking for the tag which holds the Text of the Drop-Down combo element
tex = x[i].getElementsByTagName("text")
try{
// Assigning the Text to a Drop-Down Set Element
optn.text = tex[0].firstChild.data
} catch(er){
// Adding the Set Element to the Drop-Down
document.questionForm.category.options.add(optn)
but in my springframe work i have the controller like this where i am putting category object in the context and i am retrieving this in my listQuestions.jsp like this
<tr>
<td>Topics:</td>
<td><select name="topic" onchange="populateCombo(this.value)">
<c:forEach items="${model.topics}" var="topic">
<option value="<c:out value="${topic.topicId}" />"><c:out
value="${topic.topicName}" /></option>
</c:forEach>
</select></td>
<td>Categories:</td>
<td><select name="category">
<c:forEach items="${model.categories}" var="category">
<option value="<c:out value="${category.categoryId}" />"><c:out
value="${category.categoryName}" /></option>
</c:forEach>
</select></td>
<tr>
package com.lgsglobal.lgsexam.spring.controllers;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import com.lgsglobal.lgsexam.dao.CategoryDAO;
import com.lgsglobal.lgsexam.dao.QuestionDAO;
import com.lgsglobal.lgsexam.dao.TopicDAO;
import com.lgsglobal.lgsexam.hibernate.pojos.Category;
import com.lgsglobal.lgsexam.hibernate.pojos.Topic;
public class ListQuestionsController implements Controller {
private TopicDAO topicDAO = null;
public void setTopicDAO(TopicDAO topicDAO) {
this.topicDAO = topicDAO;
public TopicDAO getTopicDAO() {
return this.topicDAO;
private QuestionDAO questionDAO = null;
public void setQuestionDAO(QuestionDAO questionDAO) {
this.questionDAO = questionDAO;
public QuestionDAO getQuestionDAO() {
return this.questionDAO;
private CategoryDAO categoryDAO = null;
public void setCategoryDAO(CategoryDAO categoryDAO) {
this.categoryDAO = categoryDAO;
public CategoryDAO getCategoryDAO() {
return this.categoryDAO;
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
HashMap mymodel = new HashMap();
List topics = topicDAO.getTopics();
mymodel.put("topics", topics);
if (request.getParameter("topic") != null) {
System.out.println("in topics condition to retrieve questions");
int topicId = Integer.parseInt(request.getParameter("topic"));
Topic topic = topicDAO.getTopic(topicId);
List categories = categoryDAO.getCategories(topic);
mymodel.put("categories", categories);
System.out.println("exiting topics condition to retrieve questions");
if (request.getParameter("category")!= null) {
System.out.println("in category condition to retrieve questions");
int categoryId = Integer.parseInt(request.getParameter("category"));
Category category = categoryDAO.getCategory(categoryId);
List questions = questionDAO.getQuestions(category);
mymodel.put("questions", questions);
return new ModelAndView("listQuestions", "model", mymodel);
so here my issue is like how i can populate categories in the category(dependent combo). so please let me know the solution.
awaiting for reply. for any furthere info please let me know....
regards,
Phani.K
Maybe you are looking for
-
How to save report output in a PDF file and also show preview in one processing cycle
Hi every body, We R re-developing an application from COBOL to Oracle. Using Reports 6i 6.0.8.11.3. The requirement is that whenever a user processes a report, it should be saved on disk say in PDF format. Then it should be shown in Reports Runtime P
-
I tried adding an all values option for the year parameter in the sample sales analysis file under sales manager. I kept getting an error that the value could not be null even though I didn't click that option and could therefore not click on it anym
-
Is it valid to have public processes in 3A4 PIP like 3A7 and 3A8?
-
Recording problems on Vista 64
Hi I need your help: I'm on Vista 64 with an audigy 2ZS and It seems I can't use any of the recording option except Microphon, I have not the same problem as everyone because as you can see all the options are available and displayed. My real problem
-
Powerbook start up problems....AGAIN
hi! about a month back i had start up issues w/my 17" g4 powerbook. i had to have the whole computer wipped out and and have programs re-installed. thought everything was all fine...UNTIL...this afternoon i tried to open an email, stepped away and wh