Y'day I suddenly forgot (amnesia..??? naaa..:D).. and I was totally balnk abt some of the basic things we do every day.. like accessing java code in JSP.. so to persist.. I write it here in my blog. ;) I think I got so much carried away with the merger of Bear and the current market conditions.. so back to coding action.
but before we move on some smiles to persist from daily cartoons:Obama 1
{%
String showResetMsg = (String)request.getAttribute(Constants.SHOW_RESET_ACTION_MESSAGE_STD);
DetailsForm detailsForm = (DetailsForm)session.getAttribute("detailsForm");
String resetMsgInForm =detailsForm .getShowResetActionMsg();
if(null!=showResetMsg && showResetMsg.equals(Constants.YES))
{
detailsForm .setShowResetActionMsg("yes");
}
else
{
detailsForm .setShowResetActionMsg("no");
}
%}
Java Script Function executed on page load:
Lets say.. you are executing an action and if there is an exception, which you want to handle gracefully and show an alert message to the user. You can do so using a simple Java Script function. Which gets called always on page load. This fn, basically checks for the form variable and if its not null or empty always shows the alert msg.
{script='JavaScript'}
showErrMsgOnPgLoad(); //method is always called on page load. Carefully set and clear the form variable document.forms[0].errMsg.value
function showErrMsgOnPgLoad(){
var errmsg=document.forms[0].errMsg.value;
if(errmsg!=null && errmsg!=''){
alert(errmsg);
document.forms[0].errMsg.value='';
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment