File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes populating the data from array list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "populating the data from array list" Watch "populating the data from array list" New topic
Author

populating the data from array list

charishma gottumukkula
Greenhorn

Joined: Nov 06, 2006
Posts: 20
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

Joined: Feb 08, 2006
Posts: 948
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

Joined: Nov 06, 2006
Posts: 20
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

Joined: Oct 27, 2006
Posts: 3
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

Joined: Oct 27, 2006
Posts: 3
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

Joined: Feb 08, 2006
Posts: 948
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: populating the data from array list