aspose file tools*
The moose likes Struts and the fly likes Struts 2 - Set Action Attribute From Jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 - Set Action Attribute From Jsp" Watch "Struts 2 - Set Action Attribute From Jsp" New topic
Author

Struts 2 - Set Action Attribute From Jsp

Ceku Camli
Greenhorn

Joined: Oct 16, 2010
Posts: 5
Hi,
I'm new to struts.
I want to complete information in a few steps. In the first step, i create a person with an id. In the second step, i have text fields and a submit button. In my action class I have an "id" attribute but can't set it.

Here is the jsp code:





How i can fix it?

Thanks!
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

In my action class I have an "id" attribute but can't set it.

I don't understand this statement. When you submit the form, is the id property of your action not set to the value you you give in s:param tag?? I'm not really sure if you can use s:param tag in s:form tag. If you don't want the id value to be visible to the user, then you can use s:hidden tag...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ceku Camli
Greenhorn

Joined: Oct 16, 2010
Posts: 5
Ankit Garg wrote:
In my action class I have an "id" attribute but can't set it.

I don't understand this statement. When you submit the form, is the id property of your action not set to the value you you give in s:param tag?? I'm not really sure if you can use s:param tag in s:form tag. If you don't want the id value to be visible to the user, then you can use s:hidden tag...



In the s:form, the s:param tag does not work (unlike the s:url tag ). I was unaware of the s:hidden tag. I'll just try it.
Ceku Camli
Greenhorn

Joined: Oct 16, 2010
Posts: 5
@Ankit

Unfortunately, the property tag can not be nested in the hidden tag:

Ceku Camli
Greenhorn

Joined: Oct 16, 2010
Posts: 5
Ceku Camli wrote:@Ankit

Unfortunately, the property tag can not be nested in the hidden tag:



@myself,
try the OGNL!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 - Set Action Attribute From Jsp