Hi Geeks,
I have a requirement here,
No session, no multiple jsp. All i have is one jsp which shows a drop down with go and cancel buttons and based on the drop down the same jsp will be called with respective values(which called from java methods) . Please remember everything is in a single JSP.
something like this,
<%
if(editMode == 0)
dropdown
else{
-----
values
------
}
%>
The Go button carries the dropdown value to the else part
The problem is, the drop down has null at the top followed by options, when nothing selected and clicked on go, an inbuilt java method addError needed to be added and the page shouldn't submitted to next.
Since things should happen after clicking on Go, the page is getting forwarded to the else part. All i want is, is to call the addError method and stay back to the same page even after clicking on "Go".
I have tried adding javascript onClick like this,
function fldCheck(){
if(document.frmMain.field.value == ''){
<% uiModule.addError(new Error("message"));%>
return;
//document.frmMain.action="url";
}
else
{document.frmMain.action=submit;}
}
and also tried handling within jsp like this,
if(editMode== 5 && fieldVal == 0){
uiModule.Error(new Error("ErrorMessage"));
String redirectURL = "ur";
response.sendRedirect(redirectURL);
}
Both showing the same page but no error message added. It is because the page is called and the errors are refreshed. Any ideas would help a lot.
Thanks,
Asvin
I have a requirement here,
No session, no multiple jsp. All i have is one jsp which shows a drop down with go and cancel buttons and based on the drop down the same jsp will be called with respective values(which called from java methods) . Please remember everything is in a single JSP.
something like this,
<%
if(editMode == 0)
dropdown
else{
-----
values
------
}
%>
The Go button carries the dropdown value to the else part
The problem is, the drop down has null at the top followed by options, when nothing selected and clicked on go, an inbuilt java method addError needed to be added and the page shouldn't submitted to next.
Since things should happen after clicking on Go, the page is getting forwarded to the else part. All i want is, is to call the addError method and stay back to the same page even after clicking on "Go".
I have tried adding javascript onClick like this,
function fldCheck(){
if(document.frmMain.field.value == ''){
<% uiModule.addError(new Error("message"));%>
return;
//document.frmMain.action="url";
}
else
{document.frmMain.action=submit;}
}
and also tried handling within jsp like this,
if(editMode== 5 && fieldVal == 0){
uiModule.Error(new Error("ErrorMessage"));
String redirectURL = "ur";
response.sendRedirect(redirectURL);
}
Both showing the same page but no error message added. It is because the page is called and the errors are refreshed. Any ideas would help a lot.
Thanks,
Asvin