wood burning stoves*
The moose likes Struts and the fly likes getting form values on jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "getting form values on jsp page" Watch "getting form values on jsp page" New topic

getting form values on jsp page

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
I try to get form attributes on a jsp page.
I did the following:
<% String myForAttribute = <jsp:getProperty
name="attributeA" property="ampleForm"/>; %>
But this does not seem to work.
I am wondering if my code is not right or there is a
better way?
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4447

1. You can't embed a JSP tag in a scriptlet.
2. name is usually the attribute key of the bean you are trying to use and property is the name of the field in that bean. Thus, you would probably have something like
<jsp:getProperty name="ampleForm" property="attributeA">
3. You could use bean:write instead:
<bean:write name="ampleForm" property="attributeA">
4. If you need to use the value in a scriptlet, you could use bean:define
<bean:define id="attrA" name="ampleForm" property="attributeA" />
[ October 01, 2003: Message edited by: Junilu Lacar ]

Junilu - [How to Ask Questions] [How to Answer Questions]
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
It works actually.
[ October 02, 2003: Message edited by: rick collette ]
I agree. Here's the link: http://aspose.com/file-tools
subject: getting form values on jsp page
Similar Threads
web.xml hard work
login-config question
Jboss ldap
Multipage form validation
jsp:include in JSF JSP