wood burning stoves 2.0*
The moose likes Struts and the fly likes accessing <s:param> values in action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "accessing <s:param> values in action" Watch "accessing <s:param> values in action" New topic
Author

accessing <s:param> values in action

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi All,

I am using ModelDriven action. From JSP I am creating url like below one. I have a variable form of Bean StudenBean which is having name and age fields. I implemented getModel() methods also.




At the server end if i try to access name variable value with below syntax

I am getting null value.


Please let me know if my way of doing is wrong.

Rgds
Peter
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
If you look at the url that the s:url tag generated, are those parameters in it, and do they have values? Also, are you running the modelDriven interceptor?
James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Thanks for reply.

I created one anchor button to check the url.



Generated HTML code is


Not able to know how to check generated url.

I implemented ModelDriven to my action.

Rgds
Peter
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
I don't have experience with the ajax tags so I don't know what the easiest way to display that URL is, but I think its pushed onto the stack, so I think you can use an <s:property value="student"/> to write it out.

Using the interface isn't enough to make model driven work. You need to use the modelDriven Interceptor as well (its what calls getModel on your action class to put the model on the stack). If you don't have this interceptor in your stack I don't think your model will get populated. To test you can put a println in your getModel method to see if it ever gets called (unless you wrote some code to call it).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: accessing <s:param> values in action
 
Similar Threads
Struts2Jquery plugin
downloading a file struts2
s:url and javascript onclick submit
how to set javascript varibale in <s:url><s:param> value attribute
s:param struts 2 tag