This is a novice question about post and get form submission and I am
confused.
I really appreciate if you could help me. I have included some sample codes
for explanation.
I have following action mappings in struts-config file
<action parameter="methodToCall" path="/viewUsersList"
type="com.company.myapp.user.UserAction"
scope="request" validate="false" id="View_Users_List">
<forward name="load" path=".user.usersListView" />
</action>
<action parameter="methodToCall" path="/viewUserDetails"
type="com.company.myapp.user.UserAction"
name="userForm" scope="request" validate="false"
input=".user.userEdit" id="View_User_Details">
<forward name="view" path=".user.userView" />
<forward name="edit" path=".user.userEdit" />
<forward name="save" path=".user.userView" />
</action>
I have following definitions in tiles-defs file
<definition name=".user.usersListView" extends="main.layout">
<put name="title" value="My App - View Users List" />
<put name="body" value="/user/usersListView.jsp" />
</definition>
<definition name=".user.userView" extends="main.layout">
<put name="title" value="My App - View User Details" />
<put name="body" value="/user/userView.jsp" />
</definition>
<definition name=".user.userEdit" extends="main.layout">
<put name="title" value="My App - Edit User Details" />
<put name="body" value="/user/userEdit.jsp" />
</definition>
I have following methods in UserAction (which extends DispatchAction) -
viewList, view, edit, save
In View Users List page, I am displaying list of users and link to View User
Details page using <c:url> and <c:param>.
So, when I go to View User Details page, the url looks something like this
../myApp/viewUserDetails.do?methodToCall=view&userId=1. If the Edit button
is clicked on that page, it forwards to Edit User Details and the url looks
like this ../myApp/viewUserDetails.do. I have hidden fields for methodToCall
with value 'edit' and userId with value '1'. Everything works fine, but my
point is if the user directly types
../myApp/viewUserDetails.do?methodToCall=edit&userid=1, it goes to Edit User
page.
Is this how it should behave even if it is POST or I am misunderstanding how
POST and GET works? Am I following best-practices?
My userEdit.jsp looks something like this. (By default, <html:form> method
is POST)
<html:form action="/viewUserDetails">
First Name: <html:text property="firstName" /><br />
Last Name: <html:text property="lastName" /><br />
<html:hidden property="userId" />
<html:hidden property="methodToCall" value="edit" />
<html:submit value="Save" />
</html:form>
Thank you guys..
semaj
--
View this message in context:
http://www.nabble.com/Is-it-post-or-get--tp15592354p15592354.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]