0

The name of this question jstl_var_message
Hello and Thank you in advance for any assistance.


System info:

Netbeans, JSF, glassfish


The Purpose of this post is:

To set a variable to use to map the stylesheet.css to messages

The functionality of this code is:

In my login.jsp I have a tag that is supposed to set a var to use to format error messages.

My question is:

What do I have to do to use a var to locate the stylesheet to use for different messages?

The errors related to this code are:

I have a message telling me “According to TLD or attribute directive in tag file, attribute value does not accept any expressions”


Code description:

Please find the <c:set > tag. This is the login.jsp

<!-- login.jsp -->

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>

<!--c:remove var="subscriber" scope="session"-->

<f:view>

    <f:loadBundle var="labels" basename="view.res.Labels"/>
    <c:set var="stylesheet" value="${pageContext.request.contextPath}/stylesheet.css"/>

    <html>
        <head>
            <title><h:outputText value="#{labels.login}"/></title>
            <link rel="stylesheet.css" type="text/css" href="c:out value='${stylesheet}'/>">



        </head>
        <body>

            <h1><h:outputText value="#{labels.login}"/></h1>

            <h:outputLink value="subscribe.faces">
                <h:outputText value="#{labels.subscribe}"/>
            </h:outputLink>

            <h:form id="login">

                <h:messages globalOnly="true" styleClass="messageStyle"/>

                <p><h:outputLabel for="email"
                               value="#{labels.email}"/>
                    <h:message for="email" styleClass="message"/><br>
                    <h:inputText id="email" required="true"
                                 value="#{loginInfo.email}"
                                 size="40" maxlength="80">
                        <f:validateLength minimum="1" maximum="80"/>
                    </h:inputText>

                <p><h:outputLabel for="password"
                               value="#{labels.password}"/>
                    <h:message for="password" styleClass="message"/><br>
                    <h:inputSecret id="password" required="true"
                                   value="#{loginInfo.password}"
                                   size="10" maxlength="20">
                        <f:validateLength minimum="6" maximum="20"/>
                    </h:inputSecret>

                <p><h:commandButton id="command"
                                 value="#{labels.login}"
                                 action="#{loginInfo.loginAction}"/>

                </h:form>

        </body>
    </html>

</f:view>

Thanks again.
-ceyesumma

Note:
………………………………………………………………………………………………

Code description

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ceyesuma
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.