掲示板

Reading attributes from Properties files.

14年前 に Hasnain Rasheed によって更新されました。

Reading attributes from Properties files.

Junior Member 投稿: 26 参加年月日: 09/03/11 最新の投稿
HI ALL,

Can anyone guide me how to add custom attributes to portal-ext.properties file and how to read this property in JSP file.

Thank you.
14年前 に Arun Kumar S によって更新されました。

RE: Reading attributes from Properties files.

Regular Member 投稿: 182 参加年月日: 08/06/23 最新の投稿
Hasnain Rasheed:
HI ALL,

Can anyone guide me how to add custom attributes to portal-ext.properties file and how to read this property in JSP file.

Thank you.




step 1. portal-ext.properties

   your_custom_attribute_name =  your_custom_attribute_value    


step 2. Jsp

  <% String  str =  PropsUtil.get("your_custom_attribute_name");  %>  



HTH,
Thanks,
Arun
14年前 に Hasnain Rasheed によって更新されました。

RE: Reading attributes from Properties files.

Junior Member 投稿: 26 参加年月日: 09/03/11 最新の投稿
Thanks Arun, it worked
thumbnail
14年前 に Nagendra Kumar Busam によって更新されました。

RE: Reading attributes from Properties files.

Liferay Master 投稿: 678 参加年月日: 09/07/07 最新の投稿
Hi,

I am doing similar way. In my case it is working in my Windows box perfectly - On Linux server same code i getting null value always

How to resolve this

I got this issue since tomcat server is loading portal-ext.properties file from user home path (In linux some thing like - /home/nagendra) instead of reading from <TOMCAT_HOME>/webapps/ROOT/WEB-INF/classes.

Thanks,
- Nagendra Kumar
13年前 に An Jay によって更新されました。

RE: Reading attributes from Properties files.

Regular Member 投稿: 160 参加年月日: 10/12/16 最新の投稿
Hey Arun,

can you read the portal-ext file from a jsp inside a hook too,

because I tried what you said, I t gave me a null pointer exception

14:45:07,414 ERROR [HookHotDeployListener:315] Unable to read portal-ext.properties
java.lang.NullPointerException
at com.liferay.portal.configuration.ConfigurationImpl.getFileName(ConfigurationImpl.java:338)
at com.liferay.portal.configuration.ConfigurationImpl.<init>(ConfigurationImpl.java:122)
at com.liferay.portal.configuration.ConfigurationImpl.<init>(ConfigurationImpl.java:63)
at com.liferay.portal.configuration.ConfigurationFactoryImpl.getConfiguration(ConfigurationFactoryI
:30)
at com.liferay.portal.kernel.configuration.ConfigurationFactoryUtil.getConfiguration(ConfigurationF
il.java:27)
at com.liferay.portal.deploy.hot.HookHotDeployListener.doInvokeDeploy(HookHotDeployListener.java:31
at com.liferay.portal.deploy.hot.HookHotDeployListener.invokeDeploy(HookHotDeployListener.java:133)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:104)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:149)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:35)
at com.liferay.portal.kernel.servlet.HookContextListener.contextInitialized(HookContextListener.jav
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBas
601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBas
610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:595)


Thanks in advanec,

Ann
13年前 に An Jay によって更新されました。

RE: Reading attributes from Properties files.

Regular Member 投稿: 160 参加年月日: 10/12/16 最新の投稿
It worked.
I dont know what happened last time, I did a server restart and it worked.


Thanks emoticon
13年前 に Suresh Chinna Pillai によって更新されました。

create USER via API

New Member 投稿: 16 参加年月日: 11/02/14 最新の投稿
Hi ARUN,
I am new to Liferay environment.I am creating a User management in Liferay with the API. but it throws the following Exception.
06:59:22,671 ERROR [JDBCExceptionReporter:101] ORA-00001: unique constraint (EBMS.IX_5ADBE171) violated

com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update



That constraint was set to the contactId of the User_ table.I created a contactId of my own(manually)
and then executed the application the new user was added to the database.
1) The Process of creating the contactId of our own is good(or)not.If this process is bad.How can we overcome this problem?

and the user details was not displayed in the User list page of Liferay.As mentioned in this forum"http://www.liferay.com/web/guest/community/forums/-/message_boards/message/2713097" append the following code.

try {
2            UserIndexer.updateUser(user);
3        }
4        catch (SearchException se) {
5            _log.error("Indexing " + userId, se);
6        }

and we have to import the import "portal-impl.jar". I imported that jar.then it shows the error that "the method updateUser(User) is undefined for the type UserIndexer".How can I solve this one..?Where can I get the correct jar file..?
Pls help me..

My code is given below:

 public void processAction(ActionRequest request,ActionResponse response)throws PortletException,IOException{
		 String firstName,lastName, email, password, screenName,job_title,languageId,middleName;
		 firstName=request.getParameter("firstName");
		 lastName=request.getParameter("lastName");
		 email=request.getParameter("email");
		 password=request.getParameter("password");
		 screenName=request.getParameter("screenName");
		 job_title=request.getParameter("job_title");
		 languageId=request.getParameter("languageId");
		 middleName=request.getParameter("middleName");
			 
		 try {
		 	long userId = CounterLocalServiceUtil.increment();
		 	User userToCreate = UserUtil.create(userId);
		        userToCreate.setContactId(12004);
		             userToCreate.setFirstName(firstName);
		             userToCreate.setLastName(lastName);
		             userToCreate.setEmailAddress(email);
		             userToCreate.setPassword(password);
		             userToCreate.setScreenName(screenName);
		             userToCreate.setActive(true);
		             userToCreate.setCreateDate(new Date());
		            userToCreate.setGreeting("Hi " + screenName);
		            userToCreate.setJobTitle(job_title);
		            userToCreate.setLanguageId(languageId);
		            userToCreate.setMiddleName(middleName);
		
		            User createdUser = UserLocalServiceUtil.addUser(userToCreate);
		            try {
		            	UserIndexer .updateUser(createdUser);		            	 
			         }
			         catch (SearchException se) {
			             _log.error("Indexing " + userId, se);
			         }
		 }catch(Exception e){
			 e.printStackTrace();
		 }
		 
	 }
13年前 に Suresh Chinna Pillai によって更新されました。

create USER via API

New Member 投稿: 16 参加年月日: 11/02/14 最新の投稿
Hi Arun,
I have created the user using User Management API.It was added successfully in to the database.But it wasn't displayed in the portal page and I can't able to login with the created user.
Can you help me..
Thanks in advance,
-Suresh Chinnapillai.
13年前 に Suresh Chinna Pillai によって更新されました。

RE: create USER via API

New Member 投稿: 16 参加年月日: 11/02/14 最新の投稿
I acheived this..

Thanks,
-Suresh.
10年前 に Ck soni によって更新されました。

RE: create USER via API

New Member 投稿: 19 参加年月日: 14/02/28 最新の投稿
suresh can you now pls post your code ?