View Full Version : Placing the cursor on the first field in jsp by default

Jun 29th, 2007, 07:54 AM
Am using Struts framework. I want the cursor to be on the first field (text box/select box) when i run the JSP. I've tried with the following command <body onLoad="document.login.userid.focus"> login is my form name and userid is text box name where I want the cursor to be but it didnt work. Can anyone give me a solution for this please...

Philip M
Jun 29th, 2007, 08:04 AM
<body onLoad="document.login.userid.focus()">

Jun 29th, 2007, 08:17 AM
Hi Philip,
Thanx for that quick reply but still am not getting it. if I run the JSP individually then its working but when am running the whole project its not working. As I mentioned earlier we are using Struts and Tiles. so we've defined a layout page and included it in tiles. Is there any solution for it?