*
The moose likes Struts and the fly likes html:button - onclick - substitution of jsp expression doesn't happen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:button - onclick - substitution of jsp expression doesn Watch "html:button - onclick - substitution of jsp expression doesn New topic
Author

html:button - onclick - substitution of jsp expression doesn't happen

Scott Britton
Greenhorn

Joined: Apr 18, 2006
Posts: 4
Hi,

Can somebody please show me the syntax needed to substitute values for jsp expressions when those expressions are embedded in a Struts html tag as follows:

<html:button value="Submit" property="whatever"
onKlick="javascript oSubmit('<%=vendorName%>')">
Submit
</html:button>

What happens is the Javascript function receives the literal value <%=vendorName%> instead of the actual value. This works fine with <input type="submit"> so I'm assuming this is a Struts tag issue.

Thanks!

Scott
Scott Britton
Greenhorn

Joined: Apr 18, 2006
Posts: 4
Never mind, I found the answer searching the archive. I did it as follows:

I then needed to get my parameters passed into javascript, done as follows:

<html:button value='Value'
property='yo'
onklick='<%= "return doSubmit(\'" + vendorName +
"\',\'" + contractNumber +
"\',\'" + doNumber +
"\',\'" + partNumber +
"\',\'" + deliveryId +
"\',\'" + itemId +
"\',\'" + delQuantityDue +
"\',\'" + delQtyToShip + "\');"%>'>
Save
</html:button>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: html:button - onclick - substitution of jsp expression doesn't happen
 
Similar Threads
For a single submission on a jsp , two instances are generated in baseaction class
"enter key" button focus ?
Problem with duplicated execution of action class
struts html event
Problem with &lt;html:button .....