Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Action classes and wildcards with special characters

Action classes and wildcards with special characters

2007-01-24       - By Elie Ciment

 Back
Reply:     1     2     3  

Hi,

I am following along the tutorials online getting started with Struts2. I am
loving it, but I noticed something bazaar and was wondering what anyone has
to say about it.

When you have an action

<action name="Login" ....>

and you add an underscore or ! followed by an asterisk (*), to make it

<action name="Login_*" ...> or <action name="Login!*" ...>

then when you reference the url http://localhost:8080/myapp/Login.action -
why does the action Login_* get called? I would think that the underscore is
now needed in order to call this action!

Basically, now LoginXyz.action does not work, yet Login.action does - as
does Login_xyz.action (which is the only one that makes sense to me). So,
does the special character have any special teatment? If so, which
characters are teated specially aside from the ! and _ characters, and is
this documented anywhere?

Thanks for your help,
EC


-- The particular case was first brought to attention in the validation
section of the tutorial (
http://struts.apache.org/2.x/docs/validating-input.html). It was suggested
that if you do not wish to validate before there was any user input, add a
wildcard (*) after a special character to the action ("_" in the article,
but in my downloaded source for the blank struts2 app it was the "!"). That
would make it Login_* (or Login!*).

Whether I go to the Login.action or the Login_any-action-but-input.action it
works and validates, returning back to the page with the validation comment
(xyz is required etc). The question struck me: why does it work for
Login.action!!?? Thanks, again.

©2008 junlu.com - Jax Systems, LLC, U.S.A.