• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

link html to controller

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I want to link a jsp page to a controller, but it doesent work. I�m greatful for all the help I can get.

Here is the link code from the jsp:
<a href = "Logout"> Logout </a>

Here is the code from the controller:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

HttpSession session = request.getSession();

String loggedOut = "/pages/loggedout_text.jsp";

RequestDispatcher view = request.getRequestDispatcher(loggedOut);
view.forward(request, response);
System.out.println("Hej");
session.invalidate();
}

Here is the code from from the loggedout_text.jsp:
Error
<p />
You are logged out.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cecilia Stesser:
I want to link a jsp page to a controller, but it doesent work. I�m greatful for all the help I can get.



What doesn't work?
What errors are you seeing?
What IS happening?
 
Cecilia Stesser
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not getting any error messages, just a blank page.

But I know that my jsp sight doesent get a connection with the controller (Logout) page, because my sysos in the Logout isnt even written out.

I have checked my xml and that seems to work fine.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first thing I do when I see a blank page is use the browser's 'view source' feature to look at what's really coming from the server, if anything.

Often this a simple HTML error like a missing quote or a script tag that wasn't closed properly.
 
Sheriff
Posts: 67693
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<a href = "Logout"> Logout </a>

That doesn't look like a properly formed URL to your servlet to me.

How did you map the servlet in web.xml?
reply
    Bookmark Topic Watch Topic
  • New Topic