7

I am wondering is there anyway to define a variable in HTML/JSP. I googled very hard but couldn't find any resources on this. Basically in my html/jsp I am trying to save an external value into a variable that's specific to the html/jsp, so that I can print this variable to the webpage afterwards. Let's say this external value is 5. Can we do something like

x=5 ?

T

1 Answer 1

18

Do you mean something like this?

<c:set var="x" value="5"/> 
...
${x}

<c:set> is a tag from the JSTL.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.