Results 1 to 2 of 2
  1. #1
    shafidah is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default Unable to access servlet after publishing website

    Hi I need help :(

    I'm trying to deploy a website via an interface called cpanel that is provided by the hosting co.

    The directories I have at the moment are:
    - public_html
    - images
    - WEB_INF
    - classes
    - lib

    My JSP files are in the public_html folder and servlets are in the classes folder.

    On my home.jsp i have the following form:
    <form name='LoginForm' action='servlet/UserLogin'> ... </form>
    (initially I wrote the action attribute as='UserLogin' but it returns an error saying resource is not found. According to e hosting co I need to specify the action attribute as above. Its kinda strange as I dont have a servlet folder to begin with. Anyway it works.)

    So upon submission of the form I'll get to the UserLogin servlet. At the end of the servlet, I used the following to return control to my home page:
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/home.jsp");
    dispatcher.forward(request, response);

    But this will take me to www.domain.com/servlet/home.jsp which is non-existent.

    Any idea how I can resolve this? My hosting co doesnt seem to know what theyre doing.. unfortunately.

  2. #2
    akiravelmont is offline Member
    Join Date
    Mar 2011
    Location
    bangalore
    Posts
    61
    Rep Power
    0

    Unhappy

    could you please try this code in RequestDiaplatcher

    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/public_html/home.jsp");
    dispatcher.forward(request, response);



    just check it even i am not 100% confident on this.

Similar Threads

  1. Replies: 0
    Last Post: 12-24-2010, 08:33 AM
  2. how to run servlet from a real website
    By mr_anderson in forum Java Servlet
    Replies: 0
    Last Post: 12-01-2010, 01:21 AM
  3. how to login to website to get access using java?
    By theChameleon in forum Advanced Java
    Replies: 0
    Last Post: 10-29-2010, 06:20 PM
  4. JSP Unable to access the third party libraries
    By VJSFDeveloper in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 09-08-2008, 04:57 PM
  5. Unable to Run Servlet
    By basark in forum Java Servlet
    Replies: 4
    Last Post: 07-11-2008, 08:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •