on 05-16-2006 3:03 PM
Hi everybody,
I'm trying to write a JSP script, that redirects to a website depending on a given parameter (Language). Therefore I made an abstract portal component with the developer Studio and exported this as a par-file.
The problem is that I always getting an this error when I'm testing the script:
Error occurs during the rendering of jsp component.
This is my jsp-code:
<%
String lang = (String) request.getParameter("lang");
String url;
if ("de".equals(lang))
{
url = "http://www.google.de";
response.sendRequest(url);
}
else
{
if ("en".equals(lang))
{
url = "http://www.google.com";
response.sendRequest(url);
}
else
{
url = "http://www.google.es";
response.sendRequest(url);
}
}
%>
and this is my portalapp.xml:
<application>
<application-config>
<property name="ServicesReference" value="" />
<property name="releasable" value="true" />
</application-config>
<components>
<component name="Redirect">
<component-config>
<property name="ComponentType" value="jspnative" />
<property name="JSP" value="pagelet/redirect.jsp" />
<property name="SafetyLevel" vaule="low_safety" />
</component-config>
</component>
</components>
<services />
</application>
I'd really appreciate it if anyone could help me out.
Thank you very much in advance
Regrads
Norbert
The problem is this:
The response object is some sap specific response object and not the expected HttpServletResponse! The response object you have simply does not offer any redirect method.
For the same reason you should not use pageContext.getResponse() in tags because you will get null. Of course, this effectivly makes it impossible to use most tag libs because some tags depend on the response object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Norbert
Have u created Abstract portal component or JSPDynpage?
Can u post your complete code?
Regards
Yoga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your many answers, in the logfile I found the following errors:
symbol : method sendRedirect (java.lang.String)
location: class com.sapportals.portal.prt.servlets_jsp.server.jsp.response.JSPResponse
response.sendRedirect(url);
^
/usr/sap/EE1/JC00/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/WEB-INF/portal/portalapps/Redirect/work/pagelet/_sapportalsjsp_redirect.java:87: cannot resolve symbol
symbol : method sendRedirect (java.lang.String)
location: class com.sapportals.portal.prt.servlets_jsp.server.jsp.response.JSPResponse
response.sendRedirect(url);
^
/usr/sap/EE1/JC00/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/WEB-INF/portal/portalapps/Redirect/work/pagelet/_sapportalsjsp_redirect.java:92: cannot resolve symbol
symbol : method sendRedirect (java.lang.String)
location: class com.sapportals.portal.prt.servlets_jsp.server.jsp.response.JSPResponse
response.sendRedirect(url);
^
3 errors
Does the portal don't know the response.sendRedirect method?
@Yogalaksahmi:
it is an Abstract portal component.
What do you mean with "complete code"? The whole par-file?
Hi Norbert,
It should be able to identify sendRedirect method if you import HttpServletResponse in your JSP.
Login to the portal->Portal browser->/->/->work/pagelet->_sapportalsjsp_redirect.java
Browse the portal and copy the whole sapportalsjspredirect.java and paste it in any of your IDE/Editor and check whether HttpServletRequest and HttpServletResponse are imported properly.
And find out the proper error in that java file line number 87 and 92.
Now I think you can identify the problem.
Regards,
Karthick
Please award points for helpful answers.
Hi Norbert,
The other way of finding out the log file is remote login to your portal desktop.
go to <drive>->usr-><instance id>->j2ee->cluster->server0->log->here you can find out all the log files.
The problem is because of error occurred in JSP that you have written.Its giving error when it is being compiled.
So kindly check the log files and revert back.
Regards,
Karthick Eswaran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Norbert Stroh,
If you dont have java developer role you will not get Java Development Tab in your portal.
So go to System Administration->Support->Support Desk->Portal Runtime->Log Viewer->Here you can find your trace file by pasting your Exception id.
Regards,
Karthick Eswaran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Norbert,
Could you please paste the log trace file here.So that I can tell you the appropriate error occurred.
To get the log trace file.
Login to portal->Java Development->Log viewer->Search for your exception ID.->open the particular log file->paste the particular log trace here.
Regards,
Karthick Eswaran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.