Mail Archive Home | exoplatform List | July 2008 Index
| <-- Date Index --> | <-- Thread Index --> |
I try creating 2 simple portlet, I use Lomboz IDE.
the first: contains 2 *.jsp files
index.jsp
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<portlet:defineObjects />
<center>Helloworld Portlet in <%=renderRequest.getPortletMode().toString()%>
Mode</center>
<center>The current window state is
<%=renderRequest.getWindowState().toString()%></center>
<div>
<portlet:renderURL var="change">
<portlet:param name="haha"
value="/change.jsp"></portlet:param>
</portlet:renderURL>
"<%=change % ">click here to change
</div>
if I click on the hyperlink "click here to change", I want to redirect to
change.jsp
change.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p>change</p>
</body>
</html>
=> the result: when I click on the Hyperlink, It call index.jsp itself
the second: also contains 2 *.jsp files and 1 portlet class
index.jsp
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@ page import="javax.portlet.*" %>
<portlet:defineObjects />
<center>LinkPortlet Portlet in
<%=renderRequest.getPortletMode().toString()%> Mode</center>
<center>The current window state is
<%=renderRequest.getWindowState().toString()%></center>
<%
PortletURL url = renderResponse.createActionURL();
%>
<form name="inputForm" method="POST" action="<%= url.toString()%>">
<input type = 'submit' name = 's' id = 's' value="submit"/>
</form>
temp.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p>hahhahah</p>
</body>
</html>
Linkportlet
package org.objectweb.lomboz.sample;
import java.io.IOException;
import javax.portlet.*;
public class LinkPortlet extends GenericPortlet
{
public void doView(RenderRequest portletRequest,RenderResponse
portletResponse) throws PortletException,IOException
{
WindowState state = portletRequest.getWindowState();
portletResponse.setContentType("text/html");
PortletContext context = getPortletContext();
if (portletRequest.getParameter("s") == null)
{
PortletRequestDispatcher rd =
context.getRequestDispatcher("/index.jsp");
rd.include(portletRequest, portletResponse);
}
else
{
PortletRequestDispatcher rd =
context.getRequestDispatcher("/temp.jsp");
rd.include(portletRequest, portletResponse);
}
}
public void processAction(ActionRequest request, ActionResponse
response)throws PortletException, IOException
{
WindowState state = request.getWindowState();
if (state != WindowState.MAXIMIZED) {
response.setWindowState(WindowState.MAXIMIZED);
} else {
response.setWindowState(WindowState.NORMAL);
}
response.setPortletMode(PortletMode.VIEW);
}
}
=> the result: when I click on the button submit the page can not render, it
cannot load dc the temp.jsp
Somebody help me
--
View this message in context:
http://www.nabble.com/Error-when-I-request-to-another-page-tp18496953p18496953.html
Sent from the eXo Platform mailing list archive at Nabble.com.
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.