I am new to Struts 2 but have been a Struts bridge user for some time
(and looking to migrate to Struts 2).  I hope it is reasonable to
expect that Struts2 portlets should work in "standalone" mode - i.e.
not in a portlet container (a la Struts Bridge).  I was having
problems with ajaxExample.jsp from struts2-portlet-2.0.9.  I am using
uPortal 2.6 and Tomcat 5.5.23.

First I accessed the portlet in standalone mode. (Note: changed WAR
file name from struts2-portlet-2.0.9 to struts2-portlet to avoid
portletDefinitionId problems inside uPortal)  e.g.

http://localhost:8080/struts2-portlet/view/ajaxExample.action

And initially I got the error:

/WEB-INF/view/ajaxExample.jsp(14,42) equal symbol expected

I think this is because the s:url tag was nested inside the s:div tag
and something wasn't working.  I then modified it and after playing
around with it for a while I have managed to get a version that works
standalone and inside the portal (see below).  Although having to hard
code the action extension (".action") and namespace ("view") is not
really ideal.

I also notice that the ajaxExample no longer appears in the subversion
repository.  Are there other AJAX/portlet issues I should be aware of?

http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/

HTH

Mark

#################

<%@ taglib prefix="s" uri="/struts-tags" %>

<s:head theme="ajax"/>
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
<b>This is a tabbed pane with two panels that fetches data from a
remote action via ajax</b>

<s:url id="ajaxData" value="/view/ajaxData.action" />

<s:tabbedPanel id="test2" theme="simple" >
      <s:div id="left" label="left" theme="ajax">
          This is the left pane<br/>
          <s:form >
              <s:textfield name="tt" label="Test Text" />  <br/>
              <s:textfield name="tt2" label="Test Text2" />
          </s:form>
      </s:div>
      <s:div href="%{ajaxData}" id="ryh1" theme="ajax" label="remote one" />
      <s:div id="middle" label="middle" theme="ajax">
          middle tab<br/>
          <s:form >
              <s:textfield name="tt" label="Test Text44" />  <br/>
              <s:textfield name="tt2" label="Test Text442" />
          </s:form>
      </s:div>
      <s:div href="%{ajaxData}"  id="ryh21" theme="ajax" label="remote right" />
  </s:tabbedPanel>

<p/>
A DIV that waits for 5 seconds before loading the contents
<s:div
        id="once"
        theme="ajax"
        cssStyle="border: 1px solid yellow;"
        href="%{ajaxData}"
        delay="5000"
        loadingText="loading...">
    Waiting for data</s:div>
<p/>
A DIV that is updated every 2 seconds
<s:div
            id="twoseconds"
            cssStyle="border: 1px solid yellow;"
            href="%{ajaxData}"
            theme="ajax"
            delay="2000"
            updateFreq="2000"
            errorText="There was an error"
            loadingText="loading...">Initial Content
    </s:div>
<p/>
<a href="<s:url action="index"/>">Back to front page</a>

-- 
"Paradoxically, the more time saving abstractions you are using the
more you actually have to know." - Simon Willison

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to