Emir Rayhan

Greenhorn
+ Follow
since Jul 08, 2020
Indonesia
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
11
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Emir Rayhan

Campbell Ritchie wrote:

Emir Rayhan wrote:. . . volumeUp() will be declared in Main class.

Afraid that is a bad idea. The volume isn't anything to do with the Main class (I think that is a bad name, but that't something unrelated), nor is it a feature of a Radio class. It should be a feature of a Radio object, so it shouldn't be static.



Thank for the tip Campbell. This is totally for practicing purpose so I wasn't thinking that far.
1 week ago

Carey Brown wrote:

Emir Rayhan wrote:

This means you have an array of 5 volumeControls. Do you want to loop through these to find out the max volume that is set?


Can you explain what you are trying to do with volumeUp() ?



Yes I wanted to maximize the volume until 5 maximum, but I am not sure if it is the right statement.

Apologize for not informed it before that there are 2 separate classes at the moment, volumeUp() will be declared in Main class.
1 week ago

Carey Brown wrote:Computing the max value in an array involves a simple for loop to visit each element. Show us what you've tried so far.

Not sure why you tossed in volumeUp() method. Where does that fit in to your requirements? I'm surprised to see this method implemented as "static". Is this a  "master" volume control?



I have just created this line of codes so far

As expected, the value of n does not added up because of not using loop. I was thinking to use loop, but how do I print the value one by one each time the program is run?
And what about the static method? Should i just ignore it?
1 week ago
I randomly practicing my OOP logic fundamental.
In this case, I was creating a class object contains of Phone features. I want to determine the maximum volume until 5. I was trying to include array for this matter as follows:



and the method for volume up



There certainly red line on the method up above. I was not quite sure with the methods I used, but I know that array is one the solution for this case. I need advice.
1 week ago

Tim Moores wrote:The obvious starting point is Oracle's Java Tutorial. https://www.tutorialspoint.com/java/ and https://www.javatpoint.com/java-tutorial are also worth checking out.



Hi Tim, so you pointed out 3 sites for Java tutorial. Does any of them has more advantages than the other?
2 months ago

Campbell Ritchie wrote:The Java™ Tutorials are the most comprehensive resource I have seen, but they use the old technique of putting code in the main method. That was the most convenient way to run a block of code as such before JShell, but it doesn't teach OO programming. I have never seen a really good tutorial on line.



So what is your personal review on w3school for Java or any language you ever did?
2 months ago
Thank you for all responses!
2 months ago
i have known and been using Java for a year. I have been doing few web application projects using JSP and Servlet, with assistance of course. And then i realized that I only have so little understanding about Java core, logic, structure etc. I really want to understand Java structure from the beginning to be able to implement the logic using the language.

I have few online tutorial such as w3school as a platform from me to learn. But, there are so many opinions about the website tutorial whether it is worth the time or not.

Does anyone have the recommended online tutorial for learning core java? Especially free tutorial would really suffice.
2 months ago

Paul Clapham wrote:

Emir Rayhan wrote:My question is, what is the concept of the validation?



That's my question too. It seems that you want to validate the e-mail address which was sent from the client side somehow, but I don't see anything which tells me what validation you want to do. If you had something in mind, then by all means tell us what you need to check for. However if your question is "Should I validate an e-mail address?" then my answer would be "No." Not unless you have some limitations like "It has to be an e-mail address belonging to my company". Otherwise the user's e-mail address is what they say it is and you don't really have any business rejecting it.

And also, that looks like Java code. It isn't HTML or CSS or JavaScript, so I'm going to move it into a forum about Java programming. It looks like it might belong in a servlet so "Servlets" looks like a good forum.



Hi, Paul. Apologize for not making it clear as possible. FYI, my system is just for practicing purpose and does not interfere with any company's related. What I am trying to do is to create validation inside the servlet, to avoid making similar email address twice while saving the value passed to the database table. That is also why i only send few codes that i thought related to my questions. But i have not found the concept or logic to execute it.
I have a user registration JSP form &  servlet that input to my database, i want to have validation for every registry to prevent user using the similar email that has been saved inside the database.
Below is the code for register email to database:


My question is, what is the concept of the validation? and how should I put the logic inside the code? Thank you
Thank you for the responses! I have taken a look deeper on my source and apparently  found that there are variables in my header.jsp that blocking the variables of other pages.

Paul Clapham wrote:

Emir Rayhan wrote:Yes the HTML and CSS works properly. Although, it did not show the end result i esxpected when i run the file.



And did you look at the page source in the browser to see if the JSP had been included as you expected? Or use the browser's tools which allow you to inspect elements and the CSS used to render them?



Both Header bar page as a layout and the other page in image 3 are included. Yet, i cannot control the data there to be where i exepected.

Ron McLeod wrote:

When I render your markup on my browser, I see this:


Are you expecting it to show as something like this?:



I'm sorry, I cannot see the image you sent.

Paul Clapham wrote:T
Have you already established that the HTML and CSS works correctly, except when you include it from JSP it doesn't work correctly?



Yes the HTML and CSS works properly. Although, it did not show the end result i esxpected when i run the file.
I'm currently trying to link a JSP file that i have made which contains CSS style for Header bar. The Header bar is a template for every JSP file in the future made. Unfortunately it did not show the result i expected. The HTML showing irregular results. I will breakdown every step as clear as possible.

In image 1, you can see that I set "example" word as an example for further image.

As you can see, in image 2, the word i used in header.jsp is showing on the place i wanted to be. You can judge by the scroll on the right is right at the top.

Then, i created new JSP file for another page that include header.jsp for the Header bar. Below are the codes:



and resulting as in image 3. You can judge the scroll on the right is right at the very bottom.

I want the data in image 3 to be right at the top such as the result in image 2

How can I fix the syntax above to show it properly?

Thank you

Note: i apologize if images did not show efficiently due to lack of understanding. Therefore i attached the images instead.
4 months ago
JSP