Если вы хотите вызвать конкретный метод сервлета, чем использовать язык выражений. Например, вы можете сделать что-то вроде:
Servlet
ForexTest forexObject = new ForexTest();
request.setAttribute("forex", forexObject);
JSP
<body bgcolor="#D2E9FF">
Current date : ${forex.rate}
</body>
Я не хочу пропагандировать поведение «простых вопросов», но это был достаточно простой вопрос:
const strBinSum = (str) => str
.split('') // split the string into individual characters
.map(s =>
s.charCodeAt(0).toString(2) // map them to their binary representation
)
.join('') // join the resulting array
.split('') // split it again
.filter(x => x === '1') // return only 1s
.length; // therefore summing it by returning the amount of 1s.
strBinSum('aB1@aaaaaa'); // 27