benk-master-flash
asked on
using println in a Servlet to output HTML page with button that links to another HTML page
Could somebody provide me with a quick and dirty line of code that will output
a HTML button that when clicked allows redirects the user to another page on the website.
I can use println to make webpages, but the quoting required for the HTML is problematic for me inside println(" ") statements
a HTML button that when clicked allows redirects the user to another page on the website.
I can use println to make webpages, but the quoting required for the HTML is problematic for me inside println(" ") statements
System.out.println("<input type=button name=buttob value='Click Me'> onClick=show()");
is that what u r expecting??
ASKER
OK - it makes the button i want it to link to http://localhost/core/index.jsp
can you make it do that
the onClick=show() syntax??? what is that?
can you make it do that
the onClick=show() syntax??? what is that?
System.out.println("<INPUT type=\"button\" name=\"TheButtonName\" value=\"Click Here\" onclick=\"doSomething()\">
and soSomething is a script to do someting you want when the button is clicked.
Hope this help you.
Bye, Giant.
and soSomething is a script to do someting you want when the button is clicked.
Hope this help you.
Bye, Giant.
System.out.println("<Scrip t>");
System.out.println("functi on show(){");
System.out.println("window .location. href='http://localhost/core/index.jsp'");
System.out.println("}");
System.out.println("</Scri pt>");
System.out.println("<input type=button name=buttob value='Click Me'> onClick=show()");
System.out.println("functi
System.out.println("window
System.out.println("}");
System.out.println("</Scri
System.out.println("<input
<SCRIPT language="JavaScript">
doSomething(){
window.open("http://localhost/core/index.jsp");
}
</SCRIPT>
doSomething(){
window.open("http://localhost/core/index.jsp");
}
</SCRIPT>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your commnets both solutions work. I have also found the below snippet works well for servlets.
<Script> tag what language is this JavaScript or vbScript
what is a good source of reference on this topic?
String orderformURL =
response.encodeURL("../Ord erForm.jsp ");
out.println
("<form action=\"" + orderformURL + "\">\n" +
"<big><center>\n" +
"<input type=\"SUBMIT\"\n" +
" value=\"Return to Order Form\">\n" +
"</center></big></form>");
<Script> tag what language is this JavaScript or vbScript
what is a good source of reference on this topic?
String orderformURL =
response.encodeURL("../Ord
out.println
("<form action=\"" + orderformURL + "\">\n" +
"<big><center>\n" +
"<input type=\"SUBMIT\"\n" +
" value=\"Return to Order Form\">\n" +
"</center></big></form>");
>both solutions work
A split could be better.
Thanks.
And sorry for not help you.
Bye, Giant.
A split could be better.
Thanks.
And sorry for not help you.
Bye, Giant.
benk-master-flash,
If two solutions are good for you, you can split the points. Do you want me to reopen it to do this?
Venabili
Java Page Editor
If two solutions are good for you, you can split the points. Do you want me to reopen it to do this?
Venabili
Java Page Editor