java
  • jsp
  • struts-1
  • 2016-05-09 17 views 2 likes 
    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"/> 
    

    文本什麼其他的方式來分配豆值HTML:文本默認值如何分配豆值HTML:在JSP

    回答

    0

    你不能有另一個標籤庫的屬性裏面一個標籤庫。你需要做的是在頁面中設置變量,然後再使用它。

    例如參見http://www.tutorialspoint.com/jsp/jstl_core_set_tag.htm

    2

    您不能將<bean>標籤與<html>標籤結合使用。

    使用<bean:define>定義一個帶有id的變量,下一個使用id與JSP EL將值設置爲<html:text>標記。

    嘗試以下操作:

    <bean:define id="sessUserId" scope="session" name="USERSESSION" property="userId" /> 
    
    <html:text tabindex="1" name="RequestForm" property="currentuser" value='${sessUserId}' readonly="true"/> 
    
    2

    你可以嘗試像

    <jsp:useBean id="USERSESSION" scope="session" type="<DATA_TYPE>"> 
    <html:text tabindex="1" name="RequestForm" property="currentuser" value='<%=USERSESSION.getUserid()%>' readonly="true"/> 
    
    相關問題