Results 1 to 6 of 6
  1. #1
    Emertana is offline Member
    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0

    Default How to send the div values to java class?

    have a product catalog that is showing different values using < div > tag, there should be a button for user to add the chosen products to shopping basket but I do not know send the ProductsID to java class.


    Name:ProductA Name:ProductB
    Price:3.5 Price:5.0
    Add Add

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default Re: How to send the div values to java class?

    By having the id in the request?
    Could be a hidden field, or simply appended to the submit URL the button is doing.
    Please do not ask for code as refusal often offends.

  3. #3
    Emertana is offline Member
    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0

    Default Re: How to send the div values to java class?

    Quote Originally Posted by Tolls View Post
    By having the id in the request?
    Could be a hidden field, or simply appended to the submit URL the button is doing.
    would you give a sample code? I used the hidden code but it does not work,

    <s:form action="AddProduct" >
    <tr><td><div id="image"><img src=${Product.thumbNailUrl} alt="image"/></div></td></tr>
    <s:textfield name="Name" label="Name" />
    <tr><td><div id="Name">Here:${Product.name}</div></td></tr>
    <s:hidden id="Name1" value="name1">${Product.name}</s:hidden>
    <s:label id="name2" name="name2" value="John"/>
    <tr><td><div id="Rate:">Rate:${Product.highRate}</div></td></tr>
    <tr><td><div id="Address">Address:${Product.address}</div></td></tr>
    <tr><td>
    <s:submit/>
    </s:form>



    <tr><td><div id="Name">Here:Beaufort</div></td></tr>
    Beaufort<input type="hidden" name="" value="name1" id="Name1"/>
    <tr>
    <td class="tdLabel"></td>
    <td><label id="name2">John</label></td>
    </tr>

    <tr><td><div id="Rate:">Rate:437.19</div></td></tr>
    <tr><td><div id="Address">Address:33 Beaufort</div></td></tr>
    <tr><td>
    <tr>

    <td colspan="2"><div align="right"><input type="submit" id="AddProduct_0"
    value="Submit"/>
    </div></td>
    </tr>

    </table></form>

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default Re: How to send the div values to java class?

    Please use [code] tags [/code] when posting code.
    I can't read any of that.

    Also what does "it does not work" mean?
    Please do not ask for code as refusal often offends.

  5. #5
    Emertana is offline Member
    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0

    Default Re: How to send the div values to java class?

    Quote Originally Posted by Tolls View Post
    Please use [code] tags [/code] when posting code.
    I can't read any of that.

    Also what does "it does not work" mean?
    where is the code tag?
    does not work means when I have a look at the html source the value attribute is empty.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default Re: How to send the div values to java class?

    I just showed you in that post.
    WHen you wrap your code in [code] tags [/code] it retains its formatting.
    eg
    Java Code:
    public void someMethod() {
       all nicely laid out.
    }
    Show us the html (in code tags) that is produced.
    At least an example of that table.
    Please do not ask for code as refusal often offends.

Similar Threads

  1. how to send scanned in arrary to class?
    By j@v@ in forum New To Java
    Replies: 3
    Last Post: 12-07-2010, 10:06 AM
  2. Send selective objects in a class over network
    By RDReavis in forum Advanced Java
    Replies: 2
    Last Post: 01-18-2010, 08:45 AM
  3. Replies: 8
    Last Post: 03-21-2009, 09:34 AM
  4. how to send values from servlet..
    By hussainzim in forum Java Servlet
    Replies: 1
    Last Post: 08-06-2008, 07:28 AM
  5. Replies: 4
    Last Post: 04-15-2008, 01:04 PM

Tags for this Thread

Posting Permissions

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