Click here to Skip to main content
15,311,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, i'm trying to do the following:

i have a servlet, which executes some code.
in a case, i need to create a form element with stuff inside, and write it back to the "out" variable.

the problem is, i dont want to use a string builder to do it, i'd like to create a JSP page which holds the form, and forward the request params to it,
but also, when it finishes creating the page, i'd like to get the whole HTML back, and then print it to the "out" (in the servlet)

is it possible?

1 solution

Use the RequestDispatcher's forward method. See here for a discussion:[^].

Please let the JSP take care of the output though. That's the procedure in JSP programming: Let the servlets handle all the business logic and data access stuff and the JSP is used to render the whole thing to HTML.



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900