O'Reilly logo

Struts Kick Start by Kevin Bedell, James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing the Session and Other Form Beans

Sometimes, you need to get a handle on the Session during Action processing. Fortunately, it’s easy to get at. All you need to do is to use request.getSession(). After you have a handle on the session, you can use getAttribute and setAttribute to gain access to session properties.

In more complex applications, you’ll commonly have several pages of input awaiting processing. For example, you could decide that the user creation page is too long and should be broken down into two pages. To do this, you would begin by dividing the JSP form into two pieces, as shown in Listings 8.3 and 8.4.

Listing 8.3. newUserName.jsp
 <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required