Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

populating the data from array list

 
charishma gottumukkula
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem in populating the data from arraylist .i have two tables category and books .when i click category all the categories of books should be displayed and when i click on one of those categories all the books under the category should be displayed.please can someone help me with this
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would love to help out, but with the limited information that you have provided I would not know where to start. Do you need help designing the user interface? If not then can you describe in more detail what the interface looks like and how it flows. If you already have the user interface in place, how far are you into the implementation? Do you have any existing code that you could share to provide more insight? Are the specific issues ore questions that you have?

- Brent
 
charishma gottumukkula
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am creating a small library application and using DB to get the data.i have login page ,if the loginname and password are correct then it should enter into category page .in that page when i click on category then all the categories should be displayed and when i click on one of the categories option all the books under that particular category should be diplayed,
i want to use dynaactionform for this and i am using DATA ACCESS OBJECT to connect to database
 
Krish
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charishma,

I implemeted similar kind of thing in my project.While you are getting the display all the categories of books in one combobox.suppose i used a helper class which can hold the data colleted from the database.

my helper class looks like,

public class MyHelper {
private String value = null;
private String label = null;

public MyHelper(String value, String label) {
super();
this.value = value;
this.label = label;
}

}
 
Krish
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charishma,

I have implemeted similar kind of thing in my project.While you are getting the page display all the categories of books in one combobox.suppose i used a helper class which can hold the data colleted from the database.

my helper class looks like,

public class MyHelper {

private String value = null;
private String label = null;

public MyHelper(String value, String label) {
super();
this.value = value;
this.label = label;
}
public String getValue() {
return this.value;
}
public String getLabel() {
return this.label;
}
}

In My JSP,

<html:select property="categoryname" value="<%= (String) session.getAttribute("cat_id") %>" onchange="getBookname(this)" >
<html ption value=""> - Select - </html ption>
<html ptions collection="scenarionamelist" property="value" labelProperty="label" />
</html:select>

<html:select property="bookname" value="<%= (String) session.getAttribute("bookid") %>" onchange="getscriptdata(this)" >
<html ption value=""> - Select - </html ption>
<html ptions collection="bookslist" property="value"
labelProperty="label"/>
</html:select>



onchage call a javascript method, passing cat_id as a parameter that will
invoke a method in my action class for getting the book names associated with the category.

Regards
Murali.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "when i click on category" mean? Is category a link, a button, or a list? Does this jump the user to a new page that shows categories? If not, then does the existing page refresh to show the matching categories or are you using ajax or javascript to show the list of categories without refreshing the entire page? Depending on how you want the user interface to work, the solution can be quite different.

- Brent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic