Ria Dev

Greenhorn
+ Follow
since Aug 18, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ria Dev

Thanks Bear
12 years ago
JSP
Which one is good practice while linking 2 jsps.
1) Link jsps by : onClick="window.location=a.jsp';"
2) Link jsps by : submit the jsp form to a servlet
In servlet, use request.getRequestDispatcher("a.jsp").forward(request, response);

On what circumstances, do i need to select one over another?
12 years ago
JSP
Please tell me, how to link to a jsp on click of a button?
I tried to use the below code, which isnt working,

.jsp

<input type ="button" name="edit" value="Edit Details" onClick="fwdToUpdatePage();">

.js

function fwdToUpdatePage(){
document.location.href(update.jsp);
}

Also let me know if there is any other method to do this.
Thanks Bear.
12 years ago
Thanks Bhanu, your solutions works.
If scope is not mentioned then, is it not that all the scopes(session,application,page,request) are searched for that particular variable? please correct me if i am wrong. As there were no other variables with the same name in any other scope, i used directly ${var}.I didnt get why it didnt work for me.
12 years ago
Hi,

I have problem when i use EL for the below scenerio. Please help

-------------------------------------------------------------------------------------------------------------
SignUp.jsp:
<form id="newUserForm" action="registerServlet" method="post">
Email Address:<input type="text" name="email" value=""/>
${error.email.msg}
<input type="submit" name="signUp" value="SIGN UP" />
</form>
--------------------------------------------------------------------------------------------------------------------
registerServlet:

.. code for checking if email already exists in db
..if yes, then
HttpSession session = request.getSession();
session.setAttribute("error.email.msg", e.getMessage());
request.getRequestDispatcher("JSPs/SignUp.jsp").forward(request, response);
----------------------------------------------------------------------------------------------------------------------------

when i submit the SignUp form , i am redirected to the same form but error message is not being displayed.

Please let me know if anything else has to added.
12 years ago