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
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¶m2=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
:
<servlet-mapping>
<servlet-name>
DispatcherServlet
</servlet-name>
<url-pattern>
*
.action
</url-pattern>
</servlet-mapping>
Search WWH ::
Custom Search