Pass URL Parameter Spring Web Flow - spring

I have this web application using Spring Web Flow framework. In my main page I have a default display of a list of employees. When I click a particular row I need to redirect to another page displaying a detailed view of the row. I was thinking of passing the "name" field in my row through URL parameter.
Is this possible or can Spring web flow support getting parameters from the URL?
name

You can get your request parameters from the special EL variable requestParameters. See: http://static.springsource.org/spring-webflow/docs/2.0.x/reference/htmlsingle/spring-webflow-reference.html#el-variable-requestParameters

Related

How to use Spring REST HATEOAS from Angular?

I was learning about Spring REST HATEOAS. But, I am confused about how we use it on the client end..
I mean, let's say I want write a client app using Angular JS. So now I don't have to hardcode the URL's to make REST API calls? And instead i'd use the "rel" attribute that gets returned?
for example, from angular JS,
I'd use the root URL "/products"
It returns links to individual products (Which I believe will be populated on UI)
User selects a product and angular will fetch the product details, along with relevant links to that product to delete, edit, etc..
If user clicks on delete, Angualar will use the URI specified in "rel=delete" to delete that product..
Is my understanding correct?
Is there a sample angular code, that doesn't hardcode URI but use the rel attribute?

How do I redirect to a new page in a FreeMarker template?

I'm using a custom Magnolia forms module (built internally at my company). When the user successfully submits the form, I want to redirect the user to a success page.
This could be done in the module itself. However, if the user does not successfully submit the form (e.g. missing required fields), I need to display error messaging.
For this reason, I need to use FreeMarker to implement the redirect.
How do I redirect to a new page in a FreeMarker template?
Use the send redirect method. For example:
${ctx.response.sendRedirect("http://google.com")!}
References
Rendering context objects
WebContext.getResponse
HttpServletResponse.sendRedirect

I need to introduce an intermediate page before I load the actual page for every request

I've a web application that uses FreeMarker templates and tiles to do the View job in the MVC world. So upon my request to the application, say /load.do I would like to introduce an intermediate page that will have a loader icon just to indicate the page is being loaded on the subsequent request, which is not known to the user.
So ultimately what I'm achieving is a better user experience and also if used within framework (the iFrames) this comes handy to show the loader icon when there is a new request that is happening.
Can someone point me to the right method I can use here ?
This is possible using spring mvc.
You need to create something like a WaitController. On user submit , this controller will be called. This can trigger your original request in background and take a reference(UUID) for the call and will render a wait page having the reference id of the original request set in model. Wait page can either trigger immediately the main controller using reference id or can poll the reference id on regular intervals or use web socket to know the availability of results. Once results are ready, it should redirect user to the actual result page.

How to access rewritten url from Salesforce Site

I am using the Salesforce Sites URL rewriting feature, and need to retrieve the 'friendly' URL from the browser bar for some other processing. Is there any way I can retrieve this from within either one of the sites pages (so I can pass into a component as an attribute) or from a component controller directly?
To explain further, I am seeing a url in browser presently of 'site.force.com/examplesite/amazingpage' but if I try to retrieve $CurrentPage.url to pass into a component, or use Url.getCurrentRequestUrl() from within a component controller the result is a typical salesforce url ie. 'site.force.com/vfpage?id=123456789'.
Any suggestions most appreciated.
Cheers,
CH
Sorted.
Was obvious in the end - just added an additional method to the url rewriter class that allowed me to pass in a single url for rewriting, rather than trying to retrieve the re-written url from the view.
Cheers,
CH

What is the best way to handle a session-persistant search form in a Spring web application?

I am looking for the best way to handle a session-persistant search form in a "shopping cart" like web application using the Spring MVC Framework.
I want to be able to navigate back to this search page, with last filters already set, from any other page in the application. This is not a master detail search results page, only a form with filters on a table of elements displayed underneath.
I can store my search filters in the user session, but what about multi-tabs navigation and browser back button handling ?
I also considered using Spring WebFlow to adress this.
Any suggestions ?
That sounds like a good job for the conversation scope of Spring WebFlow. Objects which are stored in this scope are saved until the current flow is terminated (or by timeout). The usual way to use it in your case would be to create a new flow/conversation when the user starts browsing the webpage and saves the search parameters in the conversation scope. When going back to the search page later, the parameters are retrieved from this scope (if there are available).
The conversation scope solves the multi-tabs problem and avoid to have to send back to the server every time the data (as you would have to do if you only use the request scope).

Resources