java - Struts2 URL unreachable -
i'm racking head here struts2 - i'm able access jsp pages omitting part of path. note path suppose include pages/welcome_user.jsp. key @ word pages in path.
here's struts.xml file:
<?xml version="1.0" encoding="utf-8" ?> <!doctype struts public "-//apache software foundation//dtd struts configuration 2.0//en" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="default" namespace="/user" extends="struts-default"> <action name="login"> <result>pages/login.jsp</result> </action> <action name="welcome" class="com.mkyong.user.action.welcomeuseraction"> <result name="success">pages/welcome_user.jsp</result> </action> </package> </struts> i'm able access login.jsp via: http://localhost/struts2example/user/login
, welcome_user.jsp via: http://localhost/struts2example/user/welcome
note in both url, i'm able drop pages, why?
source: http://www.mkyong.com/misc/how-to-use-mkyong-tutorial/
can go through above tutorial , tell me what's wrong?
first, have used urls mapped actions in struts.xml.
the action method executed , returns result code success. result can find in action config. result executed, if type of result isn't set default dispatcher, , request forwarded location specified in result config.
if location relative final absolute location determined namespace of package used action.
more detailed example of usage namespaces , explanation can find in example struts 2 namespace configuration example , explanation.
you can't drop pages if using dispatcher result forwards jsp. in case url has been rewritten , can't see final url.
Comments
Post a Comment