2
<bean:write scope="session" name="USERSESSION" property="userId" />

<html:text tabindex="1"  name="RequestForm" property="currentuser" value='<bean:write scope="session" name="USERSESSION" property="userId" />' readonly="true"/>

What are the other ways to assign Bean value to Html:text default value

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Code Hungry
  • 3,930
  • 22
  • 67
  • 95

3 Answers3

2

You can not combine <bean> tags with <html> tags.

Use <bean:define> to define a variable with an id and next use id with JSP EL to set the value to <html:text> tag.

Try the following:

<bean:define id="sessUserId" scope="session" name="USERSESSION" property="userId" />

<html:text tabindex="1"  name="RequestForm" property="currentuser" value='${sessUserId}' readonly="true"/>
Srinu Chinka
  • 1,471
  • 13
  • 19
2

You can try something like

<jsp:useBean id="USERSESSION" scope="session" type="<DATA_TYPE>">
<html:text tabindex="1"  name="RequestForm" property="currentuser" value='<%=USERSESSION.getUserid()%>' readonly="true"/>
kaushikjain
  • 291
  • 2
  • 5
0

You can't have a taglib inside an attribute of another taglib. What you need to do, is set the variable in the page, then use it later.

See http://www.tutorialspoint.com/jsp/jstl_core_set_tag.htm for example.