How to use requestScope to pass value from jsp to portlet

lucifer

I am trying to send some value in my jsp to a portlet class.I am using jstl to achieve that ,my requirement is to use requestScope to pass the value in the portlet.Here i have seen that when i am using requestScope to create URL in portlet it is working fine,but in case of value passing it is not working,i am posting my code what i have done so far

<fmt:setBundle basename="Language-ext"/>
<form action="<c:out value='${requestScope.registerUserActionUrl}'/>" method="POST">
<table width="200px">
 <tr>
  <td colspan="2">
    <font color="#FF0000"><c:out 
       value="${requestScope.errorMsg}"/></font>
</td>
</tr>
<tr>
  <td><fmt:message key="label.firstName"/></td>
    <td><input type="text" name="firstName" value="${requestScope.User.firstName}"></input></td>
 </tr>
 <tr>
<td>&nbsp;</td>
</tr>
 <tr>
<td><fmt:message key="label.lastName"/></td>
<td><input type="text" name="lastName" value="${requestScope.User.lastName}"></input></td>
 </tr>
 <tr>
<td>&nbsp;</td>
 </tr>
 <tr>
<td><font color="#FF0000"><b>*</b></font>&nbsp;<fmt:message key="label.email"/></td>
<td><input type="text" name="email" value="${requestScope.User.email}"></input>     </td>
</tr>
 <tr>
<td>&nbsp;</td>
</tr>
<tr align="center">
 <td colspan="2">
    <input type="submit"/>
    &nbsp;
  <a href="<c:out value='${requestScope.resetRenderUrl}'/>">
    <b><fmt:message key="label.reset"/></b>
  </a>
</td>
</tr>

And this is my bean class

public class User implements Serializable{

/**
 * 
 */
private static final long serialVersionUID = -5729328658617182010L;
private String firstName;
private String lastName;
private String email;

public User(String firstName,String lastName,String email){

    super();
    this.firstName = firstName;
    this.lastName = lastName;
    this.email = email;
}

public String getFirstName() {
    return firstName;
}

public void setFirstName(String firstName) {
    this.firstName = firstName;
}

public String getLastName() {
    return lastName;
}

public void setLastName(String lastName) {
    this.lastName = lastName;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

And this is the portlet where i am catching the value

@ProcessAction(name = "registerUserAction")
public void registerUser(ActionRequest request, ActionResponse response)
        throws PortletException, IOException {
    String email = request.getParameter("email");
    System.out.println("Email :"+email +","+request.getParameter("firstName"));
    // --set the information entered by the user on the registration

But i am getting null for both email and firstName .Somebody please help

Tomas Pinos

Answer relevant for Liferay 6.2

By default, Liferay 6.2 requires request parameters for a given portlet to be prefixed with the portlet namespace. In plain HTML, you need to specify the namespace for each request parameter / form field explicitely by using <portlet:namespace/> tag:

<input type="text" name="<portlet:namespace/>firstName" value="${requestScope.User.firstName}">

Don't forget the required TLD import:

<%@taglib prefix="portlet" uri="http://java.sun.com/portlet" %>

Only the namespaced parameters are visible to the portlet (through standard portlet API).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Creating liferay portlet - How to pass data to to myScript.js from Java class via view.jsp

From Dev

How to pass input text value as portlet param

From Dev

How to get selected value from drop down list in one jsp to java controller class in liferay portlet references

From Dev

How to pass a value from one jsp to another jsp page?

From Dev

How to pass a value from loop of JSP page to another JSP page?

From Dev

how to redirect from jsp of one portlet to jsp of another portlet inside liferay module project in liferay 7

From Dev

How to navigate from portlet to portlet

From Dev

Spring mvc portlet: how to get data from jsp?

From Dev

Spring mvc portlet: how to get data from jsp?

From Dev

pass value from Android to JSP

From Dev

How to pass key-value pair from jsp to servlet?

From Dev

How to pass text field value from jsp to java class

From Dev

How to pass a decimal value from JSP to Action with a Localized decimal separator?

From Dev

How to pass form input value from jsp page to java class?

From Dev

How to pass a decimal value from JSP to Action with a Localized decimal separator?

From Dev

Can I use same requestScope more than one time in jsp

From Dev

How does requestScope object of Expression Language work in a JSP file?

From Dev

How to use jsp value in servlets?

From Dev

How to position html objects on a portlet jsp?

From Dev

How to pass a id value to my modal in jsp?

From Dev

How to call the content of a jsp into another portlet's jsp

From Dev

Send the value back from pop up portlet to parent portlet

From Dev

How to pass input value from one form to another form at same jsp page?

From Dev

How to read and pass data from servlet to JSP

From Dev

How to pass parameter from a jsp page to a servlet?

From Dev

How to pass JasperPrint from Servlet to JSP

From Dev

How to pass Objects from servlets to JSP?

From Dev

How to pass variable from java to jsp?

From Dev

How to pass a List from the controller to jsp?

Related Related

  1. 1

    Creating liferay portlet - How to pass data to to myScript.js from Java class via view.jsp

  2. 2

    How to pass input text value as portlet param

  3. 3

    How to get selected value from drop down list in one jsp to java controller class in liferay portlet references

  4. 4

    How to pass a value from one jsp to another jsp page?

  5. 5

    How to pass a value from loop of JSP page to another JSP page?

  6. 6

    how to redirect from jsp of one portlet to jsp of another portlet inside liferay module project in liferay 7

  7. 7

    How to navigate from portlet to portlet

  8. 8

    Spring mvc portlet: how to get data from jsp?

  9. 9

    Spring mvc portlet: how to get data from jsp?

  10. 10

    pass value from Android to JSP

  11. 11

    How to pass key-value pair from jsp to servlet?

  12. 12

    How to pass text field value from jsp to java class

  13. 13

    How to pass a decimal value from JSP to Action with a Localized decimal separator?

  14. 14

    How to pass form input value from jsp page to java class?

  15. 15

    How to pass a decimal value from JSP to Action with a Localized decimal separator?

  16. 16

    Can I use same requestScope more than one time in jsp

  17. 17

    How does requestScope object of Expression Language work in a JSP file?

  18. 18

    How to use jsp value in servlets?

  19. 19

    How to position html objects on a portlet jsp?

  20. 20

    How to pass a id value to my modal in jsp?

  21. 21

    How to call the content of a jsp into another portlet's jsp

  22. 22

    Send the value back from pop up portlet to parent portlet

  23. 23

    How to pass input value from one form to another form at same jsp page?

  24. 24

    How to read and pass data from servlet to JSP

  25. 25

    How to pass parameter from a jsp page to a servlet?

  26. 26

    How to pass JasperPrint from Servlet to JSP

  27. 27

    How to pass Objects from servlets to JSP?

  28. 28

    How to pass variable from java to jsp?

  29. 29

    How to pass a List from the controller to jsp?

HotTag

Archive