I am working with struts2 portlet sample and deployed in liferay portel using liferay server. It is working fine. But now I am trying to validate my form even that working perfectly for first time. But after first attempt when form is submitted with desired values it is not proceedin further and not recogonizing the desired action too.
Can anybody helm me in this issue.
Thanks in advance
We have the same setup and have had numerous problems with making struts 2 work nicely with the portlet api. We had the same problem as you early on. Are you using the bridge provided with the struts 2 distribution?
One thing that doesn't work with the bridge is chained actions - you can't have an action that redirects to another action. We did som coding of our own to solve it where the action classes figures out which action that is next. (Our application is a step-by-step guide where steps are included or not dependings on what you have entered previously.)
You might put some break points in PortletStateInterceptor and verify that your action state is getting save and then restored. Note that in portlets there is an action phase and a render phase and if you find the DirectRenderRequest action on the top of the stack instead of yours then you're probably not saving the valuestack state during the action phase.
Related
In VS 2012, I am attempting to create an MVC 4 web application with jQuery calls to a Web API project. (Other devs will be consuming the API with our current, native app, and probably adding to the API in the future.) So I have one project that is the Web API, and another project that is the MVC 4 website. I can only set one of them to run, and they use localhost:xxxxx.
How do I debug changes to both? For example, let's say I add a new API path /api/customer/get and then a new jQuery ajax call to that path and do something with the resulting JSON. I've changed code in both projects and want to follow it end-to-end; how do I launch both? How do I debug both?
Just to be clear, the MVC app isn't making server-side calls to the API, I'm using MVC mostly to be able to easily use bundling, minification, and (hopefully) pre-compiled Handlebars templates in .NET; the API calls are coming from jQuery. As I am still relatively new to these technologies, alternate suggestions are welcome.
Thank you in advance.
I had the same problem and have found a solution from here:
forums.asp.net
The fix is to do the following:
In your solution file, click properties go to the Startup project node (if it is not already selected)
Next select Multiple startup projects. Select your website and your webservice and in the Action column make sure both of them have "Start" selected.
Now when you debug your website and put a break point in your webservice, it should hit the break point.
Coming late to the party but in case anyone else is looking for a solution, this is what was best for me: Set the Api project up to be the starting project (I needed to limit to one startup so that I could flip between browsers more easily). After firing up the service project, right click on the web/ui project and select debug, start new instance. You'll have both running and you'll seamlessly step from web to api.
I had a similar problem with my web api project. My solution consisted of an angular front end with 2 web api projects on the backend. One web api project handled "authorization" and the other handled "resources". I used the following tutorial by Taiseer Joudeh as a starting point:
http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/
Breakpoints worked on the "authorization server"... but not on the "resource server". I compared the packages from the two projects to see what was different. Once I added "Microsoft.AspNet.WebApi.Cors" to the "resource server" project, the breakpoints starting working.
I need to redirect with some parameter from JSR286(IBM) portlet to JSF 2.0 portlet.
I am having the page unique id and friendly url too.
I have tried response.sendRedirect() and requestDispatcher.forward() but no success till now.
Please provide me some solution.
For navigating between portlets you should not simply forward or redirect pages, since this is not the way to go. The proper way to communicate between portlets, even on different pages is to use interportlet-communication (IPC), commonly known as portlet wiring.
But it all depends on what you mean with a "JSR286(IBM) portlet". A portlet is either a JSR-286 portlet following the global specs (which are the same for all vendors, IBM, Apache, Oracle, Liferay, ...) or you have a portlet using the IBM API/iWidgets, in the last case, portlet wiring is not possible if I remember correctly from the docs.
Anyways, JSF or not, a JSF 2.0 portlet remains a JSR-286 portlet, so you can use normal events in this case as well, though I'm not experienced in JSF. Both portlets should have a portlet descriptor, in which you can declare:
The event, using <event-definition>. Please note that when your JSF-portlet is in a separate portlet application (in a different portlet.xml file), you will have to use an XName, not a normal name.
The events a specific portlet can publish, using <supported-publishing-event> (your JSR-286 portlet)
The events a specific portlet can subscribe to, using <supported-processing-event> (your JSF 2.0 portlet)
Afterwards, you can send an event in your JSR-286 portlet from within the ACTION phase, by using the ActionResponse.setEvent() method.
From the JSF 2.0 portlet, you should still be able to get the PortletRequest/PortletResponse from the context. If you check if it is an instance of EventRequest, you can retrieve the parameter using EventRequest.getEvent(), allowing you to pass parameters between portlets.
If your portlets are on separate pages, you'll have to got the Administration of WebSphere Portal (I assume you're running that since you're talking about IBM), and define global targets for the pages so that events can be triggered cross-page (otherwise wiring is only available for portlets within the same page).
I tried the approach of using Form-Builder-Generated-Form within Java application suggested here < Running Orbeon-Form-Builder-Generated-Form with Java Application > : downloaded Orbeon nightly build, created a sample form using Form Builder and copy & pasted it into JSP page in my app. However, when I try to access this JSP, it redirects me to: /myapp/fr/unauthorized . Can you please tell me what I maybe doing wrong? Or what is the right way of making Orbeon process Form Builder generated content in Java app?
For my deployment I followed separate deployment and configuration specified in Orbeon documentation. Thanks in advance.
You are not doing anything wrong, but Orbeon Forms doesn't support this type of form deployment.
The separate deployment mode runs the output of your JSP directly through the XForms engine.
Form Builder-generated forms OTOH expect pre-processing via the Form Runner runtime, in particular through the components.xsl XSLT transform. This is needed to support all the Form Runner features, including built-in persistence, error summary, internationalization, etc.
Currently the cleanest way to integrate such forms with your own app is to just run them side by side (Orbeon WAR + your own WAR) and navigate between each other via links and POSTs.
You could also use an iframe, although that is often a disliked solution.
You could also transform the form produced by Form Builder into plain XForms that doesn't assume Form Runner. It wouldn't be too hard to do but would be outside the scope of this StackOverflow question.
I am using struts2 . I want that after clicking on link on 1st page it should go to 2nd jsp page.How to do that.
Thanks in Advance
First remember one thing since you are working with MCV2 based platform so its never advised to go from a jsp page to another jsp page directly which is being treated as bad practice.(you are not going through proper request cycle)
Request should go through Actions.Struts2 provide a convenient way to help you for such use-cases.
If in your struts config file you do not provide any Action class name framework will create an action class for you on the fly with return type as SUCCESS. This is all you need to do:
<action name=gotoJSP2>
<result>/page2.jsp</result>
</action>
This is all you need and you are good to go.
Though you can go from one JSP to Another but make sure you have no Struts2 tags and any such framework dependence since going form one JSP to another means not calling Struts2 Dispatcher filter and not letting framework to do required work to serve you.
Is there any way I can force the render of a port let in Liferay?
I'm using Liferay 6.0.6 and I want to set a value into a session variable and force other port let to render to be able to update fragment of this second portlet as it reads this variable.
In the portlet development I am using JSF 2.0 (Mojarra) and PrimeFaces
In case this is impossible. Any other suggestion to achieve it? How can two port lets communicate to update a fragment of one of them?
Thanks in advance.
You could do a Google for Ajax Push in PrimeFaces, and you will find some resources. Ajax Push can also be used in a portlet context. We've been using Ajax Push in ICEfaces, but it seems that PrimeFaces supports the same. I did however came across this issue, but I don't know if it's still relevant for the version you're using at the moment.