I have created 3 portlets (testimonial portlet, directory portlet, polling portlet), and I want to call testimonial portlet from directory portlet. How to do this? Kindly help me.
I have written the following code in my view.jsp file of directory portlet:
<%# taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<liferay-portlet:renderURL var="linkURL" portletName="testi" windowState="maximized" />
<br>
Testimonial
I can redirect in another page, but I got error like
This portlet has been undeployed. Please redeploy it or remove it from
the page.
Should I make changes in liferay-portlet.xml? Kindly help me.
portletName attribute value , you specified seems incorrect.
Thats the reason, you are getting that message.
I just checked giving incorrect name "test" as portletName whereas there isnt any portlet with name test.
If <portlet-name>test</portlet-name> is the entry in your liferay-portlet.xml ,
then give portletName as test_WAR_testportlet, it will work.
If other portlet is Liferay's Out of Box portlet, you can utilize PortletKeys class.
HTH
I had same requirement. But i am very new in Liferay...
So i have not much more knowledge of Liferay API.
So I used web service for fetch portlet data to another portlet. Its really interesting and very easy..
You can find more help from this.
Jersey RestFul webService
I done this and all working very well.
Thankssssss
Related
I have a page in which I have deployed a portlet, in my portlet I access some params using the url in the browser like:
localhost.com:8080/mypage?text=helloworld
with using
PortalUtil.getOriginalServletRequest(request).getParameter("text")
and it is working fine.
The issue comes when there is some latency in view.jsp rendering (like putting some debugger in Java code) and in the meanwhile the render portlet view.jsp is called again but this time I cannot read the "text" param from request
From client side the url being called is as follows:
> http://localhost:8080/c/portal/render_portlet?p_l_id=92438&p_p_id=editor_WAR_heliumportlet&p_p_lifecycle=0&p_t_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_pos=0&p_p_col_count=2&p_p_isolated=1¤tURL=
> ...
This url doesn't contain my param, I can't find a clue from where this url is triggered. Any help would be greatly appreciated.
Liferay can push portlets to be rendered asynchronously if they take too long to load (e.g. when attached to a debugger). This is due to the default values for render-weight and ajaxable, which allow this. Change them in liferay-portlet.xml.
Also note that fetching generic HTTP parameters that are not namespaced is not part of the spec, that's why Liferay doesn't care to forward the non-namespaced-parameter from the original URL to your portlet when it rendered it via AJAX. In other words: By using this technique you're probably preparing yourself for quite some more trouble in future.
As far as portlets can share the same page with other portlets, portlets use to have a prefix or a namespace.
This namespace can be always the same for a given portlet if this portlet is not instanceable. Or this namespace ca be variable with the purpose of being unique for each instance of the portlet.
So, the parameters for a portlet must be prefixed with the namespace.
Then, it will be easy to access this param using util tools like..
ParamUtil.get(renderRequest, "paramName", "defValue");
Here the java doc
https://docs.liferay.com/portal/6.2/javadocs-all/com/liferay/portal/kernel/util/ParamUtil.html
Regards
I'm new to liferay and java so this is probably very simple.
I've successfully created portlet complete with a configuration.jsp file. In my portlet view.jsp I can successfully reference images:
<img src="${renderRequest.contextPath}/images/image1.png" />
But in my configuration.jsp the contextPath is empty.
QUESTION: What needs to be done in order to get the same path I get in my view.jsp?
I've created this pastebin showing my full code and this pastebin to show a simpler case.
Use the below code.
<img src="<%=request.getContextPath()%>/images/image1.png"/>
Ensure that you have configured the portlet name properly in portlet.xml and web.xml
I have a problem with uploading a large file (>max_upload_size). Why all form fields are null (when uploading this file) in form validate method?
I tried to manage this by asking if file is null and return action error if so, and while debugging seems ok, i get no response to my browser. I have already managed this on another project. This former project worked on Bea web server, while this current is on Jboss.
Can you post the what your jsp looks like.
Also do not forget to include this (enctype="multipart/form-data") in your jsp form definition:
<html:form action="/uploadme" enctype="multipart/form-data">
<html:file property="myfileToupload"/>
</html:form>
Set-Up-
I have a JSP - index.jsp and a servlet indexController. indexController forwards request to index.jsp. Execution of index.jsp without execution of indexController is not desired.
Requirements-
'www.mysite.com' should be served by indexController/index.jsp
Any request with invalid url should get redirected to 'www.mysite.com'.
'www.mysite.com/index.jsp' should get redirected to 'www.mysite.com'.
My Solution -
Map indexController to "/" - I read that this is overriding 'default servlet' and I want to avoid that.
Map 'index.jsp' in welcome-file-list: I don't need to explicitly map it science 'index.jsp' is there, it will be automatically taken as welcome file. Doing this doesn't execute indexController. Moreover invalid urls are 'forwarded' not redirected to welcome file.
Map error page to home page- This is cheating with yourself. I don't want to hide errors.
Use two servlets. One with "/*" mapping, which redirects everything to 'mysite.com'. Second mapped to ""(empty) that actually serves request. - Some mysterious issues here(yet to figure out)
I think, everyone wants to achieve same functionality for their home screen and there are many questions at stackoverflow with similar problems.
Is there any standard solution which solves problem for once and for all.
Edit:- There were only 7 views in more than 30 mins. Removed GAE tag, to attract more views.
Simply put a web server before your app server and you can map any URL to any application/page. Also don't publish an app server directly.
Are you using Tomcat I presume, so you probably deployed ROOT application, right? (you should go with the web server anyway)
I have a project that I can see the JSP's... However Jboss shows me the servlets so in the address bar all i can see is:
"appservleer?=AppDev"
This is an example not the actual address...but with that info only how can I know which JSP is being displayed at that moment by JBoss.
or am I understanding this Jboss, servlet, JSP incorrectly?
Some guidance would be appreciated.
Thanks.
You cannot know which jsp is being displayed unless the developer decided to give hints about it.
A jsp is just a view technology that the servlet uses to render a response. That is, typically, the jsp will be parsed and html will be generated. However, the developer of the servlet may decide to write to the response himself. So nothing can really tell you if what you got came from a jsp or from another source, even if you had a url like www.mydomain.com/page.jsp. Nothing guarantees the response you are seeing in your browser was generated from a jsp.
The only way to know for sure which JSP is used for rendering is to look at the source code of the servlet that is mapped under (in your example) "appservleer".
Look in web.xml which servlet is mapped with this path, and open the source code of this servlet. Then figure out the execution path, starting with the doGet(...) or the doPost(...) method, and see to which JSP it is forwarded in the end...
Good luck.
You should always start with the web.xml file which will eventually lead you to the actual jsp file that is displayed. Start with the servlet mapping and check which servlet is invoked for the url. Then dig into the servlet to find out which jsp it is redirected to. If you are using any application framework then look for the implementation to findout the mapping. For e.g. in spring the spring configuration files or the controller classes tells you where the calls are redirected to.