Liferay success message for uploading a file - liferay

I'm trying to add my own success message on liferay after uploading a file.
in my view.jsp:
<liferay-ui:success key="key1" message="message1" />
I created a package in src folder named: "content". in whish I created a file: language.properties.
language.properties:
message1=file uploaded successfully
in my controller:
SessionMessages.add(uploadRequest, "key1");
but that doesn't work. it display the liferay default message. please help.

It seems you have not specified resource-bundle entry in portlet.xml.
In portlet.xml provide <resource-bundle>content.language</resource-bundle>

Related

Hybris (B2B Punchout) site URL resulting in Server error

Am trying to setup B2B punchout add-on, trying to add the custom component and set up the website.
Issue observed: Hitting the Site URL in the browser resulting in the server error, could not see any errors on the console logs (actually no movement of the logs on the console)
Have followed the following steps,
Installed B2C recipe.
Followed by B2B add-on installation.
Followed by B2B punchout add-on installation.
Have removed unnecessary extensions like electronics, apparel,
powertools from the localextensions.xml and added the entries of my
website in local.properties Am trying to create a custom Component
for a B2B punchout.
 Have created the necessary impexes for my component in as follows,
INSERT_UPDATE ContentSlotForPage;$contentCV[unique=true];uid[unique=true];position[unique=true];page(uid,$contentCV)[unique=true][default='homepage'];contentSlot(uid,$contentCV)[unique=true]
;;Section2A-Homepage;Section2A;;Section2ASlot-Homepage
INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;active;cmsComponents(&componentRef)
;;Section2ASlot-Homepage;Section2A Slot for Homepage;true;trainingCustomComponent
INSERT_UPDATE CustomComponent;$contentCV[unique=true];uid[unique=true];name;number;date;deliveryDate;total;&componentRef
;;trainingCustomComponent;training Homepage Custom Component;;;;;;trainingCustomComponent
 Controller class which looks as follows,
#Controller("CustomComponentController")
#RequestMapping(value = ControllerConstants.Actions.Cms.CustomComponent)
public class CustomComponentController extends AbstractCMSAddOnComponentController<CustomComponentModel>
 In the *-items.xml added the itemtype to create the model,
<typegroup name="Components">
<itemtype code="CustomComponent" autocreate="true"
generate="true" extends="SimpleCMSComponent"
jaloclass="org.training.core.jalo.CustomComponent">
<description>Custom Component</description>
<deployment table="CustomComponent"
typecode="11001" />
<attributes>
......
</attributes>
</itemtype>
</typegroup>
 Also created a JSP and placed in the path ,
trainingstorefront\web\webroot\WEB-INF\views\responsive\cms\customcomponent.jsp
Kindly help me by providing the exact extension/path where I need to place all the classes/xml’s/files if you find above ones are wrong 

import js file to header all jsp in liferay

I'm going to import a js file to the header of all pages exist in liferay portal.
I know I have to do in Hook.I put import this js into init.jsp in ..\html\common , but was import to all elements of the liferay pages.
I don't know where put this file?
You don't have to do this in a hook. Do it in your theme as the theme is responsible for generating the whole document, including the <html> and <head> sections.
In the theme, override templates/portal_normal.vm. It should be obvious where to put the script reference.
You'll override this file by creating a docroot/_diffs/templates folder and copy docroot/templates/portal_normal.vm to that location. Then edit the file in docroot/_diffs/templates, build and deploy your theme.

does not display the result (Java)

Hello trying to figure out the Jsf (primefaces) and little that goes viz. Compiled war archive in maven try to run through the Glassfish, the server starts but in the beginning writing "Artifact qwe-1.0-SNAPSHOT.war: Server is not connected. Deploy is not available." But in the late writes "Artifact qwe-1.0-SNAPSHOT.war: Artifact is being deployed, please wait... Artifact is deployed successfully." It seems like everything is normal, then opened my page in the browser is empty although in my index.xhtm and my pom.xml and web.xml link pastebin
and should be a button with styles that are connected in primefaces tell me if I'm doing something wrong?
here's a screenshot of the result in the browser. link1
<p:button outcome="productDetail" value="Bookmark" icon="ui-icon-star"> targets you to the productDetail page. If you do not have productDetail.xhtml page at the currect path, the index.xhtml page cannot resolve NavigationCase for outcome. Thus, Create page productDetail.xhtml and put into the same directory of index.xhtml.
In addition, You should use JSF Standard tags(h:head, h:body).

Unable to navigate if i keep the .xhtml files in sub folder(other than the root folder) in JSF 2.0

I am new to JSF 2.0. I was practising the implementation of JSF 2.0. When i keep my A.xhtml file in the root folder and navigate to another B.xhtml file which is in subfolder in root folder, the page is navigating successfully. But when i am navigation from B.xhtml to any other file, it is showing page not found error. If i moved my B.xhtml file to the root folder , in this case i am able to navigate to another page.
Seems like it is with the problem of handling paths, when my .xhtml files are in sub folders other than directly in the root folder.
Please let me know where it is going wrong.
Your solution is greatly appreciated !!
Thanks,
Sai.
I got the answer. I placed the sub folder in WEB-INF folder. Instead if i moved the subfolders to WebConent folder., it is working.

Sharepoint webpart upload file whitout using "runat server"

For uploading a file in sharepoint I use a webpart and an automatically generated form.
the tag for the upload file:
<input type="file" id="uploadfile" name="uploadfile" />
When I try to pick it up after posting, the file isn't accessible with the Request.Files attribute (Request.Files["uploadfile"]). (Request.Files looks like null on sharepoint)
Is there a solution in sharepoint without using the "runat=server" on the input tag?
To upload files to sharepoint you need to set enctype (enctype="multipart/form-data") on the form tag. Sharepoint doesn't add it when you use .
When using non ASP.NET controls, you can use 'this.Page.Form.Enctype = "multipart/form-data";' On Page_Load to add the enctype.
Is there a reason why you can't just use the ASP.NET FileUpload control? This will do all the hard work for you.
You can access a stream for the file via the FileContent property or as an array of bytes via the FileBytes property. Its filename is available via the FileName property.

Resources