Member Avatar for rakhi4110

Hi everyone,

I'm naive to javascript as well as JSP.
I'm involved in a project where i need to code a web page similar to shopping cart type of thing.
The user selection needs to be displayed in the same page dynamically using JavaScript and then after confirmation from the user the products have to be stored in the database using JSP..
Can anyone kindly give me the idea of how to do it..

If any detailed description is there.. Kindly mail me at <<Email>>
Please help.. Am stuck :(:(

Recommended Answers

All 4 Replies

Use javascript for doing whatever validations or client side displaying.
When the user submits, whatever is inside the form that you have, will be sent at the action of the form where you can get it with java

Member Avatar for rakhi4110

Thank u javaAddict for your kind reply..
But can i get some example how to do it as i dont know how to save all those contents into a frame and send using javascript..
I'm trying sing hidden frames but still it is unfruitful..

Will be highly grateful if u can help

What you ask can be found in any book about jsp. Do some reading. You have a form with the inputs, then submit the form. You can use javascript to change the contents of the inputs, but in the end just submit the form. That is very basic and can be found in any book about jsp

<form name="form1" id="form1" action="whereToSubmit.jsp">
   <input type="text" name="field" id="field" value="This is a text field" />
   <input type="submit" name="submit" id="submit" value="Submit Form" />
</form>

You can use javascript to set the values of the input tags, (maybe you can use hidden as well, I don't know your code or page)
And then when you click submit, whatever is inside the form will be submitted.

You can save what the user has selected in the session and when the user goes to the confirmation page, display everything inside input tags. Clear the session and then submit

Member Avatar for rakhi4110

What you ask can be found in any book about jsp. Do some reading. You have a form with the inputs, then submit the form. You can use javascript to change the contents of the inputs, but in the end just submit the form. That is very basic and can be found in any book about jsp

<form name="form1" id="form1" action="whereToSubmit.jsp">
   <input type="text" name="field" id="field" value="This is a text field" />
   <input type="submit" name="submit" id="submit" value="Submit Form" />
</form>

You can use javascript to set the values of the input tags, (maybe you can use hidden as well, I don't know your code or page)
And then when you click submit, whatever is inside the form will be submitted.

You can save what the user has selected in the session and when the user goes to the confirmation page, display everything inside input tags. Clear the session and then submit

Thank you very much for your reply sir. But i want to tell you i know what are forms and how to use hidden elements. I asked you for an example in which hidden elements can be placed using javascript. But anyway i solved my prob in a different way with the use of AJAX. Thanks for taking time to reply for this.
RAKHI

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.