Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 14 of 14

Thread: I need some advice

  1. #1
    Member
    Join Date
    Sep 2013
    Posts
    101
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Default I need some advice

    I program in java, I know C++ to an extent. I have even written some features to Intel's assembly, however I have not touched any web based programming. I want to know realistically going into that world should it be simple? I am going to look through some stuff and even purchase a domain to mess around, but I suppose I'll post a few things that I am pondering.

    A) Does the browser just call a specific method/command when directed to your site? Like Java's main method?

    B) Won't all my code be read by the browser (essentially making theifary simple)?

    C) Are their global interfaces or the like I can rely on?


  2. #2
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,225
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: I need some advice

    Technically I wouldn't consider HTML/CSS a programming language in that it is syntax/structure driven more than variable/condition/function driven. The syntax is fairly easy to learn, but can get difficult the deeper into it you go (especially when trying to create consistency from one browser to the next). A webpage is based mainly upon text - for instance HTML, CSS, and javascript. A browser requests a URL and downloads this text and then renders it to the user. The programming aspects comes into play when a webpage changes based upon user input, either using client side scripts which typically are used to modify the 'DOM' (eg javascript) or server side (one ore more of php, jsp, j2ee, sql, etc...) which creates dynamic content sent to the client

    A) Does the browser just call a specific method/command when directed to your site? Like Java's main method?
    The browser reads the text (html/css/javascipt) from a website URL and renders the result. It also interprets any script code provided

    B) Won't all my code be read by the browser (essentially making theifary simple)?
    In part. Anything sent to the client is available to the client. Server side code is not read by the browser, but client side code is (eg javascript)

    C) Are their global interfaces or the like I can rely on?
    Not sure what you mean by 'interface'. There are web templates available that provide a basic html/css template to work from.

  3. The Following 2 Users Say Thank You to copeg For This Useful Post:

    KAJLogic (June 1st, 2014), KevinWorkman (June 5th, 2014)

  4. #3
    Member
    Join Date
    Sep 2013
    Posts
    101
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Default Re: I need some advice

    Not sure what you mean by 'interface'. There are web templates available that provide a basic html/css template to work from.
    Your reply has helped me. By interface I meant some standards I can rely on, as in, some standards like a web based version of ASCII (obviously I will need access to certain ASCII vars as well) to give me access to certain things.

  5. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,407
    My Mood
    Mellow
    Thanks
    143
    Thanked 603 Times in 590 Posts

    Default Re: I need some advice

    You might also investigate "web frameworks" or those specific to Java.

  6. #5
    Member
    Join Date
    Sep 2013
    Posts
    101
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Default Re: I need some advice

    In part. Anything sent to the client is available to the client. Server side code is not read by the browser, but client side code is (eg javascript)
    I assume though with web page applets the code is unsafe correct? I understand if I use something like Java web start I will be simply transmitting output, but If I use JApplet then the browser actually parses my compiled code correct?
    Last edited by KAJLogic; June 2nd, 2014 at 10:27 PM.

  7. #6
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,225
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: I need some advice

    Quote Originally Posted by KAJLogic View Post
    I assume though with web page applets the code is unsafe correct? I understand if I use something like Java web start I will be simply transmitting output, but If I use JApplet then the browser actually parses my compiled code correct?
    Either way, the code is ran on the client's JVM. As a result, the client must download the necessary java/jar files in order to do so.

  8. #7
    Member
    Join Date
    Sep 2013
    Posts
    101
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Default Re: I need some advice

    Either way, the code is ran on the client's JVM. As a result, the client must download the necessary java/jar files in order to do so.
    I was under the impression Java web start just gets output form the server? Your saying java web start actually downloads the code?

  9. #8
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,225
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: I need some advice

    Quote Originally Posted by KAJLogic View Post
    I was under the impression Java web start just gets output form the server? Your saying java web start actually downloads the code?
    All required jar files are downloaded and ran on the client JVM.

  10. The Following User Says Thank You to copeg For This Useful Post:

    KAJLogic (June 17th, 2014)

  11. #9
    Member
    Join Date
    Sep 2013
    Posts
    101
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Default Re: I need some advice

    Okay, so my first impulse is to make a java website. By this I mean construct buttons and all that rot through java. Is this practical, or should java only be used when necessary?

  12. #10
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,225
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: I need some advice

    Quote Originally Posted by KAJLogic View Post
    Okay, so my first impulse is to make a java website. By this I mean construct buttons and all that rot through java. Is this practical, or should java only be used when necessary?
    Not sure what you mean - a basic website (with buttons and all that 'rot' - for instance what you see when you visit these forums (presuming you are doing so through a typical web browser)) is typically constructed using html/css/javascript. Programming comes into play when making that content dynamic - in which case the programming language of choice (be it java, php, perl, or what have you) responds to user input (or lack there of) by spitting out different html/css (and maybe even javascript). You can use java for this, in which case you would need a container (google 'Tomcat') and server running that container. Just my opinion, but this can get quite heavyweight for smaller projects, and may be more appropriate for enterprise software applications - other languages (eg php) may be more appropriate when designing smaller websites outside this domain for their availability and ease of use. And if you don't intend on creating dynamic content a language on the backend/frontend may not be necessary - just hard-code the html/css. Of course, it's not clear what your goals are so take this advice based upon the context - perhaps clarify what your goals are

  13. The Following User Says Thank You to copeg For This Useful Post:

    KAJLogic (June 18th, 2014)

  14. #11
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,166
    My Mood
    Hungover
    Thanks
    141
    Thanked 597 Times in 512 Posts

    Default Re: I need some advice

    Everything that copeg has said is correct, but to maybe help you understand a little better: there are a few different parts to "web development", and I think you're blurring the lines between them.

    There is html/css/javascript, which is what the client sees. You can write html/css/javascript directly in a text editor, then open that file up in a web browser to see the website you just made. This is probably where you should start.

    There is server-side web development, which can be Java EE, or php, or any number of languages and frameworks. The server-side does things like dynamically create pages (so you can have, for example, different pages for different viewers). The client doesn't see this part at all. Basically, the server-side *serves* the user html/css/javascript instead of you creating it by hand. Note again that the client still only sees html/css/javascript, not any of the server-side stuff.

    So when somebody says "I created a website using Java", chances are they're talking about the server side of things. That doesn't mean they're using Swing to create buttons and text areas. They're using Java EE to put together html pages, and those html pages contain html buttons, text, whatever.

    You can also deploy Java applications over the web, but that's not the same as "creating a website using Java". That's simply giving the user a download link to a jar. Again, that link will be in html, and that html might have been created by Java code running on the server. Java applets are basically dead now, but they're really just another way to run a jar.

    So if you're asking whether it's a good idea to create a website in Java, it depends what you mean. I think you're talking about writing the client-side of your website in Swing (or AWT or JavaFX), which is a terrible idea. Write html/css/javascript. Maybe use Java on the server side to make it dynamic.

    There is something called GWT which allows you to write Java code that compiles to javascript, but I think you should focus on the basics first.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  15. The Following 2 Users Say Thank You to KevinWorkman For This Useful Post:

    copeg (June 17th, 2014), KAJLogic (June 18th, 2014)

  16. #12
    Member
    Join Date
    Sep 2013
    Posts
    101
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Default Re: I need some advice

    Quote Originally Posted by KevinWorkman View Post
    Java applets are basically dead now
    This is the kind of stuff I love to know; what makes talking to java pros nice makes me feel clued in (do any of you have a blog?). What made applets less desirable? All the security limitations?


    Okay, so can I set up a key listener without running an applet?
    *EDIT* I see now the browser seems to have some default key listener. Let me just clarify something, essentially the browser is a program reading pseudo code from me to provide desired results, and JNLP and applets are used to bridge the gap from the browser to java/any language you are using-is this correct?


    And, now I have another question sorry guys I don't mean to spam. I was wondering how can I preload images with HTML or javascript so I don't have to do this:

    .image_loader {
        position: fixed;
        top: 900px;
        right: 515px;
    }


    I know that is some of the sloppiest shit ever, but I don't know how to load an image without displaying it.

    Additionally, is there a more smooth way to remove an image than redrawing? I want an image to go away after an event, but how can I achieve this without having to redraw the whole page?
    Last edited by KAJLogic; June 18th, 2014 at 05:09 AM.

  17. #13
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,166
    My Mood
    Hungover
    Thanks
    141
    Thanked 597 Times in 512 Posts

    Default Re: I need some advice

    Quote Originally Posted by KAJLogic View Post
    This is the kind of stuff I love to know; what makes talking to java pros nice makes me feel clued in (do any of you have a blog?). What made applets less desirable? All the security limitations?
    The security "features" are a big part of it. The way browsers treat applets (showing tons of scary warnings, etc) is another reason. And now, for your applet to work, your users either have to change their security settings, or you have to pay money. And they'll still get big scary warnings. Think about it this way: how many applets do you use over the course of a day? The answer is probably zero. It's a sad truth, but a truth nonetheless.


    Quote Originally Posted by KAJLogic View Post
    Okay, so can I set up a key listener without running an applet?
    I'm not really sure what you're asking here. Stop thinking in Java. What specifically are you trying to do? This might be a javascript question, but I'm not a javascript guy.

    Quote Originally Posted by KAJLogic View Post
    *EDIT* I see now the browser seems to have some default key listener. Let me just clarify something, essentially the browser is a program reading pseudo code from me to provide desired results, and JNLP and applets are used to bridge the gap from the browser to java/any language you are using-is this correct?
    Again, not sure what you're asking here. The browser reads html/css/javascript to display stuff and interact with the user. It's not pseudocode. JNLP and applets are simply ways to run Java from the browser- it's not much different than simply downloading a .exe file.

    Quote Originally Posted by KAJLogic View Post
    And, now I have another question sorry guys I don't mean to spam. I was wondering how can I preload images with HTML or javascript so I don't have to do this:

    .image_loader {
        position: fixed;
        top: 900px;
        right: 515px;
    }


    I know that is some of the sloppiest shit ever, but I don't know how to load an image without displaying it.
    Why do you think you need to preload images in html? What are you trying to do? Again, this is probably a javascript question. Start with the basic tutorials: JavaScript Tutorial

    Quote Originally Posted by KAJLogic View Post
    Additionally, is there a more smooth way to remove an image than redrawing? I want an image to go away after an event, but how can I achieve this without having to redraw the whole page?
    Again, this is a javascript question. Other than the name, javascript and Java have very little in common.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  18. The Following User Says Thank You to KevinWorkman For This Useful Post:

    KAJLogic (June 20th, 2014)

  19. #14
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,225
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: I need some advice

    What made applets less desirable? All the security limitations?
    Try running an applet on a mobile device...you will quickly find out that most (if not all?) do not support applets. Would a web developer wish to exclude a huge (and increasing) percentage of their audience?

    I was wondering how can I preload images with HTML or javascript so I don't have to do this:

    ....
    Additionally, is there a more smooth way to remove an image than redrawing? I want an image to go away after an event, but how can I achieve this without having to redraw the whole page?
    Its often not worth it to worry about things like 'preloading'. If you wish to add or remove an image without reloading the page, you alter the DOM (eg html/css) using a script (eg javascript). Something like jQuery makes doing so much easier, with the added capability of using effects (eg fade in/out) - but to use jQuery I recommend knowing the basics of javascript (see link Kevin posted)

  20. The Following User Says Thank You to copeg For This Useful Post:

    KAJLogic (June 20th, 2014)

Similar Threads

  1. Hello there + need a little advice :)
    By IWantBacon in forum Member Introductions
    Replies: 2
    Last Post: November 30th, 2013, 10:24 AM
  2. Need advice
    By hankog in forum Java Theory & Questions
    Replies: 3
    Last Post: November 22nd, 2013, 12:27 PM
  3. Need some serious advice
    By Rituparna in forum The Cafe
    Replies: 4
    Last Post: September 25th, 2013, 08:26 AM
  4. Advice
    By keepStriving in forum Java Theory & Questions
    Replies: 5
    Last Post: May 5th, 2013, 12:02 PM
  5. i need some advice ....
    By mdstrauss in forum Java Theory & Questions
    Replies: 8
    Last Post: July 24th, 2009, 02:29 PM