Handling Events In JSP

Discussions

Web tier: servlets, JSP, Web frameworks: Handling Events In JSP

  1. Handling Events In JSP (3 messages)

    Hi there

    I have a jsp which invoks data objects and brings back the data.And evrything is working fine

    part of the code...

    <FORM method="get" name="form1">
    <TD><input type="text" name="pname" value="<%=pname%>"></TD>
    <TD><input type="text" name="desc" value="<%=desc%>"></TD>
    <TD><input type="text" name="iconurl" value="<%=url%>"></TD>
    <TD><input type="SUBMIT" name="Update" value="Update"></TD>
    <TD><input type="SUBMIT" name="Delete" value="Delete"></TD>
    </TR>
    </FORM>
    i want some of these fields to be read only so that user can only read data and not update.

    so i just added

    <input type="text" name="pname" value="<%=pname%>" onfocus="this.blur();" >

    but it's not working i even tried to write simple javaScript function to do the same,but still not working

    Another thing i want is to have some kind of message box or alert before user deletes anything(i know how to do them with html and JavaScript)

    Could somebody tell me how to do this in JSP?Can JSP handles events?If so how?

    Thanks
    Medha

    Threaded Messages (3)

  2. Handling Events In JSP[ Go to top ]

    I just copied your code and run it on Tomcat. It works FINE!
    I have following code, which works as you want. The problem must be somewhere else..



    <HTML>
    <%!
       String pname = "pnameStr";
       String desc = "test";
       String iconurl= "dummyURL";
     %>
    <FORM method="get" name="form1">
    <TABLE>
    <TR>
    <TD><input type="text" name="pname" value="<%=pname%>" onfocus="this.blur();" > </TD>
    <TD><input type="text" name="desc" value="<%=desc%>"></TD>
    <TD><input type="text" name="iconurl" value="<%=iconurl%>"></TD>
    <TD><input type="SUBMIT" name="Update" value="Update"></TD>
    <TD><input type="SUBMIT" name="Delete" value="Delete"></TD>
    </TR>
    </TABLE>
    </FORM>
  3. Handling Events In JSP[ Go to top ]

    Hey

    That's kind of funny!I am also using Tomcat.
    What else could be the problem.This JSP is called by another JSP but that shouldn't make any difference.It's still not working and i couldn't think of any valid reason

    Thanks anyway.At least i know my script works.

    Medha
  4. Handling Events In JSP[ Go to top ]

    Hey

    It's working!

    and reason is really stupid.
    I am working in JBuilder.It has got it's own Tomacat so that u can run ur JSP's and Servlet in JBuilder environment itself.When u do that u also get a web view there itself.I thaught that must be browser compatible(guess what?it's not)
    When i deployed my jsp and run in IE it's working fine.

    Medha