how to set properties of a bean at once from a servlet?

like we have a jsp tag <jsp:setProperty name="user" property="*"/>, do we have something like this which we can use in a servlet.
[149 byte] By [h_burkulea] at [2007-10-2 10:54:35]
# 1
Yes. HttpServletRequest#getAttribute(String) and HttpServletRequest#setAttribute(String, String). If the parameters in question are from a HTML form POSt, then you may also use HttpServletRequest#getParameter(String).- Saish
Saisha at 2007-7-13 3:18:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Servlets can retrieve initialization values through it's init() method.

First you must define the values in the web.xml:

<servlet>

<servlet-name>MyServlet</servlet-name>

<servlet-class>mypackage.MyServlet</servlet-class>

<init-param>

<param-name>username</param-name>

<param-value>Fred</param-value>

</init-param>

</servlet>

You can not retrieve this value with the init() method:

public void init(ServletConfig config) throws ServletException {

String initialUsername = getInitParam("username");

}

HTH.

linxpdaa at 2007-7-13 3:18:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Or you could not listen to me and use the proper method:

public void init(ServletConfig config) throws ServletException {

String initialUsername = getInitParameter("username");

}

Sorry about that...

linxpdaa at 2007-7-13 3:18:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
ya the getAttribute() and setAttribute() will work but say i have say five setter methods in my bean and i want to set all of them at once from my servlet like we do it from a jsp page in a single statement.e.g.<jsp:setProperty name="user" property="*"/>
h_burkulea at 2007-7-13 3:18:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
I think you will then need 5 statements. Or use a form-data-binding web framework like Struts, JSF, Spring MVC or Tapestry.- Saish
Saisha at 2007-7-13 3:18:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
ya i think i will need those statements.thanks anyway.
h_burkulea at 2007-7-13 3:18:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Might i suggest you simply create a jsp using the jsp set property tag then look at the generated java code... It's probably done using reflection or java.beans package
garem01a at 2007-7-13 3:18:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...