Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

Robert Ilin

Greenhorn
+ Follow
since Apr 14, 2020
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robert Ilin

So basically if I would deliver the app to the client I would make a jar that would contain the FXML controllers and views, the proxy and the service? But if providing service to the client doesn't mean that they could mess up the app by reverse engineering? Or am I thinking too far?  Or if I don't include the service Impl thery can't do anything bad to the app? What about the login/registe? Do I need to create another endpoins in the API and POST the username and password?
1 year ago
Thank you very much. Do you have an example of creating a client? And to keep the client in the end user app? Like just one instance? And from the client app I call the service methods?  And maybe a not so related question.. what will prevent the user from using the methods in the service and delete a user from the database with another id for example if I call service methods from user side?

Thank you again
1 year ago
Can you detail more the security problems your are talking about? I don't really understand what you mean by that..
1 year ago

JavaFX FXML is an XML format that enables you to compose JavaFX GUIs in a fashion similar to how you compose web GUIs in HTML.  


Example:



So basically the GUI is buiild using FXML files. Every FXML file should have one controller in which you have direct access to the FXML items (like buttons, labels etc). I thought it's a good idea to store the FXML files on the client side. I don't know why, it seemed correct for me. Do you have another option? Please let me know. I'm willing to learn as much as possible since I haven't developed another client-server type app till now.

Ok, now I'm going to detail how my app should work. The user will have to login/sign up in the app first (like I've asked in the first post, I want to know where I should put the logic behind the log in mechanism. Like I said, the FXML controller should only be responsible for passing infos between the view and the service. Please tell me if my logic is good. So in the database I will have the table User.

After Sign up/ log in the app should show content specific to the category to which the user belongs (beginner / intermediate / advanced). The level of experience of the user will be determined by a Sign Up quiz.
Here comes another question. I will keep learning material in simple .txt files like:
I will have a filled called Structure.txt with the following format
ChapterName Lesson1 Lesson2...LessonN. So it will have multiple lines (one line for every chapter). I think this is a good approach for later modifications of the content (I won't have to modify the code, but only the files). So there will be one of this structure file for every category (3 in total). Next every lesson will be in its separate file like : Lesson1.txt. When the user log in, the app should load the associated files based on user level and build the GUI. Now, where these files should be saved? I don't think it's a good idea to store on user side. And if I store them on server side, how do I do to load them from the client app? Should I have some methods in the server? For server side I ve seen that it usually uses a REST API for database operations. So should I implement these load_file operations in the REST API? Please make me understand.
In the database there will be another table, like user_completed_lessons which will information about the user progress, like when the user complete a lessons I will insert a record in this table (user id + lesson id). I will use this to change the GUI accordingly (like check marks on completed lessons).
There will be a testing section too.. But I will not go into details. The mechanism is similar.


My biggest dilemmas are how to access the service in the client application and the part with loading files in th GUI.

I would appreciate if you could give some directions.

Thanks
1 year ago
In Java String objects are immutable. That basically means that you can't change the content of a String object.  Everytime you call methods that "modift" String content, the program actually creates a new object and assigns it to the object you are trying to modify. String builder is a faster alternative when you need to create String objects by appending characters one by one since it doesn't create a new object everytime. But if you say you can't use StringBuilder I suggest you this approach:

1 year ago
There is no point using System.out.println() method if you return an empty string. You could either make the method void and print the characters one by one:



and call it like:



OR (Which iseems the right way for me)


and call it like:



and don't forget to close Scanner resource in the end:


1 year ago
I m developing an E-learning app using JavaFX. I started by having just one app - all the database operations are executed on client side. From what I ve read this is not a very good approach so I ve decided to separate the client side from the server side. So in the client app there will be the FXML files with their associated controllers. The server will contain the logic behind. From what I ve read the server app will be structured as follows: a persistence layer - which will take care of DAO operations and only that and a service layer which will take care of business logic. Here's come my question. Let's assume a simple situation like when the user attempts to sign up. First I need to verify if the username already exists in the database, next to check if password match etc (validations). Where should I put these validations. Basically in the controller class I think there will be a call to a method of service layer (so I don't make any validations in the controller class - the controller class is only responsible for transferring information from the view to the service). Correct me if I am wrong. I would appreciate if someone could tell me the right way of that mechanism
1 year ago

Stephan van Hulst wrote:I can give you a quick start. You just need to tell me which application server you want to use. Tomcat is usually enough for most web applications.


Tomcat is ok. Can you provide me a quick start please?
1 year ago
Thank you. And could you please give me some directions or some good tutorials for developing a web service and a client using the web service? I haven t developed a web service before, but I have some experience with Java. And I don't know where to start. I would appreciate if you would give me some suggestions, maybe how to develop a simple web service to start with and then moving to my app..
1 year ago
And one more thing. I was talking about those config files, basically those files will contain the learning material structured in chapters and lessons. I thought this is a good approach since if I want to modify some content I don t need to modify the code but only the files. So basically I thought about a mechanism in which the app will load these files and create some object stored in arrays (e.g a chapter object or a test object) and use it to draw the java fx interface whenever a resource is needed ( for example if the user access the learning section the app will use the chapters array which was created on startup and generate the java fx view dynamically). Is it a good approach to load all the content of the config files on startup or do you suggest a better approach? Or maybe a better approach for keeping the chapters and the tests? So basically in my approach, when the client app start it will call some server method to populate these arrays of objects and then iterate through it to draw the associated java fx view when needed.

Thanks
1 year ago
Could you give me some suggestion for how to use Maven (or a tutorial)? I haven t used it before. And if the projects are separated, how will I access the classes from the library project let s say in the Client app?

Thanks
1 year ago

Stephan van Hulst wrote:Sure, a REST API is one way to do it. You can use JAX-RS to communicate between the client and the web service. For the service, use the annotations defined in javax.ws.rs. You can create a client using ClientBuilder.

If you run the service in Tomcat, you can use Jersey as the JAX-RS implementation.

I've also found something called EclipseLink JPA-RS, which seems to be a technology for quickly setting up a web service for the sole purpose of interacting with a database. It might be just what you're looking for, but personally I'm wary of it because I don't like my web API to be so tightly coupled with the database.



So basically the web service acts as a 'server'? The server and the client app should be 2 different projects in Eclipse or in the same project? And another thing the content of the learning app will be generated dynamically based on some config files. Where to store these config files? I don t think it s a good idea to store them on the client side app because I don t want the client to access these files.

Thanks
1 year ago
Hello all. My goal is to develop an e learning app. The will use a MySQL database. The database will store user details (such as username, email etc) and also results (a result row contains userid, testid and score). By now I developed the GUI using JavaFX and also database operations. Here comes the problem: since the app will be multi user, from what I ve read it's not good to have database operations inside client app. So if anyone could tell me some directions on how could I separate the client app from server app. Does server means a REST API between client app and  database? I think there s not a good idea to have database operations coded into client application.. so I think the client app should only call some server methods, am I right?
1 year ago
I have a JavaFX with 3 scenes, let's call them A, B, C. From scene A I go to scene B by pressing a button. From scene B i go to scene C in the same manner. Now comes the problem. In the C scene I need the data from a text field that is in A scene. I tried creating a class member field in C controller and setting it from A scene but it doesn't work, since to go to scene C I call the load() method in scene B ( so basically it's a new instance of C controller).
1 year ago