Question

I want to define tag in TLD which will be look like this:
<zf:hashedInput path="id" />
How can I do implementation to create something like that:
<input type="hidden" id="id" name="id" value="1" />
<input type="hidden" name="id_hashed" value="someHash" />

I want to do it this way, because I want to check whether the given identifier has changed after submit form (was manipulated/modified in html).

Is this possible? How?

Was it helpful?

Solution

Something like this ?

/WEB-INF/tags/hashedInput.tag

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ attribute name="path" required="true" %>


<input type="hidden" id="${path}" name="${path}" value="1" />
<input type="hidden" name="${path}_hashed" value="someHash" />

myjsp.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" trimDirectiveWhitespaces="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="zf" tagdir="/WEB-INF/tags" %>

<zf:hashedInput path="id" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top