on 10-06-2004 3:38 PM
Hi,
I try to create a page the is redirected to another page, but don't work.
What can I do? When the page is redirected the top level navigation must be refreshed?
I write this code:
IPageContext myContext = PageContextFactory.createPageContext(request, response);
if (myContext == null) {
System.out.println("htmlb service did not start up as expected.");
}
String URL = path to page in PCD;
Document mydocu = myContext.getDocument();
mydocu = myContext.createDocument("Pagina da redirigere");
mydocu.setHeadRawText("<meta http-equiv=\"refresh\" content=\"1; url=" + URL + "/>");
Anybody can help me?
Thanks in advance.
regards,
Stefano
Got it to work using some javascript:
response.write("<script language='javascript'>top.location.href='http://www.google.com';</script>");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the following code to do a redirect. The new URL will load in the entire window (not in content area).
From within your DynPage:
IPortalComponentRequest request=getRequest();
String url="http://www.google.com";
request.redir(url);
javadoc for redirect is to be found here:
Johan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried that and it did not work. Is it because I am trying to write a Java iView instead of a WebDynPro? Here is my sample class:
public class ExternalURLiView extends abstractPortalComponent{
public void doContent(IPortalComponentRequest request, PortalComponentResponse response){
String url="http://www.google.com";
request.redirect(url);
}
}
Hi,
You can make a call to the JS method doNavigate of the EPCF, here is an example.
parent.EPCM.doNavigate('ROLES://<locationOfYourPage>,0,null,null);
You can put this in the onLoad event to get it triggered right when the iView is loaded. This will refresh the Top Level Navigation also.
Hope this helps.
Ankur
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I don't know if this solves your problem, but this is an iView that redirects to www.google.es:
<pre>
import java.io.IOException;
import com.sapportals.portal.prt.component.*;
import javax.servlet.http.HttpServletResponse;
public class Redirect extends AbstractPortalComponent
{
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
HttpServletResponse resp = request.getServletResponse(true);
try {
resp.sendRedirect("http://www.google.es/");
} catch (IOException e) {
e.printStackTrace();
}
}
}
</pre>
Hope it helps,
jc!
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.