Results 1 to 3 of 3
  1. #1
    ngald is offline Member
    Join Date
    Jun 2012
    Rep Power

    Default javascript inside tag Struts2


    Application with strut2

    inside a jsp page I need dinamically change the value of textfield F1 <s:textfield> when a select field S1 select a new value.
    I think for a javascript for the event S1 onmouseup who set F1 value.

    The problem.
    The value dependes by :
    1) a property <s:property> P1, this is a file of an action so is in the ValueStack struts
    2) the istantaneus value of S1 (value of select field) who is a javascript/dom readed value.

    The property P1 is a MAP type so is necessary to use an index, this index is the variable javascript 'valueFieldS1'.

    The problem is the need of parsing Javascript and Struts, I'm no able to resolve the value javascript inside tag Struts <s:property>

    I have ried with many sintax modes : ' " + { .

    this is the code o javascript.

    function setMyValue( valueField_Select1 ) {

    document.getElementById('F1').value="<s:property value="P1['valoreCampoS1'].myProperty" />" ;


    If you have other kind of solutions is ok.
    My objective is change asynchronously a single field of an entire jsp, reading the istantaneus value of <s:select > tag.
    with struts2

    Thanks Nicola

    ciao nicola

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: javascript inside tag Struts2

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: javascript inside tag Struts2

    I had to read this several times (and then have a weekend off), but you can't mix Struts tags (which are server side things) with Javascript values (which are client side things). At least that is what this looks like:
    Java Code:
    ="<s:property value="P1['valoreCampoS1'].myProperty" />"
    P1 does not exist on the server.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 0
    Last Post: 10-30-2011, 04:38 PM
  2. Replies: 9
    Last Post: 04-12-2011, 08:26 PM
  3. struts2 tag
    By aaruviswa in forum Web Frameworks
    Replies: 1
    Last Post: 03-17-2011, 11:34 AM
  4. the check file inside of the zip in javascript
    By naval gupta in forum Advanced Java
    Replies: 1
    Last Post: 07-18-2009, 01:12 PM
  5. struts2
    By catchme33 in forum Web Frameworks
    Replies: 4
    Last Post: 03-25-2009, 11:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts