Forums Register Login

setting attribute using EL

+Pie Number of slices to send: Send
Hello,

can this be done using EL:

<% request.setAttribute("username");%>
+Pie Number of slices to send: Send
 

can this be done using EL:


No. EL is used to read values, not to set values. Remember that a JSP is usually used as a view, so all you should do is read data.
+Pie Number of slices to send: Send
i hope you mean
<% request.setAttribute("username", "user123"); %>

You can do this using JSTL EL,


or
if userName is a request parameter.


but as Christophe said, try to avoid setting variables in request, session, application scopes inside JSP (instead use controller). If you want to create temporary variables inside jsp, create those in "page" scope (in c:set, simply dont mention "scope" attribute).
+Pie Number of slices to send: Send
 

You can do this using JSTL EL


c:set is a JSTL tag, not something from the Expression Language ;)
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 5755 times.
Similar Threads
including webpage in jsp
concatenate Text Fields in JSP
java 1.5 list iteration using jstl tag
Need an attribute to be available in different places (SOLVED)
problems with EL in jsp and java bean
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 22:22:27.