aspose file tools*
The moose likes Struts and the fly likes Struts2 - Need to change the value of style element of s:textfield dynamically using local variable 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 "Struts2 - Need to change the value of style element of s:textfield dynamically using local variable" Watch "Struts2 - Need to change the value of style element of s:textfield dynamically using local variable" New topic
Author

Struts2 - Need to change the value of style element of s:textfield dynamically using local variable

Mithil Shukla
Greenhorn

Joined: Oct 03, 2012
Posts: 4
I need to change the value of style element "top" with the local variable vTopPosition.

Below is the code which is not working.


<%! int vTopPosition = 255; %>

<s:iterator var="characteristicValues" value="MaterialDTO.characteristicValue">

<s:textfield id="attribute" name="abc" value="%{characteristicValues}" type="text" cssClass="input" readonly="true"
style="position: absolute; width: 200px; left: 227px; top: <%=vTopPosition>px; z-index: 31" />

<% vTopPosition=vTopPosition+25;%>
</s:iterator>

Kindly suggest what changes I need to make to make top element dynamic.
Mithil Shukla
Greenhorn

Joined: Oct 03, 2012
Posts: 4
Hi,
How will JRebel will solve the my issue.
Guess I was very clear of what I want, I need to dynamically change the value of TOP attribute specified in the <s:textfield
I am using the struts2-tag.
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 297

Hi Mithil,

for this you need to change the struts themes. Refer the struts documentation. Struts tags are there in struts2core.jar .

The theme templates (simple, xhtml, css_xhtml) can be found in the Struts 2 core jar file. If you expand (extract the files) the Struts 2 core jar file you'll find folders named template.css_xhtml, template.simple, and template.xhtml. Those folders contain the templates for the three default Struts 2 themes. In each folder is a file for each Struts 2 tag. For example if you expand the template.xhtml folder you’ll see the select.ftl file.



Refer this document: Document

Regards
jatan
Mithil Shukla
Greenhorn

Joined: Oct 03, 2012
Posts: 4
This issue got resolved using the following code.



Thanks for Help...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 - Need to change the value of style element of s:textfield dynamically using local variable