aspose file tools*
The moose likes Struts and the fly likes html:link with bean:define param,  value gone in action ?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:link with bean:define param,  value gone in action ?!" Watch "html:link with bean:define param,  value gone in action ?!" New topic
Author

html:link with bean:define param, value gone in action ?!

O. Thoms
Greenhorn

Joined: Nov 21, 2006
Posts: 10
OK, business case is the registration of employees' vacations by other colleagues. Of course these may not know all data like organisational units, employeeId and so on. So there is a main JSP offering edit fields for all of this, and two buttons, one to send the complete vacation data (submit) and one to search by partialy entered data for matching colleagues. And returning to the prefilled edit JSP after selectig one search result.

Therefor at two points of my app I use dynamic parameters with html:links.

The list of persons (the search result) is displayed using this:

This works fine and in the PreFillAction I fetch the employee data with the help of the ID and prefill all edit fields ...

Now I wanted to build soemthing similar for the two needed buttons on the EditJSP.
One 'fixed' link for the submit and one dynamic with the familyname as param for the SearchAction.

This is basicly like the above:



JSP looks fine and all, but for some totaly not understandable reason the param doesn't reach the Action, it is allways NULL.

I tried retrival from the struts form, from sesssion Param or as simple request param, nothing worked...

Any clues?

[ December 02, 2007: Message edited by: Oliver Thoms ]
[ December 03, 2007: Message edited by: Oliver Thoms ]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I am not sure. When you run the app does the link look correct? Like: "http:/<server>/<app>/vacation/search.do?familyname=smith"?

If so then I would look closer at (or post here) the action mapping, the form and the action class.

BTW, it seems like you could get rid of the bean:define tag if you used the paramId attribute of the html:link tag. You could also get rid of your scriptlet in the img tag if you used the html:img tag with the page attribute.

- Brent
O. Thoms
Greenhorn

Joined: Nov 21, 2006
Posts: 10
Struts config snipplet



The link looks fine on the JSP, but (thanks for the hint) it allready has an empty aram.
So my guess:
Since the familyname just got entered it is not yet stored in the bean.
The form will just be processed when the request is posted.
Could it be, that the bean is not yet populated?!

Still tinkering around....

[ December 03, 2007: Message edited by: Oliver Thoms ]
[ December 03, 2007: Message edited by: Oliver Thoms ]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
That sounds right. The html tags are processed when the page is generated. In order to use a value that was entered into the form you would have to use some JavaScript to get at the value. JavaScript is not my strong suite, so I will leave it to others to help with that solution.

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:link with bean:define param, value gone in action ?!