You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Henry F. Camacho Jr." <hf...@unpluggedcities.com> on 2007/05/25 03:10:19 UTC

CRUD Application - How can I receive url attributes

I've been banging my head on this one reading everything I can.  I new 
to struts, and I apologize if this is somehow redundant to this list.

I've got a CRUD application I place various records from a database into 
a table with an edit button.  This edit button has the following format:

http://localhost:8080/Inventory/AdminUserEdit.do?id=1

What I am trying to do is to preload a form with the data associated to 
id=1 in my database.  Since I can not figure out how to access the id=1 
from the form bean context I can not pre-populate the form for display.

Here is my struts-config.  The action in question is /AdminUsersEdit.  
If I hard code the formbean, it displays data in the form.  Of course I 
would like to get access to that ID value to grab the data from the 
database.

<struts-config>
    <form-beans>
        <form-bean name="logonForm" 
type="com.unpluggedcities.inventory.LogonForm"/>
        <form-bean name="adminUserEditForm" 
type="com.unpluggedcities.inventory.AdminUserEditForm"/>
    </form-beans>
    <action-mappings>
        <action path="/Welcome" forward=".welcome_page" 
roles="owner,engineer,store"/>
        <action path="/WelcomeOwner" forward=".welcome_page" 
roles="owner,engineer,store"/>
        <action path="/WelcomeOwnerStatus" forward=".welcome_page" 
roles="owner,engineer,store"/>
        <action path="/Admin" forward=".admin_page" roles="admin"/>
        <action path="/AdminUsers" forward=".admin_user_page" 
roles="admin"/>
        <action path="/AdminUserEdit" forward=".admin_user_edit_page" 
roles="admin"/>
        <action path="/AdminOwners" forward=".welcome_page" roles="admin"/>
    <action path="/Logon" forward=".logon_page" roles="any"/>
    <action path="/Logoff" forward=".logoff_page" roles="any"/>
   
        <action path="/LogonSubmit"
                type="com.unpluggedcities.inventory.LogonAction"
                name="logonForm"
                scope="request"
                validate="true"
        roles="any"
                input="/Logon.do">
                  
                <forward name="success" 
path="/Welcome.do"/>                   
        <forward name="failure" path="/Logon.do"/>                   
        </action>
   
        <action path="/AdminUserEditSubmit"
                type="com.unpluggedcities.inventory.AdminUserEditAction"
                name="adminUserEditForm"
                scope="request"
                validate="true"
        roles="admin"
                input="/AdminUserEdit.do">
                  
                <forward name="success" 
path="/AdminUsers.do"/>                   
        <forward name="failure" 
path="/AdminUserEdit.do"/>                   
        </action>
                   
    </action-mappings>

Thanks so much for any help....

HFC




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Variable Form Elements, Dynamically Generated Forms

Posted by "Henry F. Camacho Jr." <hf...@unpluggedcities.com>.
I am trying to work out the best way use dynamically generated forms in 
Struts.  The application I am developing is going to allow the user to 
select from a database a list of fields that should be active on a 
form.  This list will be modified within the database, and so I am 
thinking that DynaForms are out since they are in general configured in 
the struts-config, and further more, one user of the system might pick 
different fields to be active than another user.

And then there is the idea of the Java Bean that populates the form.  
 From what I can tell that needs to be a concrete bean, that is defined 
when the application is compiled.

HFC

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: CRUD Application - How can I receive url attributes

Posted by "Henry F. Camacho Jr." <hf...@unpluggedcities.com>.
That was extremely helpful...looks like that page has gotten me over the 
hump

Thank you...
HFC

Givler, Eric wrote:
> I'd recommend going to the Learntechnology site, and reading this:
> http://www.learntechnology.net/content/struts/struts_crud.jsp
>
> 	-----Original Message----- 
> 	From: Henry F. Camacho Jr. [mailto:hfc@unpluggedcities.com] 
> 	Sent: Thu 5/24/2007 9:10 PM 
> 	To: user@struts.apache.org 
> 	Cc: 
> 	Subject: CRUD Application - How can I receive url attributes
> 	
> 	
>
> 	I've been banging my head on this one reading everything I can.  I new
> 	to struts, and I apologize if this is somehow redundant to this list.
> 	
> 	I've got a CRUD application I place various records from a database into
> 	a table with an edit button.  This edit button has the following format:
> 	
> 	http://localhost:8080/Inventory/AdminUserEdit.do?id=1
> 	
> 	What I am trying to do is to preload a form with the data associated to
> 	id=1 in my database.  Since I can not figure out how to access the id=1
> 	from the form bean context I can not pre-populate the form for display.
> 	
> 	Here is my struts-config.  The action in question is /AdminUsersEdit. 
> 	If I hard code the formbean, it displays data in the form.  Of course I
> 	would like to get access to that ID value to grab the data from the
> 	database.
> 	
> 	<struts-config>
> 	    <form-beans>
> 	        <form-bean name="logonForm"
> 	type="com.unpluggedcities.inventory.LogonForm"/>
> 	        <form-bean name="adminUserEditForm"
> 	type="com.unpluggedcities.inventory.AdminUserEditForm"/>
> 	    </form-beans>
> 	    <action-mappings>
> 	        <action path="/Welcome" forward=".welcome_page"
> 	roles="owner,engineer,store"/>
> 	        <action path="/WelcomeOwner" forward=".welcome_page"
> 	roles="owner,engineer,store"/>
> 	        <action path="/WelcomeOwnerStatus" forward=".welcome_page"
> 	roles="owner,engineer,store"/>
> 	        <action path="/Admin" forward=".admin_page" roles="admin"/>
> 	        <action path="/AdminUsers" forward=".admin_user_page"
> 	roles="admin"/>
> 	        <action path="/AdminUserEdit" forward=".admin_user_edit_page"
> 	roles="admin"/>
> 	        <action path="/AdminOwners" forward=".welcome_page" roles="admin"/>
> 	    <action path="/Logon" forward=".logon_page" roles="any"/>
> 	    <action path="/Logoff" forward=".logoff_page" roles="any"/>
> 	  
> 	        <action path="/LogonSubmit"
> 	                type="com.unpluggedcities.inventory.LogonAction"
> 	                name="logonForm"
> 	                scope="request"
> 	                validate="true"
> 	        roles="any"
> 	                input="/Logon.do">
> 	                 
> 	                <forward name="success"
> 	path="/Welcome.do"/>                  
> 	        <forward name="failure" path="/Logon.do"/>                  
> 	        </action>
> 	  
> 	        <action path="/AdminUserEditSubmit"
> 	                type="com.unpluggedcities.inventory.AdminUserEditAction"
> 	                name="adminUserEditForm"
> 	                scope="request"
> 	                validate="true"
> 	        roles="admin"
> 	                input="/AdminUserEdit.do">
> 	                 
> 	                <forward name="success"
> 	path="/AdminUsers.do"/>                  
> 	        <forward name="failure"
> 	path="/AdminUserEdit.do"/>                  
> 	        </action>
> 	                  
> 	    </action-mappings>
> 	
> 	Thanks so much for any help....
> 	
> 	HFC
> 	
> 	
> 	
> 	
> 	---------------------------------------------------------------------
> 	To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> 	For additional commands, e-mail: user-help@struts.apache.org
> 	
> 	
>
>   
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

-- 
Henry F. Camacho Jr.
Unplugged Cities, LLC
800 Washington Ave No
Suite 501
Minneapolis, MN 55401
Fridley, MN  55432

763-235-3005 (Office)
763-257-6898 (Cell)
tknightowl (Skype)
hfc@unpluggedcities.com (email)
www.unpluggedcities.com (www)
KC0KUS (Amateur Radio)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: CRUD Application - How can I receive url attributes

Posted by "Givler, Eric" <eg...@state.pa.us>.
I'd recommend going to the Learntechnology site, and reading this:
http://www.learntechnology.net/content/struts/struts_crud.jsp

	-----Original Message----- 
	From: Henry F. Camacho Jr. [mailto:hfc@unpluggedcities.com] 
	Sent: Thu 5/24/2007 9:10 PM 
	To: user@struts.apache.org 
	Cc: 
	Subject: CRUD Application - How can I receive url attributes
	
	

	I've been banging my head on this one reading everything I can.  I new
	to struts, and I apologize if this is somehow redundant to this list.
	
	I've got a CRUD application I place various records from a database into
	a table with an edit button.  This edit button has the following format:
	
	http://localhost:8080/Inventory/AdminUserEdit.do?id=1
	
	What I am trying to do is to preload a form with the data associated to
	id=1 in my database.  Since I can not figure out how to access the id=1
	from the form bean context I can not pre-populate the form for display.
	
	Here is my struts-config.  The action in question is /AdminUsersEdit. 
	If I hard code the formbean, it displays data in the form.  Of course I
	would like to get access to that ID value to grab the data from the
	database.
	
	<struts-config>
	    <form-beans>
	        <form-bean name="logonForm"
	type="com.unpluggedcities.inventory.LogonForm"/>
	        <form-bean name="adminUserEditForm"
	type="com.unpluggedcities.inventory.AdminUserEditForm"/>
	    </form-beans>
	    <action-mappings>
	        <action path="/Welcome" forward=".welcome_page"
	roles="owner,engineer,store"/>
	        <action path="/WelcomeOwner" forward=".welcome_page"
	roles="owner,engineer,store"/>
	        <action path="/WelcomeOwnerStatus" forward=".welcome_page"
	roles="owner,engineer,store"/>
	        <action path="/Admin" forward=".admin_page" roles="admin"/>
	        <action path="/AdminUsers" forward=".admin_user_page"
	roles="admin"/>
	        <action path="/AdminUserEdit" forward=".admin_user_edit_page"
	roles="admin"/>
	        <action path="/AdminOwners" forward=".welcome_page" roles="admin"/>
	    <action path="/Logon" forward=".logon_page" roles="any"/>
	    <action path="/Logoff" forward=".logoff_page" roles="any"/>
	  
	        <action path="/LogonSubmit"
	                type="com.unpluggedcities.inventory.LogonAction"
	                name="logonForm"
	                scope="request"
	                validate="true"
	        roles="any"
	                input="/Logon.do">
	                 
	                <forward name="success"
	path="/Welcome.do"/>                  
	        <forward name="failure" path="/Logon.do"/>                  
	        </action>
	  
	        <action path="/AdminUserEditSubmit"
	                type="com.unpluggedcities.inventory.AdminUserEditAction"
	                name="adminUserEditForm"
	                scope="request"
	                validate="true"
	        roles="admin"
	                input="/AdminUserEdit.do">
	                 
	                <forward name="success"
	path="/AdminUsers.do"/>                  
	        <forward name="failure"
	path="/AdminUserEdit.do"/>                  
	        </action>
	                  
	    </action-mappings>
	
	Thanks so much for any help....
	
	HFC
	
	
	
	
	---------------------------------------------------------------------
	To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
	For additional commands, e-mail: user-help@struts.apache.org