Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need some advice for a good methodology to build my application

Status
Not open for further replies.

tyris

Programmer
Nov 2, 2000
311
FR
hi all,

I'm making my first web app under websphere + visual age.
my web app is really simple : i have currencies and i must update the currency change rate each month. so i have 2 specific functions in my servlet :

- search function: search for the good currency in the database
- apply function : apply the changes and refresh the web page with the new values.

I've done almost all work except something.
here is my question : i don't know what is the best way to do, maybe you could help me :

when I've executed the search function, how should i load the results of my search in the web page ?
should i use variables in the jsp, call the search function in my servlet , put the values found in the variables of the jsp and then call the jsp
to be refreshed from the servlet with the variables ? or is there a "cleaner" method to do ?

I'm sorry for my coarse English,
Best regards X-),
Elise
 
Hi Elise,

What you can do is maybe you might want to use the PrintWrinter, that you can get from the method response.getWriter() where response is an instance of the class HttpServlertResponse.

So for example,

//...
public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();

//you can make call your search method here

out.println(&quot;<html>&quot;);
out.println(&quot;<head><title>Hello World</title></head>&quot;);
out.println(&quot;<body>&quot;);

//you can add the search results here

out.println(&quot;</body>&quot;);
out.println(&quot;</html>&quot;);
}
}

This way, you wouldn't have to reload the jsp page with the new values. There are a lot of ways that you can go about doing this but it is all up to you.

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top