Java Reference
In-Depth Information
Protocol
Port number
Stripes binding
http:// localhost :8080
/email
/ContactList.action
?view=&contact=5
Server name
Context path
Parameters
Figure 13.5: The different parts of a URL
Before diving in, let's make sure we're on the same page when talking
about URLs. A complete URL might look like this:
http://localhost:8080/email/ContactList.action?view=&contact=5
The different parts of this URL are shown in Figure 13.5 . We'll be
working with the part labeled Stripes binding; keep in mind that URL
bindings in Stripes do not include the application context path or the
request parameters in the ?param1=value1&param2=value2 format (but,
as we'll see, we can still embed request parameters within the Stripes
binding).
Using @UrlBinding
Let's start with a simple example. We can specify the URL binding for
an action bean with the @UrlBinding annotation:
@UrlBinding("/something/Something.action")
public class MessageListActionBean implements ActionBean
This binds the /something/Something.action URL to MessageListActionBean ,
regardless of the action bean's package and class name. When changing
URL bindings this way, we still need to use the . action suffix because
that's the URL mapping configured in web.xml :
Download email_29/web/WEB-INF/web.xml
<servlet-mapping>
<servlet-name> DispatcherServlet </servlet-name>
<url-pattern> * .action </url-pattern>
</servlet-mapping>
 
 
 
Search WWH ::




Custom Search