Java Reference
In-Depth Information
The Bean Name drop-down options show all valid beans in the page, the value for
this field must match the bean's ID from the <jsp:useBean> tag. After we select one
the Property Name drop-down is populated with all properties in the bean. Once we
select the appropriate bean and property, NetBeans generates the following markup
<jsp:getProperty name="surveyData" property="fullName" />
The value of the name attribute matches the value we selected in the Bean Name
drop-down, and the value of the property attribute matches the values selected
in the Property Name drop-down.
The last change we need to make to the page is to modify the scriptlet so that the
array containing the programming languages selected by the user is obtained from
the bean instead of directly from the HTTP request.
To accomplish this, the line:
String[] selectedLanguages =
Needs to be changed to:
String[] selectedLanguages =
Notice that the bean's ID (surveyData, in our case) can be used in scriptlets as a
variable name.
After implementing all of the above changes, our output page now looks like this:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<jsp:useBean id="surveyData" type="com.ensode.nbbook.model.SurveyData"
<meta http-equiv="Content-Type" content="text/html;
<title>Thank You!</title>
<h2>Thanks for taking our survey</h2>
<jsp:getProperty name="surveyData"
Search WWH ::

Custom Search