• Post Reply Bookmark Topic Watch Topic
  • New Topic

code to call a function in jsp when a checkbox is clicked  RSS feed

 
swatione chowdary
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi my dear friends , how r u all,
friends can u please help me in this situation

i have a situation like this:

we are devoloping the application in struts

so in jsp page when we click on a check box the textbox fields has to populate with some values

using java script we can do this , but in struts we can not access java script
so can any one tell the java code to populate text fields when checked on check box.


this is jsp page code:


<%@ page language="java" import= "com.visage.struts.LookupForm" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>



<html>
<head>
<title>
Web Application Page
</title>

</head>
<body>

<%LookupForm fm=(LookupForm)session.getAttribute("theName");
String firstName = fm.getFirstName();
String mi = fm.getMiddleInitial();
String ln = fm.getLastName();
%>

<html:form action="Lookup1" >
<table border="3">
<table width="45%" border="1">
<tr>
<td>first name<td/>
<td><html:text property="firstName" value="<%= firstName %>"/></td>

</tr>
<tr>
<td>M.I<td/>
<td><html:text property="middleInitial" value="<%= mi %>"/></td>
</tr>
<tr>
<td>last name<td/>
<td><html:text property="lastName" value="<%= ln %>"/></td>
</tr>

<tr>
<td><html:submit/></td>
</tr>
</table>


<table border="3">
<table width="45%" border="1">

<tr align="right">
<input type=checkbox name=C1 > same as billing<br>
</tr>

<tr>
<td>first name<td/>
<td><html:text property="cfirstName" value=""/></td>

</tr>
<tr>
<td>M.I<td/>
<td><html:text property="cmiddleInitial" value=""/></td>
</tr>
<tr>
<td>last name<td/>
<td><html:text property="clastName" value=""/></td>
</tr>


</table>
</html:form>

</body>
</html>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how r u all


Fine, thanks. But I need some help from you.

JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so can any one tell the java code to populate text fields when checked on check box.


This is not possible. Please read this JavaRanch journal article for an explanation why.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!