Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

JSPs & Portlets: Forwarding to a JSP from doView in JSR168

Loading...

Sign in or sign up now!
6,343
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jul 11, 2008

Part 1 of this 2 part tutorial demonstrates how to forward to a JSP, Java Server Page, from a JSR-168 Portlet. The full tutorial can be viewed here:

http://jpa.thebookonhibernate.com/jsr168/index.jsp?link=multi05portletsandjsps

This link also provides the Java Source code, deployable war for JetSpeed/Pluto/WebSphere/LifeRay/OpenPortal, etc.

In a good model-veiw-controller type of application, a Java centric component should never be polluted with lots of lousy html.

With typical servlet and struts based applications, html is usually generated by a Java Server Page (JSP); in this regard, portlet applications are no different.

However, portlet applications do present some unusual complications when deferring to a JSP for markup generation.

How does a JSP link back to a specific portlet on a page? How does a portlet call a JSP? How do we gain access to the portlet specific PortletRequest and PortletResponse object in JSP?

This tutorial deals with basic JSP development, and the issues that present themselves when deferring to a JSP for markup generation.

Please support our site, link to us, buy some books, and remember: Happy Java!

public class JSPDisplayPortlet extends GenericPortlet {

protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.setContentType(request.getResponseContentType());
String url = "/welcome.jsp";
getPortletContext()
.getRequestDispatcher(url).include(request,response);
}

For Hibernate3 & JPA Tutorials and Sample Code: http://www.thebookonhibernate.com

For mock SCJA and SCJP certification exams:

http://www.scja.com/associate

  • likes, 1 dislikes

Link to this comment:

Share to:
see all

All Comments (1)

Sign In or Sign Up now to post a comment!
  • if somebudy can help me...i want to make one jsp page with html table populated from database , and i want in every row of table two buttons: delete and edit, and on click i want some action in that row i am new in jsp/java pls help me if you have some examples =]

Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more