在JSP页面上没有填充Bean值

时间:2016-10-27 05:49:58

标签: java jsp web.xml backing-beans

我是Java新手...我制作了这个应用程序,但问题是,当我运行项目时,我收到了我在h标签{{1}中写的文字}而不是bean的值。我搜索了很多,但问题仍然存在。代码和屏幕截图讲述了故事的其余部分。这是我的login.jsp:

value

这是我的支持者:

    </head>

    <body>
    <f:view>
        <div class="login_container">
            <h:messages errorClass="errorMsg"/>
            <div class="login_box">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td>
                            <div class="login_wrap">
                                <div class="login_logo">
                                    <img src="images/login_logo.gif" width="116" height="141" />
                                </div>
                                <h:form id="login_form">
                                    <div class="login_form">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td>
                                        <div style="float: left;">
                                            <h2 class="orange">
                                                Please Login
                                            </h2>
                                        </div>
                                        <div class="login_icon">
                                            <img src="images/icn_lock.png" width="16" height="16" />
                                        </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <label>
                                                        Username
                                                    </label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td><h:inputText id="username" value="#{loginBean.username}" /></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <label>
                                                        Password
                                                    </label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td><h:inputText id="password" value="#{loginBean.password}"/>

                                                </td>
                                            </tr>
                                            <tr>
                                                <td>&nbsp;

                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="left" valign="middle">

                                                        <h:commandButton image="images/btn_login.gif" id="loginButton" action="#{loginBean.login}"
                                                            style="width:81px; height:29px" />

                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </h:form>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="login_box_bt">
                                &nbsp;
                            </div>
                        </td>
                    </tr>
                </table>
            </div>


            <div class="login_footer_box">
            <div class="login_footer">
                <div class="login_footer_text">
                    <p>

            <span class="text_orange">Phone:</span> (+92-51) 5120684
                        <br />
                        <span class="text_orange">E-mail:</span> support@noeticworld.com
                            <br />
                        <span class="text_orange">Web:</span> http://www.noeticworld.com.pk


            </p></div>
                <div class="login_footer1_text">
                    <p>
                        <span class="text_orange">Leading VAS Solution Provider
            </span>
                        <% /**<span class="text_orange">Fax:</span> (+92-51) 260 9263*/ %>
                        <br />
                    </p></div>
                </div>
                </div>
                <div class="login_box_bt">
                                &nbsp;

                            </div>





        </f:view>
    </body>
</html>

这是问题,用户名和密码显示文字:

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试用$ {~~}

替换#{~~}