Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Shagun Bhardwaj

Greenhorn
+ Follow
since Feb 15, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shagun Bhardwaj

Hi Paul,
I ran the application on my workstation at my workplace, I asaked my friend on the same domain to him the http://<IP-ddress>:8080/<Application-Name>/Home.html but he got a message 'page not found'.
But at my workstation , it was working fine.

Hi Ivan,
I used ipconfig to get my ip address.


Regards,
Shagun Bhardwaj
7 years ago
Does anyone know about it ?
7 years ago
Hi,

I am running a web-application on Tomcat 7 on my computer.
I want my collegues in my company on the same network to have access to this applicaion. How do I do that ?

Note: http://<IP-ddress>:8080/<Application-Name>/Home.html did not work.

Regards,
Shagun Bhardwaj
7 years ago
thanks
I'll try implementing it..!!

Regards
Shagun
Dear,

Nothing is working..may be because i tried doing stuff to early.
I tried doing what you advised in the last post but thats also not working..!!

But thanks for such an intensive help.

Regards
Shagun
I have BeerSelect.java in model folder
and BeerExpert.java in web folder

The command finally got executed and the first error was removed.

Now it says :-

javac src/com/example/model/BeerExpert.java -d classes

Note: src\com\example\model\BeerExpert.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.



javac src/com/example/web/BeerSelect.java -d classes

src\com\example\web\BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src\com\example\web\BeerSelect.java:14: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be=new BeerExpert();
^
src\com\example\web\BeerSelect.java:14: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be=new BeerExpert();



And,I have not given any exams but I am trying my hand on java JSP to get a taste of it.I want to pursue it as my career in web/application-development and I am not sure which direction to go in.I will be completing my B.tech(Computer Science & Engineering) in April this year.So,before I go for any further course I wanted to check myself with a taste of it.Also,If you can guide me with something related to this..please do so..??

Regards,
Shagun
My current directory is My projects

C:\Documents and Settings\user\Desktop\My Projects



I typed

javac src/com/example/model/BeerSelect.java -d classes



The result was

javac: file not found: src\com\example\web\BeerSelect.java
Usage: javac <options> <source files>
use -help for a list of possible options

I did what was said in that post and that error was resolved.
Now it says

javac:file not found.


But,I have checked the file there.
It is gives a message

'javac' not recognized as an internal or external command

I have understood you point 1
But as for point 2,

I have a My projects folder on the desktop

C:\Documents and Settings\user\Desktop\My Projects



This folder has only one project BeerV1 with the following file structure

BeerV1

  • etc
  • lib
  • src

  •     com
          example
            model-->BeerExpert.java
            web--->BeerSelect.java
  • web
  • classes

  •     com
          example
            model-->BeerExpert.class
            web--->BeerSelect.class



    And,In command prompt

    C:\>
    C:\>set CLASSPATH


    The result is

    CLASSPATH=C:\Program Files\Java\apache-tomcat-7.0.6\lib\servlet-api.jar



    Now I need to complie BeerSelect.java to get the BeerSelect.class file which I need for the deployment of my web app.How to proceed ??
    The last post had a small correction
    The model class I am using is-BeerExpert.java

    And the controller class i am using BeerSelect.java

    Now can you check if it works on your machine ??

    And I also tried using the apache-tomcat class path you have given in the previous path to compile the code..it gives the same errors,rather some more.

    I am new totally new to server programming and java ranch,so a lot of mistakes even in posting and thanks for your help,I really appreciate it.Please reply soon.

    Regards
    Shagun

    BeerExpert.java code




    --------------------------------------------------------------------------
    BeerSelect.java code




    -------------------------------------------------------------------------------------------------------

    These are the two classes.Now when I compile BeerSelect.java in jdk/bin folder,which contains both the java files,it gives me the error message "package com.example.model.* doen not exist."
    I compliled the code using javac BeerSelect.java

    My program directories are as follows :-

    C:\Program Files\Java\jdk1.6.0_23\bin\BeerSelect.java
    C:\Program Files\Java\jdk1.6.0_23\bin\BeerExpert.java

    and next time i'll remember to use the code tags.
    And what do you mean by posting the ontroller code twice..how can it be resolved.I am using the .java and .class files in the bin directory and then I am copying it to my tomcat and projets directory as and when required.Is this was you meant..??

    Shagun
    Hi,

    I was trying to implement MVC model in which I made a controller servlet was as follows

    package com.example.web;

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;

    public class BeerSelect extends HttpServlet {
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException {
    response.setContentType("text/html");
    PrintWriter out=response.getWriter();
    out.println("Beer Selection Advice<br>");
    String c=request.getParameter("color");
    out.println("<br>Got beer color "+c);
    }
    }


    and the model-java class was as follows

    package com.example.web;

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;

    public class BeerSelect extends HttpServlet {
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException {
    response.setContentType("text/html");
    PrintWriter out=response.getWriter();
    out.println("Beer Selection Advice<br>");
    String c=request.getParameter("color");
    out.println("<br>Got beer color "+c);
    }
    }


    But when i compile the BeerSelect.java class I get a major error- package com.example.model.*; does not exist.

    Please help

    Shagun
    Thank you so much. It is working..!!
    Thanks a lot

    Regards
    Shagun