how do i pass values from inputs on my JSP to my java class?

hi, im creating a simple web application adding user or save user to my database now i would to get the values that are being input to my JSP and retrieve to my Java Class and by the use of SQL clause i will now insert to my database can you explain me how or an example as my references thanx muxh

[305 byte] By [dreamzeroa] at [2007-11-27 9:42:48]
# 1

1) create jsp

2) create actionform class

3) create action class

4) create service object

5) write your BO

actionform will hold all your jsp inputs, populate the form in your action class and pass it BO thro' service object. It's not necessarily to have service object. You can directly call your BO from your action class.

skp71a at 2007-7-12 23:46:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Yeah, this tutorial at the following url will help at understanding how the jsp page binds to database code.It helped me out a lot. http://www.netbeans.org/kb/55/vwp-databoundcomponents.htmlregards
cplmckenziea at 2007-7-12 23:46:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

skp71: this is a JSP forum, not a Struts forum. Why are you giving a Struts based solution without specific mentioning it? This would confuse the topicstarter.

cplmckenzie: your article covers JSF, not JSP. And I recommend not to use visual editors unless you understand the actual codings.

dreamzero: start here: http://java.sun.com/javaee/5/docs/tutorial/doc/ Checkout the chapters 3 and 4.

BalusCa at 2007-7-12 23:46:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I can only add .....

Hmmmm. I can only surmise that tutorials and brainless IDE drag n' drop features are for us who, unlike yourself, are code gurus.

They also provide us a reason, if not a place to start to read - line by line - and began to understand the code. Without being bashed for our lack of understanding.

"I" will be considerate enough to ignore all your future posts.

regards,

cplmckenziea at 2007-7-12 23:46:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Balusc - I think you may have been a little harsh on the other two posters. Particularly since you didn't really contribute much yourself. (edit: just noticed you posted a URL to JavaEE tutorial, so that gets a thumbs up in my book).

cplmckenzie - While I agree that tutorials and IDEs have their place, I think the example you linked to was a little too specific and complex for what was asked. The code generated by all of that would be quite overwhelming to understand without a grounding in the basics.

I actually think skp71 was on the right track, if a little terse on the subject.

You want to break this task into smaller chunks, hopefully each able to be developed and tested on their own.

For starters I would split it into

1 - Get the values from the JSP to a java bean

2 - Load/Save the values from a bean to the database

If we are talking about basic JSP and Java beans, I think the Java EE tutorial is a better place to start. It shows you the basics without hiding the implementation (too much).

This page in particular shows the basics of how to populate your Java beans with values from the page:

http://java.sun.com/javaee/5/docs/tutorial/doc/JSPIntro8.html#wp101870

http://www.jsptut.com/Forms.jsp

There are plenty of JDBC tutorials around on the net that explain how to load/save from database into beans. I'll be lazy and tell you to google them.

Personally I think a framework like struts/JSF help a lot in automating away a lot of the code. I also think that struts is NOT out of scope on this forum, but thats another discussion ;-)

Having said that, struts/JSF depend upon the JSP/Servlet infrastructure, and knowing how that works "under the hood" speeds up learning of Struts/JSF by a huge amount.

Thats my 2 cents.

Cheers,

evnafets

evnafetsa at 2007-7-12 23:46:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...