Showing posts with label JSP. Show all posts
Showing posts with label JSP. Show all posts

Wednesday, April 16, 2008

JSP - Wait before redirect page

You might want to add some delay before redirect the page, instead of using sendRedirect(), which will redirect immediately, you can use response.setHeader() in JSP.

response.setHeader("Refresh", "5; URL=http://pandaeatsbamboo.blogspot.com/test.jsp")

You will then be redirected to the page after 5 seconds.

Friday, February 22, 2008

Redirect Page in JSP

Wanna redirect the user to some pages that you want to show? Pretty simple in JSP:

String redirectURL = "http://hostname.com/index.jsp";
response.sendRedirect(redirectURL);

Saturday, February 2, 2008

JSP Execute shell script

Although there is security concern to do something like this, I might say that is convenient to do something like this instead of writing lots of complicated JSP pages to do simple system tasks.

Here ya go:

String linuxCmd = "./run.sh";
Runtime rt = Runtime.getRuntime();
rt.exec(linuxCmd);