facebook

Taglibs in 2.6.0 [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #198067 Reply

    jw08816
    Member

    Scott,

    The tablib problem still exists after upgrading to 2.6.0. The following is the error message for each paramater and value pair:

    The method setAttribute(String, Object) in the type ServletRequest is not applicable for the arguments (String, int) browse.jsp j2ee/Web Root/jsp/reaction line 77

    Also I got the error message for another JSP page when pageContext is placed within <%! ——- %>

    pageContext cannot be resolved doLogin.jsp j2ee/Web Root/jsp/user line 63

    Finally, I could not stop at the beakpoint (no flag) for the following JSP page(profile.jsp):

    <%@ page import=”java.util.*,java.sql.*” %>
    <%@ page import=”com.netchem.resource.DataSourceManager” %>
    <%@ page import=”com.netchem.services.JspUtil” %>
    <%@ page import=”com.netchem.user.*” %>

    <%
    User user = (User) pageContext.getAttribute(“user”, PageContext.SESSION_SCOPE);
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
    <HTML><HEAD><TITLE></TITLE>
    <script language=”JavaScript” type=”text/JavaScript”>
    <!–
    var email = “<%= user == null ? “” : user.getEmail() %>”;
    var condition = ‘width=700, height=600, location=no,toolbar=no,status=no,scrollbars=yes,menubar=no,resizable=yes’;
    var condition3 = ‘width=500, height=300, location=no,toolbar=no,status=no,scrollbars=no,menubar=no,resizable=yes’;

    function edit() {
    window.open(‘user/editProfile.jsp?type=update’, ‘profile’, condition);
    }

    function create() {
    if (email == “”)
    window.open(“plogin.jsp”, “plogin”, condition3);
    else
    window.open(‘user/editProfile.jsp?type=add’, ‘profile’, condition);
    }

    function search() {
    var condition2 = ‘width=400, height=240, location=no,toolbar=no,status=no,scrollbars=yes,menubar=no,resizable=yes’;
    window.open(‘user/preSearchProfile.jsp’, ‘searchProfile’, condition2);
    }

    function onLoadCheck() {
    }

    function doAfterLogin() {
    window.location = window.location;
    }

    function doAfterPopup() {
    doAfterLogin();
    }

    function updateLogin() {
    window.open(“user/update.jsp”, “update”, condition3);
    }
    //–>
    </script>

    <form name=”radioForm”>

    <jsp:include page=”header.jsp” flush=”false”>
    <jsp:param name=”which” value = “profile” />
    <jsp:param name=”bgcolor” value = “#D9A244″ />
    </jsp:include>
    <td width=”518″ nowrap> <strong><font size=”2”>
    <%
    Profile profile = null;
    boolean bProfileFound = false;
    if (user != null && user.getId() > 0) {
    profile = ((UserHandler)DataSourceManager.lookup(“bean/user/userBean”)).findProfile(user.getId());

    System.out.println(“profile id: ” + profile.getId());

    if (profile.getId() < 1) {
    profile = new Profile();
    profile.setUserKey(user.getId());
    }
    pageContext.setAttribute(“show-profile”, profile, PageContext.SESSION_SCOPE);
    pageContext.setAttribute(“show-user”, user, PageContext.SESSION_SCOPE);
    } else {
    HashMap hmProfiles = ((UserHandler)DataSourceManager.lookup(“bean/user/userBean”)).getProfiles();
    Profile[] profiles = (Profile[])hmProfiles.values().toArray(new Profile[]{});

    System.out.println(“profiles size: ” + profiles.length);

    Random rand = (Random)pageContext.getAttribute(“random”, PageContext.APPLICATION_SCOPE);
    if (rand == null) {
    rand = new Random();
    pageContext.setAttribute(“random”, rand, PageContext.APPLICATION_SCOPE);
    }

    int index = (int)(rand.nextDouble()*profiles.length);
    profile = profiles[index];

    pageContext.setAttribute(“show-profile”, profile, PageContext.SESSION_SCOPE);

    User showUser = (User)((UserHandler)DataSourceManager.lookup(“bean/user/userBean”)).findUser(profile.getUserKey());
    pageContext.setAttribute(“show-user”, showUser, PageContext.SESSION_SCOPE);
    }
    %>
    <input name=”rsearch” type=”radio” checked onClick=”window.location=’profile.jsp'”>
    View
    <input name=”rsearch” type=”radio” onClick=”js:search();document.radioForm.reset()”>
    Search
    <%
    if (user != null) {
    %>
    <input name=”rsearch” type=”radio” onClick=”js:edit();document.radioForm.reset()”>
    Edit
    <input name=”rsearch” type=”radio” onClick=”js:updateLogin();document.radioForm.reset()”>
    Update Login
    <%
    }
    %>
    </font></strong></td>

    <%@ include file=”middler.html” %>

    <jsp:include page=”user/displayProfile.jsp”>
    </jsp:include>

    <%@ include file=”footer.html” %>
    </form>

    </BODY>
    </HTML>

    I got the following message instead:
    org.apache.jasper.JasperException: /jsp/profile.jsp(112,0 Expected “param” tag with “name” and “value” attributes.

    I reinstalled everything from scratch. All the above problems disappear when runing under tomcat 5.0.9 or tomcat.4.1.27 alone without eclipse or myeclipse.

    Please help.

    Thanks,
    Jerry

    #198070 Reply

    Scott Anderson
    Participant

    Jerry,

    You’re seeing this issue because you’re using an API that is only available in a Servlet 2.4-spec level container. Our JSP compiler currently uses the 2.3 specification, thus the difference. You can fix this if you change your setAttribute calls to be backward compatible to the 2.3 spec by using:

    
    setAttribute("some string", new Integer(someInt));
    instead of
    setAttribute("some string", someInt);
    

    In case you’re wondering, we use the 2.3 spec because 2.4 is only at the final draft stage. It is not a final released spec so this ensures that all the containers we support will support the spec we compile against.

    –Scott
    MyEclipse Support

    #198090 Reply

    No Operation
    Member

    Also I got the error message for another JSP page when pageContext is placed within <%! ——- %>

    Read the spec – since
    <%!

    %>
    defines members and function in the class, pageContext and all other local variables (also known as implicit objects) of the jspService function are not visible.

    NOP

    #198118 Reply

    jw08816
    Member

    Scott and NOP,

    All problems solved for the time being. Thanks very much.

    Jerry

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Taglibs in 2.6.0 [Closed]

You must be logged in to post in the forum log in