0

I have to get current Liferay Window state in jsp file. I have tried

WindowState.class.toString()

It is giving result class javax.portlet.WindowState

I also try for actionResponse.getWindowState().toString() It is giving the same result as above.

I just want to check in my jsp file portlet is in which state, and write the conditions accordingly. I am looking for the condition like (actionResponse.getWindowState().toString()).equals(WindowState.MAXIMIZED)

I am getting exception in above condition. By which means I can get current state of the portlet in JSP.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Learner
  • 976
  • 14
  • 29

1 Answers1

5

What you want is one of the following:

portletRequest.getWindowState() == WindowState.MAXIMIZED
actionRequest.getWindowState() == WindowState.MAXIMIZED
renderRequest.getWindowState() == WindowState.MAXIMIZED

(You can use .equals() on the state as well, but that is not necessary, as it is a constant value).

The toString() method of any Class object will always return class + the class name. I don't see why you are even try to do that - it seems that you need to investigate the differences between of objects, classes, variables and constants.

Tobias Liefke
  • 8,637
  • 2
  • 41
  • 58