0

I am having one modelform

public class ABC
{
private String a;

private String b;

private Obj obj;

...getteres and setters.....
}

in my jsp my OnSubmit function is

function showMethod(rowid) 
{
    document.diamondSingleStoneLabForm.action = adminUrl + "/act.htm";
    document.diamondSingleStoneLabForm.suid.value =value1;
        document.diamondSingleStoneLabForm.obj.value = tempObj;

    document.diamondSingleStoneLabForm.submit();
}

now, my question is

How to pass Object to specified action..???

Or How to pass obj.name property value (I cant access it using document.diamondSingleStoneLabForm.obj.name.value = nameVal;)..???

1 Answer 1

2

Hope in your jsp page you have a text field like this :

<input type="text"  name="obj" value="<%= rs.getString(n)%>" >

but you should tally with the modelform & jsp(this will be your logical part) page where from you fetch the value like <%= rs.getString(n)%>

then you can do this thing

var obj = obj_value;
var action = adminUrl + "/act.htm";  
document.diamondSingleStoneLabForm.action = action ;
document.diamondSingleStoneLabForm.submit(); 

Or you can use: jQuery.post() method in this format

jQuery.post( url [, data] [, success(data, textStatus, jqXHR)] [, dataType] )

you can take a look of this link: jQuery.post()

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

1 Comment

If you want to fetch the dynamic value,then,<1> Where from you get the value of those instance variables ? <2>How do you relate Modelform with your jsp.I should check these things,you can briefly explain these things in your Ques.

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.