Pagination is not working and no error messgage - liferay-6

There is no error in the file but the below code is not working after i deploy please check the code once and help me. The table is "Library" and the columns are "title" and "author". code in view.jsp is as shown below
<% List<Library> list = LibraryLocalServiceUtil.getLibraries(-1, -1); %>
<liferay-ui:search-container delta="5" emptyResultsMessage="No Books Available">
<liferay-ui:search-container-results results="<%= ListUtil .subList(list, searchContainer.getStart(),searchContainer.getEnd()) %>" total="<%= list.size() %>" />
<liferay-ui:search-container-row
className="com.liferay.pagi.model.Library"
modelVar="aLibrary">
<liferay-ui:search-container-column-text property="title" />
<liferay-ui:search-container-column-text property="author" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
You will get all book titles and author names are show into the table.
Give a link back to the main page.
« Go Back

The following is working portlet just download and compare with your code..
I guest your list may be size 0 or empty. check it
List<Library> list = LibraryLocalServiceUtil.getLibraries(0,LibraryLocalServiceUtil.getCount());
http://www.liferaysavvy.com/2013/03/liferay-search-container-with-curd.html
https://github.com/liferay/liferay-plugins/tree/6.2.x/portlets/sample-ui-search-container-taglib-portlet

Related

How to insert a long text using the sendKeys Protractor API?

I have a long text 20 lines with HTML code that I need to use into a form test. For small texts I could use something like this:
browser.actions().mouseMove(element(by.id("field_bodytext")).sendKeys("BodyText <h2>Protractor</h2> Text1")).perform();
and it will work fine. But for 20 lines it does not. I have seen this information in Protractor API page, but can not see how to use it in my case:
http://www.protractortest.org/#/api?view=webdriver.WebElement.prototype.sendKeys
var form = driver.findElement(By.css('form'));
var element = form.findElement(By.css('input[type=file]'));
element.sendKeys('/path/to/file.txt');
form.submit();
There is an example for selenium that I do not see how to adapt: Selenium Webdriver enter multiline text in form without submitting it
This is the form field in Angular:
<div class="form-group">Wordhtml.com
<label class="form-control-label" jhiTranslate="jhipsterpressApp.post.bodytext" for="field_bodytext">Bodytext</label>
<textarea type="text" rows="10" cols="50" class="form-control" name="bodytext" id="field_bodytext"
[(ngModel)]="post.bodytext" required minlength="2" maxlength="65000">
<div [hidden]="!(editForm.controls.bodytext?.dirty && editForm.controls.bodytext?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.bodytext?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.bodytext?.errors?.minlength" jhiTranslate="entity.validation.minlength" translateValues="{ min: 2 }">
This field is required to be at least 2 characters.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.bodytext?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" translateValues="{ max: 65000 }">
This field cannot be longer than 65000 characters.
</small>
</div>
</textarea>
</div>
And the text to be inserted could be something like this:
<h2>What is JHipsterPress?</h2>
<ul>
<li>It is an open source and collaborative project made with Jhipster.</li>
<li>It is a live project that it is explained in its GitHub project. Explained? What do you mean? Whether you are a beginner that wants to find out an example about how to How to open access to the REST Api: or a more advance user who wants to see How to change DTOs to load attributes of not related entities: and see the actual code working, just visit the ReadMe file at GITHUB</li>
<li>And YES, you can use it for your own website.</li>
<li>At the same time JHipsterPress will try to create a community for Jhipster developers to join groups about different topics such as Websockets, Mapstruct, or anything you like.</li>
</ul>
<br />
Put the HTML in quotes `` as #lunin-roman is saying and then call it:
let htmltext = `<h2>What is JHipsterPress?</h2> and so on`;
element(by.id("field_bodytext")).sendKeys(htmltext);
and then use it in the element.sendKeys

uploading multiple images from the frontend using FAL in TYPO3 /extbase

I am using this Helhum example for uploading images from the frontend, which is located on the following link
https://github.com/helhum/upload_example
If we check its form fields in partial file on location
https://github.com/helhum/upload_example/blob/master/Resources/Private/Partials/Example/FormFields.html
there is given two uploads option which are following
{namespace h=Helhum\UploadExample\ViewHelpers}
<label for="title">
<f:translate key="tx_uploadexample_domain_model_example.title" /> <span class="required">(required)</span>
</label><br />
<f:form.textfield property="title" /><br />
<label for="image">
<f:translate key="tx_uploadexample_domain_model_example.image" />
</label><br />
<h:form.upload property="image" >
<f:if condition="{resource}">
<f:image image="{resource}" alt="" width="50"/>
</f:if>
</h:form.upload><br />
<label for="image_collection">
<f:translate key="tx_uploadexample_domain_model_example.image_collection" />
</label><br />
Here for the property="imageCollection.0" if I make it multiple="multiple" then it give me the following error
1297759968: Exception while property mapping at property path "imageCollection": PHP Warning: spl_object_hash() expects parameter 1
to be object, null given in
/var/www/webroot/typo3_src-7.6.14/typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php line 155 (More information)
And if I remove the 0 and just try to click a botton then it even not generate a form and give me the following error
1297759968: Exception while property mapping at property path "": The source is not of type string, array, float, integer or boolean, but of
type "object" (More information)
So long story in short, how can I fix this example for multiple images uploading. I try to used without helper function just used a standerd fluid function <f:form:upload> it still give me a same error. please somebody can help me in sort out this problem.

Submitting the value in the property tag to the action form

The JSP:
<s:form action = "addfriend">
<s:property value="Username" />
<s:submit value="Add friend" />
</s:form>
Does this code submit the value in the <s:property> tag to the action form?
No, <s:property> tag doesn't generate input fields. Merely description of the <s:property> tag you can find here. It's used to print the value from the value stack to JSP output. To submit the value to the action the form needs to have a tag which generate a HTML <input> tag or <textarea> tag. That's what the <s:textfield> tag provides.
<s:textfield name="Username" value="%{Username}"/>
Note, there are many other tags that generate input fields, you can see the output generated in HTML browser source window.
If you need to send a value that is displayed through s:property, simply add an s:hidden field to it:
<s:form action = "addfriend">
<s:hidden name = "Username" />
<s:property value = "Username" />
<s:submit value = "Add friend" />
</s:form>
Remember, if a tag doesn't have the name attribute, it won't be posted to the Action.
Also avoid variables starting with an uppercase letter: username would be mapped to setUsername and getUsername, but Username could create problems, and is not standard.
As already pointed by #Roman, here's the code :
You can do :
<s:form action="addfriend">
<s:textfield name="Username"/>
<s:submit value="Add friend" />
</s:form>

Grails cache issue with forms in show.gsp (view)

I have this very odd issue and I've picked my code apart and taken out any caching changes that I think would cause this but it still remains.
Here is whats happening:
I add an Address in my app, named "q", I save it and get id 1 for
example.
If I add another address names "q" (q isn't restricted to unique), then save it I get id 2.
If I repeat 2 I get a new item with id 3.
Here is the weird part, if I put the mouse over the Edit button for 2 or 3 it has a link to 1. If I look at the HTML generated I get this section for the form:
<form action="/CRM/address/delete/1" method="post" ><input type="hidden" name="_method" value="DELETE" id="_method" />
<fieldset class="buttons">
Edit
<input type="submit" name="_action_delete" value="Delete" class="delete" onclick="return confirm('Are you sure?');" />
</fieldset>
</form>
If I look at the show.gsp it's just the basic code from the generated scaffold:
<g:form url="[resource:addressInstance, action:'delete']" method="DELETE">
<fieldset class="buttons">
<g:link class="edit" action="edit" resource="${addressInstance}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
<g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
</fieldset>
</g:form>
The controller has the following action:
def show(Address addressInstance) {
respond addressInstance
}
When i print the addressInstance it looks like the correct one.
Does anyone have any idea why I get ID 1 instead of the proper id in this form which is on the show screen of address 2 and 3???
I've tested it in H2 and PostgreSQL, Grails 2.3.3, locally and on Heroku.
Looks like a bug linkGenerator cache in Grails 2.3.0-2.3.4.
I've created a Jira: http://jira.grails.org/browse/GRAILS-10883
You can disable the cache in your config file:
grails.web.linkGenerator.useCache = false

How to bind form based actions like 'Save' to designated Java classes mentioned in xwork in Confluence

I have made some significant progress in my customization efforst thanks to your help and looking forward to move forward similarly.
I have created the custom tab in the 'Advanced' tab and it now looks like this.
I have been able to add a text field as well as a 'Save' button. I actually followed the 'Edit Space Details' option and took two of its form elements to achieve the output.
This is how my VM looks now.
##requireResource("confluence.web.resources:space-admin")
<html>
<head>
<title>Freeway Project Creation</title>
<meta name="decorator" content="atl.general" />
</head>
<content tag="key">$action.space.key</content>
<body>
#applyDecorator("root")
#decoratorParam("helper" $action.helper)
#decoratorParam("context" "space-administration")
#decoratorParam("mode" "view-space-administration")
#applyDecorator ("root")
#decoratorParam ("context" "spaceadminpanel")
#decoratorParam ("selection" "add-fpc-label-action-web-ui")
#decoratorParam ("title" $action.getText("action.name"))
#decoratorParam ("selectedTab" "admin")
#decoratorParam("helper" $action.helper)
<div >
<table width="95%" border=0 cellspacing=0 cellpadding=5>
<form name="editspace" method="POST" >
#bodytag( "TextField" "label='space-name'" "name='name'" "size=40" )
#param ("labelwidth" "100")
#param ("tdcolor" "f0f0f0")
#end
<tr>
<td colspan="2" align="center">
#tag( "Submit" "name='confirm'" "value='update.name'" "theme='notable'" )
#tag( "Submit" "name='cancel'" "value='cancel.name'" "theme='notable'" )
</td>
</tr>
</form>
</table>
</div>
#end
#end
</body>
</html>
I would like to understand how this interaction with my JAVA class will result in the output like. For eg: I will enter the name in the text box for name and hit save and on a resulting page it must display the name entered.
As of now my designated java class looks like this.
package com.atlassian.myorg;
import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.confluence.pages.AbstractPage;
import com.atlassian.confluence.pages.actions.PageAware;
import com.opensymphony.xwork.Action;
/**
* The simplest action possible
*/
public class FreewayProjectAction extends ConfluenceActionSupport
{
#Override
public String execute() throws Exception
{
return Action.SUCCESS;
}
}
So I have 3 questions:
The 'Edit Space Details' shows the following URL 'http://localhost:1990/confluence/spaces/doeditspace.action?key=LBTEST' when i mouse over the 'Save' button. I am assuming that its governing Java class is EditSpaceDetails. So is the doEdit() method (see here )inside that class that swings into action when we try to save the edit action of the space ? Can i get to see the xml that has this mapping specifically for this edit space details action? Is my assumptin correct ?
In order to have such a functionality i have mentioned earlier i.e. displaying the name entered in my custom page as detailed above what will be the changes required in my Java class.
In the page i have just customised there is the text box and the label is 'Name' . Should i use a different xml so that i can provide my custom label like "Project Name" ?
Please do kindly advice me on the same.
Thanks
Angie
to answer your first question - you're able to get a deeper insight into the xwork action mappings, interceptors and possible result types if you're taking a look at confluence-core/confluence/src/etc/java/xwork.xml.
The following example is the corresponding mapping for your "doeditspace.action":
<action name="doeditspace" class="com.atlassian.confluence.spaces.actions.EditSpaceAction" method="doEdit">
<param name="RequireSecurityToken">true</param>
<result name="error" type="velocity">/spaces/editspace.vm</result>
<result name="input" type="velocity">/spaces/editspace.vm</result>
<result name="cancel" type="redirect">viewspacedetails.action?key=${key}</result>
<result name="success" type="redirect">viewspacedetails.action?key=${key}</result>
</action>
So if the return value from your execute method is ActionType.SUCCESS or "success", the request will be redirected to the viewspacedetails action.
Additional information is documented in the Atlassian Developer Website:
https://developer.atlassian.com/display/CONFDEV/XWork-WebWork+Module