1

I am new to Struts2.I unable to pass tag value dynamically through javascript.I have done this way

<s:url id="temId" action="updateProduct.action" var="productTag"> 
<s:param name="prodId"><s:property value="hdnId"/></s:param>
</s:url>
<s:hidden name="hdnId"/>

this hidden field value is populated through javascript function onclick on gridrow This hidden field is storing value properly.But it is not showing inside of param tag.please give some possible solution

1
  • Will you describe in detail what you trying to do? your question not clear. Commented Dec 29, 2011 at 3:55

1 Answer 1

1

AFAIK Struts2 is server side only whereas JavaScript is client side. Thus you can't create/fill struts tags using JavaScript (unless you execute it on the server side which wouldn't make sense IMHO).

Sign up to request clarification or add additional context in comments.

8 Comments

@saptak: How can I do what? Your question doesn't make sense. The JSP code exists only at server-side. JavaScript only sees the generated HTML. What do you want to change in the HTML?
Sorry, My problem is how can I set hidden field value as url param value?
@saptak: URL of what? A link? A form action? Forget about the JSP and look at the generated HTML in the browser. What would you like to change in this HTML code using JavaScript?
URL of a link code is <a href="<s:property value="#productTag"/>"/>Click Here</a>.
<s:property value="#productTag"/> that's not an url. What does it look like in the generated HTML? You don't have struts tags there, unless your struts is not working at all. - In what way should that be dynamic? Please add more information to your question (not as a comment here as it is harder to format, read and find for others).
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.