WebSphere Portal Server - Action Performed Not Working Properly.

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > February 2007 > Action Performed Not Working Properly.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Action Performed Not Working Properly.
Athar Shiraz

2007-02-21, 7:17 pm

I don't know what I am doing wrong here but I am a novice (despite my company paying a lot for our group to go through Portal training ~$3000 with a training company called Jack Morton in Northern Virginia- AVOID them! atleast that one instructor!)

So I am doing my own reading (the redbooks suck!) I am reading programming Portlets and there is a section on how to use Actions and events.

I click the submit button which is part of a form so my application goes to the actionPerformed(Event e) method. AFTER it is done with the actionperformed method it goes back into the service method!!! That is so strange. It should just quit and display r
ight? Why go to the actionperformed and then the service method? That is not right, is it? It would be ridiculous to check if actionperformed method was touched everytime I did an action, No?


Here is the portlet code. I will include the war file as well:

public void service(PortletRequest request, PortletResponse response) throws PortletException, IOException{
// following is rendering a jsp
PagingData data = new PagingData(request);
ArrayList i = getItemsFromDB(data.getStart(), data.getStride());
data.setList(i);

if (i.size()>0){
request.setAttribute("p", data);
getPortletConfig().getContext().include("/naircloware/jsp/listActionJSTL.jsp", request, response);
}
}

public void actionPerformed(ActionEvent event) throws PortletException {
// ActionEvent handler
String actionString = event.getActionString();
PortletRequest request = event.getRequest();


if( "SEARCH".equals(actionString) ) {
String searchKeywords = request.getParameter("keywords");
if (searchKeywords!=null){
ArrayList v = search(searchKeywords);
request.setAttribute("p", v);
}
}
}

--

Ok and here is the jsp listActionJSTL:

<jsp:useBean id="p" class="naircloware.PagingData" scope="request"/>


<form action="
<portletAPI:createURI>
<portletAPI:URIAction name="SEARCH" />
</portletAPI:createURI>
">
Search:
<br>
<INPUT type="text" name="keywords" size="20"/>
<INPUT type="submit" />

</form>

<br>
JSTL action output:
<ul>
<c:forEach var="item" items="${p.list}">
<li><c:out value="${item}"/></li>
</c:forEach>
</ul>
<br>

<a href="
<portletAPI:createURI>
<portletAPI:URIParameter name="start"
value="<%=p.getPreviousStart()%>"
/>
</portletAPI:createURI>
">< previous <c:out value="${p.stride}"></c:out> </a>
 | 
<a href="
<portletAPI:createURI>
<portletAPI:URIParameter name="start"
value="<%=p.getNextStart()%>"
/>
</portletAPI:createURI>
"> next <c:out value="${p.stride}"></c:out> > </a>
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com