• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

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

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Sheriff
Posts: 67693
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67693
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic