• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java and JSP  RSS feed

 
bob reilly
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a newbie question so please bear with me. I've been asked to modify a java class based on a flag (think checkbox) created on a jsp file. This is a J2EE environment. My question since my JSP experience is somewhat limited: how would the flag be passed to the java program?

My thinking is that the Java argument list would be expanded to include the flag. Another possibilty - if there was a buckect type object passed to "Java" - that it could be expanded to include it.

How may methods could you employ? Am I also correct in my assumption that JSP instantiates the object?

Thanking you in advance...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A checkbox woud normally be passed as a request parameter. You are not correct in assuming JSP instantiates the object; parameters are handled on form submission (after the JSP has been rendered and delivered to the client) by the servlet container.
 
bob reilly
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for responding.

So the servlet container handles the form submission and can process / retrieve form parameters?

My understanding of JSP is you use it for your front end and . For that matter use Java files for subsequent processing (this is a J2EE environment).

My question - how to I get a parameter value to Java to evaluate? Do you build that code in your JSP code? Can you get it in Java?

That's my question...

Thanks again.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP is an outgoing mechanism, not an incoming one. The fact that the HTML page that is being submitted to the servlet was created by a JSP is completely irrelevant. Once it gets to the browser, it's just HTML.

Perhaps this article can help jump-start your understanding of JSP.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!