CSS selector for a checked radio button’s label

try the + symbol: It is Adjacent sibling combinator. It combines two sequences of simple selectors having the same parent and the second one must come IMMEDIATELY after the first. As such: input[type=”radio”]:checked+label{ font-weight: bold; } //a label that immediately follows an input of type radio that is checked works very nicely for the following … Read more

Preventing form resubmission

There are 2 approaches people used to take here: Method 1: Use AJAX + Redirect This way you post your form in the background using JQuery or something similar to Page2, while the user still sees page1 displayed. Upon successful posting, you redirect the browser to Page2. Method 2: Post + Redirect to self This … Read more

How can I retain HTML form field values in JSP after submitting form to Servlet?

You could access single-value request parameters by ${param}. <%@ taglib uri=”http://java.sun.com/jsp/jstl/functions” prefix=”fn” %> … <input name=”foo” value=”${fn:escapeXml(param.foo)}”> <textarea name=”bar”>${fn:escapeXml(param.bar)}</textarea> … <input type=”radio” name=”faz” value=”a” ${param.faz == ‘a’ ? ‘checked’ : ”} /> <input type=”radio” name=”faz” value=”b” ${param.faz == ‘b’ ? ‘checked’ : ”} /> <input type=”radio” name=”faz” value=”c” ${param.faz == ‘c’ ? ‘checked’ : ”} … Read more

Is it a good practice to use an empty URL for a HTML form’s action attribute? (action=””)

The best thing you can do is leave out the action attribute altogether. If you leave it out, the form will be submitted to the document’s address, i.e. the same page. It is also possible to leave it empty, and any browser implementing HTML’s form submission algorithm will treat it as equivalent to the document’s … Read more

What characters are allowed in an email address?

See RFC 5322: Internet Message Format and, to a lesser extent, RFC 5321: Simple Mail Transfer Protocol. RFC 822 also covers email addresses, but it deals mostly with its structure: addr-spec = local-part “@” domain ; global address local-part = word *(“.” word) ; uninterpreted ; case-preserved domain = sub-domain *(“.” sub-domain) sub-domain = domain-ref … Read more