on my servlet I have this code:
processRequest(...,...){
String page = "";
if(true){
String str = "hello";
request.setAttribute("str",str);
page = "currentPage#";
}
else{
page = "otherPage";
}
RequestDispatcher rd = requestDispatcher("/",page);
}
on my JSP, to get the servlet attribute, I use this:
<input type = "text" value = "<c out>${str}</c out>">
It happens,
when I use currentPage#, the current page does not load, but the tag inputalways matters null,
but if I used currentPage(without #), I get the value "hello" which is loaded by the page, which I do not want, because the page and content are being updated.
Can someone help me get str attributewithout loading the current page or is there any way?
source
share