Today we will see how we can send error message from our controller. Here we set the error message in controller which is dynamic and view this on jsp with single tag.
So lets start this step by step :-
Step 1:- Create MVC Portlet
Just Create a simple MVC Portlet and paste this content in the controller.
DynamicSessionErrorPortlet.java
Step 2:- Change your view.jsp
Now open your view.jsp and paste this:-
view.jsp
Step 3:- Provide entry in Language.properties
Now open Language.properties file and add the entry
dynamic.error.msg={0}
Step 4:- Deploy and Check Output
Now deploy your portlet and add to page.
Now comment Line 40 and uncomment line 41 and redeploy
Related Post:-
No comments:
Post a Comment