1st JSP: Calls a Javascript function:
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="continueTour" onclick="launchTutorial()">Take a Quick Tour</button>
</div>
Javascript function(s):
function launchTutorial(){
var enjoyhint_instance = new EnjoyHint({});
var enjoyhint_script_steps = [
{
"next #newAuthorizationActive": 'To create an authorization form'
}
];
enjoyhint_instance.set(enjoyhint_script_steps);
enjoyhint_instance.run();
//Here's where i'm accessing the 'exportFile' controller method (shown further below)
$.ajax({
type : "POST",
url : $('#authorizationResourceURL').val(),
data : {action: "redirectToEmpInfoForAuthTour", tourStatus : 0},
success : function(data){
alert('success');
document.open();
document.write(data);
document.close();
}
});
Method in the controller:
@ResourceMapping
protected void exportFile(ResourceRequest request, ResourceResponse response) throws IOException {
String action = ParamUtil.getString(request, "action", "");
if(action.equals("redirectToEmpInfoForAuthTour"))
{
//This is where I want to return the 2nd JSP from
}
A brief context to what exactly I'm looking for here:
I have a JSP (1st JSP), where I'm trying to show the user a tutorial (using enjoyhints) for the portlet. As a part of this tutorial, I need to highlight elements (select boxes, text fields) which are on different pages (JSPs) of the portlet. Hence, In the Javascript function, I first highlight (this highlighting part is whats taken care of by enjoyhints) the element that's there on the 1st JSP (and this works fine), and now I want to show the user the 2nd JSP, and using enjoyhints, highlight some element in the 2nd JSP, and so on in the 3rd and 4th JSPs too.
If anybody has an alternative way of how I can do this, kindly let me know. The main problem here is that the elements I need to highlight are on different JSP pages (of the same portlet). Had all the elements been on the same page, it would've been simple.
I'm using Liferay Portal, and Spring Portlet MVC as my design pattern.
UPDATE: Here's another thing that I've been trying to achieve the same thing, but no luck
You can simply change the signature of your ResourceMapping
method to return a String.
The return value can be the name of your view (i.e. JSP).