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
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 =]
igor86SRB 2 years ago