开发者

getting parameters from friendly url portlets jsr 286

开发者 https://www.devze.com 2023-01-31 13:42 出处:网络
I am using ibm portal server. there is a link which is coming from external link. the url that is coming is as below

I am using ibm portal server. there is a link which is coming from external link. the url that is coming is as below http://localhost.us.deloitte.com:10040/wps/myportal/home/gm_assignee_label/gm_eoa_page?invoker=esb?agsnid=32984?asgnmtid=50085

home,gm_assignee_label,gm_eoa_page are friendly urls given to 3 different pages. things after the ? are the key value parameters.

i want to retrieve these paramters when i click on the link above and my page gets loaded.

i tried the below link as given by ibm. but it didnt help me http://publib.boulder.ibm.com/infocenter/wpzosdoc/v6r1/index.jsp?topic=/com.ibm.wp.zos.doc/dev/pltcom_pubrndrprm.html

my portlet.xml code is as below

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
    version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
    id="com.ibm.faces.portlet.FacesPortlet.8b353a4492">
    <portlet>
        <portlet-name>EndOfAssignmentPortlet</portlet-name>
        <display-name xml:lang="en">EndOfAssignmentPortlet</display-name>
        <display-name>EndOfAssignmentPortlet</display-name>
        <portlet-class>com.ibm.endofassignmentportlet.EndOfAssignmentPortlet</portlet-class>
        <init-param>
            <name>com.ibm.faces.portlet.page.view</name>
            <value>/view/endofassignment/EOASearchAssignment.jsp</value>
        </init-param>
        <init-param>
            <name>wps.markup</name>
            <value>html</value>
        </init-param>
         <init-param>
            <name>com.sun.faces.portlet.SAVE_REQUEST_SCOPE</name>
            <value>true</value>
        </init-param>  
        <expiration-cache>0</expiration-cache>
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>view</portlet-mode>
            <portlet-mode>EDIT</portlet-mode>
            <portlet-mode>HELP</portlet-mode>
        </supports>
        <supported-locale>en</supported-locale>
        <resource-bundle>
            com.ibm.endofassignmentportlet.nl.EndOfAssignmentPortletResource</resource-bundle>
        <portlet-info>
            <title>EndOfAssignmentPortlet</title>
            <short-title>EndOfAssignmentPortlet</short-title>
    开发者_开发问答        <keywords>EndOfAssignmentPortlet</keywords>
        </portlet-info>
        <supported-public-render-parameter>AssigneeID</supported-public-render-parameter>
        <supported-public-render-parameter>AssignmentID</supported-public-render-parameter>
        <supported-public-render-parameter>InvokerID</supported-public-render-parameter>
    </portlet>

    <default-namespace>http://EndOfAssignmentPortlet/</default-namespace>
    <public-render-parameter>
        <identifier>AssigneeID</identifier>
        <qname xmlns:x="http://localhost.us.deloitte.com:10040/wps/myportal">x:agsnid</qname>
    </public-render-parameter>
    <public-render-parameter>
        <identifier>AssignmentID</identifier>
        <qname xmlns:x="http://localhost.us.deloitte.com:10040/wps/myportal">x:asgnmtid</qname>
    </public-render-parameter>
    <public-render-parameter>
        <identifier>InvokerID</identifier>
        <qname xmlns:x="http://localhost.us.deloitte.com:10040/wps/myportal">x:invoker</qname>
    </public-render-parameter>
</portlet-app>

i am trying to get the values in my doView method of portlet as below

String esbAssigneeID = request.getParameter("agsnid");

But i always get null.

please help.

TIA, Tejas


The URL is invalid. The query string parameter pairs should be separated by &, not ?. The ? is only the separator between the request URI and request query string.

So the link should rather have been http://localhost.us.deloitte.com:10040/wps/myportal/home/gm_assignee_label/gm_eoa_page?invoker=esb&agsnid=32984&asgnmtid=50085 in order to be able to access agsnid and asgnmtid as request parameters. Otherwise they will be part of invoker parameter.


Don't know if this is the best solution, but it does work.

com.ibm.ws.portletcontainer.portlet.PortletUtils.getHttpServletRequest(request).getParameter("agsnid")
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号