<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>renderRequest getAttribute in jsp does not update as in doView in portlet</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=39822285" />
  <subtitle>renderRequest getAttribute in jsp does not update as in doView in portlet</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=39822285</id>
  <updated>2026-07-13T04:04:39Z</updated>
  <dc:date>2026-07-13T04:04:39Z</dc:date>
  <entry>
    <title>RE: renderRequest getAttribute in jsp does not update as in doView in portl</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39830328" />
    <author>
      <name>Eva Sciacca</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39830328</id>
    <updated>2014-07-09T14:09:51Z</updated>
    <published>2014-07-09T14:09:51Z</published>
    <summary type="html">Dear Mayur,&lt;br /&gt;&lt;br /&gt;thank you for your reply. In my case the static attribute setting is working but it is not getting updated when doView() method is re-called after a POST call. I don&amp;#39;t think moving to MVCPortlet would solve the issue. &lt;br /&gt;&lt;br /&gt;Any other hints?&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;&lt;br /&gt;Eva.</summary>
    <dc:creator>Eva Sciacca</dc:creator>
    <dc:date>2014-07-09T14:09:51Z</dc:date>
  </entry>
  <entry>
    <title>RE: renderRequest getAttribute in jsp does not update as in doView in portl</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39824876" />
    <author>
      <name>Mayur Patel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39824876</id>
    <updated>2014-07-09T13:00:46Z</updated>
    <published>2014-07-09T13:00:46Z</published>
    <summary type="html">Hi Eva,&lt;br /&gt;&lt;br /&gt;It should work. I am attaching a small portlet called AttributePortlet in which i have set attribute in doView and reading the same in view.jsp.&lt;br /&gt;&lt;br /&gt;And I would suggest you to use MVCPortlet so that you dont have to worry about dispatching and stuff.&lt;br /&gt;&lt;br /&gt;Thanks.</summary>
    <dc:creator>Mayur Patel</dc:creator>
    <dc:date>2014-07-09T13:00:46Z</dc:date>
  </entry>
  <entry>
    <title>renderRequest getAttribute in jsp does not update as in doView in portlet</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39822284" />
    <author>
      <name>Eva Sciacca</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39822284</id>
    <updated>2014-07-09T11:03:46Z</updated>
    <published>2014-07-09T11:03:46Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Dear all,&lt;br&gt;&lt;br&gt;I am trying to send dynamic String values from the doView method into the view.jsp. This is the code in doView:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
        System.out.println("doView()...");        
        request.setAttribute("test", Math.random());            
        System.out.println(request.getAttribute("test"));
        response.setContentType("text/html");        
        PortletRequestDispatcher dispatcher =
        getPortletContext().getRequestDispatcher("/WEB-INF/jsp/GraphEditorPortlet_view.jsp");
        dispatcher.include(request, response);
    }
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;And this is how I get it from the GraphEditorPortlet_view.jsp&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;amp;lt;%=renderRequest.getAttribute("test") %&amp;amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;But, everytime I do a post and a doView I always get the same number even if it get printed changed in the doView method.&lt;br&gt;&lt;br&gt;Any hints?&lt;br&gt;&lt;br&gt;Kind regards,&lt;br&gt;&lt;br&gt;Eva.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Eva Sciacca</dc:creator>
    <dc:date>2014-07-09T11:03:46Z</dc:date>
  </entry>
</feed>
