I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
If you want to connect database with your java application then first to need a database. First to create database using Netbeans services tab. This tab available under Windows tab. You can also select this tab by using shortcut CTRL+ 5.
2. Fill fields which are shown under diagram.
3. After filling the form, you have to create database successfully.
4. Right Click on your connection string name, select properties for copy the database URL.
- Expand the databases tab, select "Create Database." option.
3. After filling the form, you have to create database successfully.
4. Right Click on your connection string name, select properties for copy the database URL.
5. Copy Database URL, which is used further.
6. Create a new java project under projects tab.
7. Add a Library in the "Libraries" section of your project.
8. Select Java DB Driver under Add Library section.
9. Open your .java file which is exists in java packages folder of your project.
10. Create a another class object, which is exists in same package.
11. Now, Open the object class, create constructor in it.
12. paste the code under the constructor.
Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/jk", "jk", "jk");
System.out.println("connection created");
Here we have three parameters in getConnection method.
First refer to database url ; according to 5th step.
Second : Username
Third : password.
Comments
Post a Comment